github.com/pquerna/agent@v2.1.8+incompatible/scripts/debian-package.sh (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  if [[ "$CODENAME" == "" ]]; then
     5    echo "Error: Missing \$CODENAME (stable or unstable)"
     6    exit 1
     7  fi
     8  
     9  echo '--- Getting agent version from build meta data'
    10  
    11  export FULL_AGENT_VERSION=$(buildkite-agent meta-data get "agent-version-full")
    12  export AGENT_VERSION=$(buildkite-agent meta-data get "agent-version")
    13  export BUILD_VERSION=$(buildkite-agent meta-data get "agent-version-build")
    14  
    15  echo "Full agent version: $FULL_AGENT_VERSION"
    16  echo "Agent version: $AGENT_VERSION"
    17  echo "Build version: $BUILD_VERSION"
    18  
    19  function build() {
    20    echo "--- Building debian package $1/$2"
    21  
    22    BINARY_FILENAME="pkg/buildkite-agent-$1-$2"
    23  
    24    # Download the built binary artifact
    25    buildkite-agent artifact download $BINARY_FILENAME .
    26  
    27    # Make sure it's got execute permissions so we can extract the version out of it
    28    chmod +x $BINARY_FILENAME
    29  
    30    # Build the debian package using the architectre and binary, they are saved to deb/
    31    ./scripts/utils/build-linux-package.sh "deb" $2 $BINARY_FILENAME $AGENT_VERSION $BUILD_VERSION
    32  }
    33  
    34  function publish() {
    35    echo "+++ Shipping $1"
    36  
    37    ./scripts/utils/publish-debian-package.sh $1 $CODENAME
    38  }
    39  
    40  # Export the function so we can use it in xargs
    41  export -f publish
    42  
    43  echo '--- Installing dependencies'
    44  bundle
    45  
    46  # Make sure we have a clean deb folder
    47  rm -rf deb
    48  
    49  # Build the packages into deb/
    50  build "linux" "amd64"
    51  build "linux" "386"
    52  build "linux" "arm"
    53  build "linux" "armhf"
    54  build "linux" "arm64"
    55  
    56  # Loop over all the .deb files and publish them
    57  ls deb/*.deb | xargs -I {} bash -c "publish {}"