Skip to content

Commit 4b8cfca

Browse files
committed
get aws region from input
1 parent 1fb1d26 commit 4b8cfca

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

.github/workflows/build-collector.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ on:
1111
- amd64
1212
- arm64
1313
default: all
14+
aws_region:
15+
type: choice
16+
description: AWS Region
17+
options:
18+
- all
19+
- ap-northeast-1
20+
- ap-northeast-2
21+
- ap-south-1
22+
- ap-southeast-1
23+
- ap-southeast-2
24+
- ca-central-1
25+
- eu-central-1
26+
- eu-north-1
27+
- eu-west-1
28+
- eu-west-2
29+
- eu-west-3
30+
- sa-east-1
31+
- us-east-1
32+
- us-east-2
33+
- us-west-1
34+
- us-west-2
35+
default: all
1436

1537
jobs:
1638
include-jobs:
@@ -21,18 +43,24 @@ jobs:
2143
- id: include-jobs
2244
name: Include jobs
2345
run: |
24-
includeJobs='
25-
${{ github.event.inputs.architecture == 'all' && '[{"architecture": "amd64"}, {"architecture": "arm64"}]' || '' }}
26-
${{ github.event.inputs.architecture == 'amd64' && '[{"architecture": "amd64"}]' || '' }}
27-
${{ github.event.inputs.architecture == 'arm64' && '[{"architecture": "arm64"}]' || '' }}
28-
'
29-
echo "jobs=${includeJobs}" | tr -d '[:space:]' >> $GITHUB_OUTPUT
46+
architectures=''
47+
if [ ${{ github.event.inputs.architecture }} == 'all' ]; then
48+
architectures='["amd64", "arm64"]'
49+
else
50+
architectures='["${{ github.event.inputs.architecture }}"]'
51+
fi
52+
aws_regions=''
53+
if [ ${{ github.event.inputs.aws_region }} == 'all' ]; then
54+
aws_regions='["ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"]'
55+
else
56+
aws_regions='["${{ github.event.inputs.aws_region }}"]'
57+
fi
58+
echo "jobs={"architecture": ${architectures}, "aws_region": ${aws_regions}}" | tr -d '[:space:]' >> $GITHUB_OUTPUT
3059
build:
3160
needs: include-jobs
3261
runs-on: ubuntu-latest
3362
strategy:
34-
matrix:
35-
include: ${{ fromJSON(needs.include-jobs.outputs.jobs) }}
63+
matrix: ${{ fromJSON(needs.include-jobs.outputs.jobs) }}
3664
outputs:
3765
COLLECTOR_VERSION: ${{ steps.save-collector-version.outputs.COLLECTOR_VERSION }}
3866
steps:
@@ -47,5 +75,5 @@ jobs:
4775
- name: Upload Collector Artifact
4876
uses: actions/upload-artifact@v4
4977
with:
50-
name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
78+
name: opentelemetry-collector-layer-${{ matrix.architecture }}-${{ matrix.aws_region }}.zip
5179
path: ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip

0 commit comments

Comments
 (0)