Skip to content

Commit

Permalink
Refactor: build linux artifacts only for PR (#4286)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Resolves #4172

## Short description of the changes
- scripts/build-upload-docker-images.sh: Set platforms variable
dynamically based on ~~env `PLATFORMS`~~ the first argument
- .github/workflows/ci-docker-build.yml: Add a new job for PR only and
pass `pr-only` as the first argument

Signed-off-by: Eileen <eileenylj@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
Eileen-Yu and yurishkuro committed Mar 9, 2023
1 parent c33ae5c commit cc264f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ jobs:

- uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18

- name: Build only linux/amd64 docker image for Pull Request
if: github.ref_name != 'main'
run: bash scripts/build-upload-docker-images.sh pr-only

- name: Build and upload all docker images
if: github.ref_name == 'main'
run: bash scripts/build-upload-docker-images.sh
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
18 changes: 12 additions & 6 deletions scripts/build-upload-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

set -euxf -o pipefail

mode=${1-main}

make create-baseimg-debugimg

# build multi-arch binaries
make build-binaries-linux
make build-binaries-s390x
make build-binaries-ppc64le
make build-binaries-arm64

# build multi-arch docker images
platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
if [ "$mode" = "pr-only" ]; then
# build artifacts for linux/amd64 only for pull requests
platforms="linux/amd64"
else
platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
# build multi-arch binaries
make build-binaries-s390x
make build-binaries-ppc64le
make build-binaries-arm64
fi

# build/upload raw and debug images of Jaeger backend components
for component in agent collector query ingester remote-storage
Expand Down

0 comments on commit cc264f6

Please sign in to comment.