From 04d045a921884f99f352e58b940311642da45a95 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Wed, 20 Jan 2021 10:18:58 -0800 Subject: [PATCH 01/10] test manual workflow --- .github/workflows/release-build-publish.yml | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/release-build-publish.yml diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml new file mode 100644 index 0000000..c51f553 --- /dev/null +++ b/.github/workflows/release-build-publish.yml @@ -0,0 +1,93 @@ +name: Release build and publish +on: + workflow_dispatch: + inputs: + version: + description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1 + required: true + +jobs: + build_publish_daemon_image: + name: Build and Publish X-Ray daemon docker image to docker hub and public ECR + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '^1.15' + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Build archives and test + run: make build test + env: + VERSION: ${{ github.event.inputs.version }} + + - name: Build linux archives + run: make packaging + + - name: Upload archives as actions artifact + uses: actions/upload-artifact@v2 + with: + name: distributions + path: build/dist/ + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Public ECR + uses: docker/login-action@v1 + with: + registry: public.ecr.aws + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build docker image + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + tags: | + amazon/aws-xray-daemon:${{ github.event.inputs.version }} + public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: 'v${{ github.event.inputs.version }}' + release_name: 'AWS X-Ray daemon update v${{ github.event.inputs.version }}' + body: 'Please refer [change-log](https://github.com/aws/aws-xray-sdk-go/blob/master/CHANGELOG.md) for more details' + draft: true + prerelease: false From 9bf0a781ff87774ff4230d4a9b5c7a84780bba85 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Wed, 20 Jan 2021 10:23:36 -0800 Subject: [PATCH 02/10] modified master to test release --- .github/workflows/release-build-publish.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index c51f553..0b52fd0 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -52,12 +52,6 @@ jobs: with: registry: public.ecr.aws - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -73,9 +67,7 @@ jobs: uses: docker/build-push-action@v2 with: platforms: linux/amd64,linux/arm64 - tags: | - amazon/aws-xray-daemon:${{ github.event.inputs.version }} - public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} + tags: public.ecr.aws/tghg4/test-ecr:${{ github.event.inputs.version }} push: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache From 1f90491ca8cab5869cf4d507d70ef942b0fdb399 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Wed, 20 Jan 2021 10:39:42 -0800 Subject: [PATCH 03/10] added context --- .github/workflows/release-build-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index 0b52fd0..5a8b6b9 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -66,6 +66,7 @@ jobs: - name: Build docker image uses: docker/build-push-action@v2 with: + context: . platforms: linux/amd64,linux/arm64 tags: public.ecr.aws/tghg4/test-ecr:${{ github.event.inputs.version }} push: true From 00090d2bd7b02b1f6e247d2adf6ed95f426c7361 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Mon, 3 May 2021 06:40:51 -0700 Subject: [PATCH 04/10] test xray-daemon artifact download --- .github/workflows/release-build-publish.yml | 160 +++++++++++++------- 1 file changed, 104 insertions(+), 56 deletions(-) diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index 46f76e1..e783966 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -8,12 +8,29 @@ on: major_version: description: The major version to tag the release with, e.g., 1.x, 2.x, 3.x required: true + latest_commit_id: + description: Latest commit id of the repository (usually commit id of the release commit) + required: true jobs: build_publish_daemon_image: name: Build X-Ray daemon artifacts and publish docker image to docker hub and public ECR runs-on: ubuntu-latest steps: + - name: Validate CI job has passed + uses: fountainhead/action-wait-for-check@v1.0.0 + id: wait-for-build + with: + token: ${{ secrets.GITHUB_TOKEN }} + # check name should be the name of the integration test job + checkName: Build on ubuntu-latest + ref: ${{ github.event.inputs.latest_commit_id }} + timeoutSeconds: 60 + + - name: Fail CD job if CI job is not passed + if: steps.wait-for-build.outputs.conclusion == 'failure' || steps.wait-for-build.outputs.conclusion == 'timed_out' + run: exit 1 + - name: Checkout Repository uses: actions/checkout@v2 @@ -74,64 +91,95 @@ jobs: name: distributions path: build/dist/ - - name: Login to Public ECR - uses: docker/login-action@v1 - with: - registry: public.ecr.aws +# - name: Login to Public ECR +# uses: docker/login-action@v1 +# with: +# registry: public.ecr.aws +# +# - name: Login to DockerHub +# uses: docker/login-action@v1 +# with: +# username: ${{ secrets.DOCKER_USER }} +# password: ${{ secrets.DOCKER_PASS }} +# +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v1 +# +# - name: Cache Docker layers +# uses: actions/cache@v2 +# with: +# path: /tmp/.buildx-cache +# key: ${{ runner.os }}-buildx-${{ github.sha }} +# restore-keys: | +# ${{ runner.os }}-buildx- +# +# - name: Build docker image for Public ECR +# uses: docker/build-push-action@v2 +# with: +# context: . +# file: ./Dockerfile +# platforms: linux/amd64,linux/arm64 +# tags: | +# public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} +# public.ecr.aws/xray/aws-xray-daemon:latest +# public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.major_version }} +# push: true +# cache-from: type=local,src=/tmp/.buildx-cache +# cache-to: type=local,dest=/tmp/.buildx-cache +# +# - name: Build docker image for DockerHub +# uses: docker/build-push-action@v2 +# with: +# context: . +# file: ./Dockerfile.amazonlinux +# platforms: linux/amd64,linux/arm64 +# tags: | +# amazon/aws-xray-daemon:${{ github.event.inputs.version }} +# amazon/aws-xray-daemon:latest +# amazon/aws-xray-daemon:${{ github.event.inputs.major_version }} +# push: true +# cache-from: type=local,src=/tmp/.buildx-cache +# cache-to: type=local,dest=/tmp/.buildx-cache +# +# - name: Create Release +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: 'v${{ github.event.inputs.version }}' +# release_name: 'AWS X-Ray daemon update v${{ github.event.inputs.version }}' +# body: 'Please refer [change-log](https://github.com/aws/aws-xray-daemon/blob/master/CHANGELOG.md) for more details' +# draft: true +# prerelease: false + + publish_to_s3: + name: Publish X-Ray daemon binaries to staging s3 bucket + needs: build_publish_daemon_image + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Download daemon artifacts from Github + uses: actions/download-artifact@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + name: distributions + path: upload_ready_binaries - - name: Cache Docker layers - uses: actions/cache@v2 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 - - name: Build docker image for Public ECR - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} - public.ecr.aws/xray/aws-xray-daemon:latest - public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.major_version }} - push: true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Build docker image for DockerHub - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile.amazonlinux - platforms: linux/amd64,linux/arm64 - tags: | - amazon/aws-xray-daemon:${{ github.event.inputs.version }} - amazon/aws-xray-daemon:latest - amazon/aws-xray-daemon:${{ github.event.inputs.major_version }} - push: true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: 'v${{ github.event.inputs.version }}' - release_name: 'AWS X-Ray daemon update v${{ github.event.inputs.version }}' - body: 'Please refer [change-log](https://github.com/aws/aws-xray-daemon/blob/master/CHANGELOG.md) for more details' - draft: true - prerelease: false + - name: debug + run: ls + working-directory: upload_ready_binaries + +# - name: Upload packaged binaries to staging s3 bucket +# uses: actions/upload-artifact@v2 +# with: +# name: packaged_signed_distributions +# path: packaged_binaries From 73d6be98fb6ec6f2d3c518cc99d3ab7248bae2ef Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Mon, 3 May 2021 06:47:18 -0700 Subject: [PATCH 05/10] add minor change for test --- .github/workflows/continuous-build.yml | 1 + .github/workflows/release-build-publish.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-build.yml b/.github/workflows/continuous-build.yml index eb482f1..2799570 100644 --- a/.github/workflows/continuous-build.yml +++ b/.github/workflows/continuous-build.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - release_workflow_CI_verification pull_request: branches: - master diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index e783966..444f225 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -23,7 +23,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} # check name should be the name of the integration test job - checkName: Build on ubuntu-latest + checkName: Build on macos-latest ref: ${{ github.event.inputs.latest_commit_id }} timeoutSeconds: 60 From 0bdddc45bc59d58262390197ad3a9a5ce8448caf Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Mon, 3 May 2021 08:32:51 -0700 Subject: [PATCH 06/10] test --- .github/workflows/release-build-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index 444f225..02391a3 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -175,8 +175,9 @@ jobs: aws-region: us-east-1 - name: debug - run: ls - working-directory: upload_ready_binaries + run: | + ls + ls upload_ready_binaries # - name: Upload packaged binaries to staging s3 bucket # uses: actions/upload-artifact@v2 From eccb73af2072ca52705d03f06f9d2d515ea34778 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Mon, 3 May 2021 23:44:15 -0700 Subject: [PATCH 07/10] test s3 uploading --- .github/workflows/release-build-publish.yml | 7 +-- Tool/src/publish-s3.sh | 63 +++++++++++++++++++++ 2 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 Tool/src/publish-s3.sh diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index 02391a3..7ce6843 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -179,8 +179,5 @@ jobs: ls ls upload_ready_binaries -# - name: Upload packaged binaries to staging s3 bucket -# uses: actions/upload-artifact@v2 -# with: -# name: packaged_signed_distributions -# path: packaged_binaries + - name: Upload packaged binaries to staging s3 bucket + run: s3_bucket_name=aws-xray-daemon-assets.staging release_version=3.3.0 major_version=3.x bash Tool/src/publish-s3.sh diff --git a/Tool/src/publish-s3.sh b/Tool/src/publish-s3.sh new file mode 100644 index 0000000..7cde912 --- /dev/null +++ b/Tool/src/publish-s3.sh @@ -0,0 +1,63 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + + +#! /bin/bash + +set -e + +########################################## +# This script is used in X-Ray daemon CD workflow +# to publish X-Ray daemon binaries to s3 +# +# Env vars +# 1. s3_bucket_name +# 2. release_version +# 3. major_version +########################################## + +# check environment vars +if [ -z ${s3_bucket_name} ]; then + s3_bucket_name="aws-xray-daemon-assets.staging" + echo "use default s3_bucket_name: ${s3_bucket_name}" +else + echo "load s3_bucket_name from env var: ${s3_bucket_name}" +fi + +# define vars +package_name="aws-xray-daemon" + +# check if all the required files are there +declare -a required_files=( + "upload_ready_binaries/${package_name}-${major_version}.deb" + "upload_ready_binaries/${package_name}-${major_version}.rpm" + "upload_ready_binaries/${package_name}-arm64-${major_version}.deb" + "upload_ready_binaries/${package_name}-arm64-${major_version}.rpm" + "upload_ready_binaries/${package_name}-linux-${major_version}.zip" + "upload_ready_binaries/${package_name}-linux-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-linux-amd64-${release_version}.deb" +) + +for i in "${required_files[@]}" +do + if [ ! -f "${i}" ]; then + echo "${i} does not exist" + exit 1 + fi +done + +# upload packages to s3 +for i in "${required_files[@]}" +do + aws s3api put-object --bucket "${s3_bucket_name}" --key "${release_version}/${i}" --body "${i}" +done \ No newline at end of file From 9627481643dd1f6cbf7889092c0c6e8407fb6ea9 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Tue, 4 May 2021 00:27:55 -0700 Subject: [PATCH 08/10] added all required binary files --- .github/workflows/release-build-publish.yml | 5 --- Tool/src/publish-s3.sh | 37 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index 7ce6843..d5c31e9 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -174,10 +174,5 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - - name: debug - run: | - ls - ls upload_ready_binaries - - name: Upload packaged binaries to staging s3 bucket run: s3_bucket_name=aws-xray-daemon-assets.staging release_version=3.3.0 major_version=3.x bash Tool/src/publish-s3.sh diff --git a/Tool/src/publish-s3.sh b/Tool/src/publish-s3.sh index 7cde912..79e88aa 100644 --- a/Tool/src/publish-s3.sh +++ b/Tool/src/publish-s3.sh @@ -46,6 +46,43 @@ declare -a required_files=( "upload_ready_binaries/${package_name}-linux-${major_version}.zip" "upload_ready_binaries/${package_name}-linux-${major_version}.zip.sig" "upload_ready_binaries/${package_name}-linux-amd64-${release_version}.deb" + "upload_ready_binaries/${package_name}-linux-amd64-${release_version}.rpm" + "upload_ready_binaries/${package_name}-linux-amd64-${release_version}.zip" + "upload_ready_binaries/${package_name}-linux-amd64-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-linux-amd64-${major_version}.deb" + "upload_ready_binaries/${package_name}-linux-amd64-${major_version}.rpm" + "upload_ready_binaries/${package_name}-linux-amd64-${major_version}.zip" + "upload_ready_binaries/${package_name}-linux-amd64-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-linux-arm64-${release_version}.deb" + "upload_ready_binaries/${package_name}-linux-arm64-${release_version}.rpm" + "upload_ready_binaries/${package_name}-linux-arm64-${release_version}.zip" + "upload_ready_binaries/${package_name}-linux-arm64-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-linux-arm64-${major_version}.deb" + "upload_ready_binaries/${package_name}-linux-arm64-${major_version}.rpm" + "upload_ready_binaries/${package_name}-linux-arm64-${major_version}.zip" + "upload_ready_binaries/${package_name}-linux-arm64-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-macos-${major_version}.zip" + "upload_ready_binaries/${package_name}-macos-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-macos-amd64-${release_version}.zip" + "upload_ready_binaries/${package_name}-macos-amd64-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-macos-amd64-${major_version}.zip" + "upload_ready_binaries/${package_name}-macos-amd64-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-macos-arm64-${release_version}.zip" + "upload_ready_binaries/${package_name}-macos-arm64-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-macos-arm64-${major_version}.zip" + "upload_ready_binaries/${package_name}-macos-arm64-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-amd64-${release_version}.zip" + "upload_ready_binaries/${package_name}-windows-amd64-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-amd64-${major_version}.zip" + "upload_ready_binaries/${package_name}-windows-amd64-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-amd64-service-${release_version}.zip" + "upload_ready_binaries/${package_name}-windows-amd64-service-${release_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-amd64-service-${major_version}.zip" + "upload_ready_binaries/${package_name}-windows-amd64-service-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-process-${major_version}.zip" + "upload_ready_binaries/${package_name}-windows-process-${major_version}.zip.sig" + "upload_ready_binaries/${package_name}-windows-service-${major_version}.zip" + "upload_ready_binaries/${package_name}-windows-service-${major_version}.zip.sig" ) for i in "${required_files[@]}" From 1eb7a674cd337c9f671063a538e9d4de8d62bf66 Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Tue, 4 May 2021 00:50:07 -0700 Subject: [PATCH 09/10] removed testing code --- .github/workflows/continuous-build.yml | 1 - .github/workflows/release-build-publish.yml | 126 ++++++++++---------- Tool/src/publish-s3.sh | 19 +-- 3 files changed, 66 insertions(+), 80 deletions(-) diff --git a/.github/workflows/continuous-build.yml b/.github/workflows/continuous-build.yml index 2799570..eb482f1 100644 --- a/.github/workflows/continuous-build.yml +++ b/.github/workflows/continuous-build.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - release_workflow_CI_verification pull_request: branches: - master diff --git a/.github/workflows/release-build-publish.yml b/.github/workflows/release-build-publish.yml index d5c31e9..8740d0e 100644 --- a/.github/workflows/release-build-publish.yml +++ b/.github/workflows/release-build-publish.yml @@ -22,7 +22,7 @@ jobs: id: wait-for-build with: token: ${{ secrets.GITHUB_TOKEN }} - # check name should be the name of the integration test job + # ToDO: check name should be the name of the integration test job once we set up CI workflow checkName: Build on macos-latest ref: ${{ github.event.inputs.latest_commit_id }} timeoutSeconds: 60 @@ -91,67 +91,67 @@ jobs: name: distributions path: build/dist/ -# - name: Login to Public ECR -# uses: docker/login-action@v1 -# with: -# registry: public.ecr.aws -# -# - name: Login to DockerHub -# uses: docker/login-action@v1 -# with: -# username: ${{ secrets.DOCKER_USER }} -# password: ${{ secrets.DOCKER_PASS }} -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v1 -# -# - name: Cache Docker layers -# uses: actions/cache@v2 -# with: -# path: /tmp/.buildx-cache -# key: ${{ runner.os }}-buildx-${{ github.sha }} -# restore-keys: | -# ${{ runner.os }}-buildx- -# -# - name: Build docker image for Public ECR -# uses: docker/build-push-action@v2 -# with: -# context: . -# file: ./Dockerfile -# platforms: linux/amd64,linux/arm64 -# tags: | -# public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} -# public.ecr.aws/xray/aws-xray-daemon:latest -# public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.major_version }} -# push: true -# cache-from: type=local,src=/tmp/.buildx-cache -# cache-to: type=local,dest=/tmp/.buildx-cache -# -# - name: Build docker image for DockerHub -# uses: docker/build-push-action@v2 -# with: -# context: . -# file: ./Dockerfile.amazonlinux -# platforms: linux/amd64,linux/arm64 -# tags: | -# amazon/aws-xray-daemon:${{ github.event.inputs.version }} -# amazon/aws-xray-daemon:latest -# amazon/aws-xray-daemon:${{ github.event.inputs.major_version }} -# push: true -# cache-from: type=local,src=/tmp/.buildx-cache -# cache-to: type=local,dest=/tmp/.buildx-cache -# -# - name: Create Release -# id: create_release -# uses: actions/create-release@v1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# tag_name: 'v${{ github.event.inputs.version }}' -# release_name: 'AWS X-Ray daemon update v${{ github.event.inputs.version }}' -# body: 'Please refer [change-log](https://github.com/aws/aws-xray-daemon/blob/master/CHANGELOG.md) for more details' -# draft: true -# prerelease: false + - name: Login to Public ECR + uses: docker/login-action@v1 + with: + registry: public.ecr.aws + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build docker image for Public ECR + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + tags: | + public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }} + public.ecr.aws/xray/aws-xray-daemon:latest + public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.major_version }} + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Build docker image for DockerHub + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.amazonlinux + platforms: linux/amd64,linux/arm64 + tags: | + amazon/aws-xray-daemon:${{ github.event.inputs.version }} + amazon/aws-xray-daemon:latest + amazon/aws-xray-daemon:${{ github.event.inputs.major_version }} + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: 'v${{ github.event.inputs.version }}' + release_name: 'AWS X-Ray daemon update v${{ github.event.inputs.version }}' + body: 'Please refer [change-log](https://github.com/aws/aws-xray-daemon/blob/master/CHANGELOG.md) for more details' + draft: true + prerelease: false publish_to_s3: name: Publish X-Ray daemon binaries to staging s3 bucket @@ -175,4 +175,4 @@ jobs: aws-region: us-east-1 - name: Upload packaged binaries to staging s3 bucket - run: s3_bucket_name=aws-xray-daemon-assets.staging release_version=3.3.0 major_version=3.x bash Tool/src/publish-s3.sh + run: s3_bucket_name=aws-xray-assets.staging release_version=${{ github.event.inputs.version }} major_version=${{ github.event.inputs.major_version }} bash Tool/src/publish-s3.sh diff --git a/Tool/src/publish-s3.sh b/Tool/src/publish-s3.sh index 79e88aa..c589b89 100644 --- a/Tool/src/publish-s3.sh +++ b/Tool/src/publish-s3.sh @@ -1,17 +1,3 @@ -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the "license" file accompanying this file. This file is distributed -# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -# express or implied. See the License for the specific language governing -# permissions and limitations under the License. - - #! /bin/bash set -e @@ -28,7 +14,7 @@ set -e # check environment vars if [ -z ${s3_bucket_name} ]; then - s3_bucket_name="aws-xray-daemon-assets.staging" + s3_bucket_name="aws-xray-assets.staging" echo "use default s3_bucket_name: ${s3_bucket_name}" else echo "load s3_bucket_name from env var: ${s3_bucket_name}" @@ -85,6 +71,7 @@ declare -a required_files=( "upload_ready_binaries/${package_name}-windows-service-${major_version}.zip.sig" ) +# check required files are available for i in "${required_files[@]}" do if [ ! -f "${i}" ]; then @@ -93,7 +80,7 @@ do fi done -# upload packages to s3 +# upload daemon binaries to s3 for i in "${required_files[@]}" do aws s3api put-object --bucket "${s3_bucket_name}" --key "${release_version}/${i}" --body "${i}" From af158a9be4c6e167f3392817978c164da282ce8c Mon Sep 17 00:00:00 2001 From: bhautikpip Date: Tue, 4 May 2021 00:55:42 -0700 Subject: [PATCH 10/10] added end of line --- Tool/src/publish-s3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tool/src/publish-s3.sh b/Tool/src/publish-s3.sh index c589b89..d2901db 100644 --- a/Tool/src/publish-s3.sh +++ b/Tool/src/publish-s3.sh @@ -84,4 +84,4 @@ done for i in "${required_files[@]}" do aws s3api put-object --bucket "${s3_bucket_name}" --key "${release_version}/${i}" --body "${i}" -done \ No newline at end of file +done