image: ubuntu:xenial pipelines: default: - step: name: Build and Package services: - docker script: - export BASE_DIR="$(readlink -f .)" - export RELEASE_VERSION=1.9 - export BUILD_FILE="kasmvnc_${RELEASE_VERSION}.${BITBUCKET_COMMIT}.tar.gz" - export S3_BUILD_DIRECTORY="kasmvnc/${BITBUCKET_COMMIT}" - export SANITIZED_BRANCH="$(echo $BITBUCKET_BRANCH | sed 's/\//_/g')" - apt-get update - apt-get install -y git python3 python3-pip python3-boto3 curl - echo $SANITIZED_BRANCH - docker build -t kasmvncbuilder:latest -f builder/dockerfile.build . - docker run -v $BITBUCKET_CLONE_DIR:/build kasmvncbuilder:latest - ls -la $BITBUCKET_CLONE_DIR - ls -la $BITBUCKET_CLONE_DIR/kasmvnc-Linux-x86_64-*.tar.gz - git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git - python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${S3_BUCKET}" $BITBUCKET_CLONE_DIR/kasmvnc-Linux-x86_64-*.tar.gz "${S3_BUILD_DIRECTORY}/${BUILD_FILE}" - export S3_URL="https://${S3_BUCKET}.s3.amazonaws.com/${S3_BUILD_DIRECTORY}/${BUILD_FILE}" - export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${BUILD_FILE}\", \"url\":\"${S3_URL}\"}" - echo ${BITBUCKET_REPO_OWNER} - echo ${BITBUCKET_REPO_SLUG} - echo ${BITBUCKET_COMMIT} - echo ${BB_AUTH_STRING} - echo ${BUILD_STATUS} - curl -H "Content-Type:application/json" -X POST --user "${BB_AUTH_STRING}" -d "${BUILD_STATUS}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/commit/${BITBUCKET_COMMIT}/statuses/build"