3434 # PUBLIC_REGISTRY: ''
3535 # Assume that base image has been synced to local registry
3636 PUBLIC_REGISTRY : ' ghcr.io/'
37+ AWS_OTEL_COLLECTOR_REPO_ORG : ${{ github.repository_owner }}
38+ POSTGRES_REPO_ORG : ${{ github.repository_owner }}
39+ RABBITMQ_REPO_ORG : ${{ github.repository_owner }}
3740 # Git "main" branch. This might be "master" for old repos
3841 MAIN_BRANCH : main
3942 # GitHub Environment secrets and variables
4649 # vars.AWS_REGION
4750 # AWS role allowing GitHub Actions to access resources and deploy
4851 # secrets.AWS_ROLE_TO_ASSUME: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/foo-${{ environment }}-github-action-role
49- # GitHub Advanced Security, free for open source, otherwise a paid feature
50- # https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security
51- # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning
52- # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
5352 # Docker
5453 DOCKER_BUILDKIT : ' 1'
5554 DOCKER_FILE : deploy/aws-otel-collector.Dockerfile
5655jobs :
57- build-otel :
56+ build-prod :
5857 name : Build otel image
5958 permissions :
6059 id-token : write
6160 contents : read
6261 packages : write
6362 runs-on : ubuntu-latest
6463 environment : ${{ (github.ref_name == 'main' && 'staging') || (github.ref_name == 'qa' && 'qa') || (github.ref_name == 'prod' && 'production') }}
65- env :
66- AWS_ENABLED : ' 1'
67- AWS_REGION : " ${{ vars.AWS_REGION }}"
6864 steps :
65+ - name : Debug environment
66+ run : |
67+ echo "github.event_name: ${{ github.event_name }}"
68+ echo "ref: ${{ github.ref }}"
69+ echo "ref_name: ${{ github.ref_name }}"
70+ echo "environment: ${{ needs.config.outputs.environment }}"
71+
72+ - name : Log in to GHCR
73+ uses : docker/login-action@v4
74+ with :
75+ registry : ghcr.io
76+ username : ${{ github.actor }}
77+ password : ${{ secrets.GITHUB_TOKEN }}
78+
6979 - name : Log in to Docker Hub
7080 uses : docker/login-action@v4
7181 with :
8393 if : env.AWS_ENABLED == '1'
8494 id : ecr-login
8595 uses : aws-actions/amazon-ecr-login@v2
96+ # with:
97+ # registries: ${{ (needs.config.outputs.environment == 'qa') && env.AWS_ACCOUNT_STAGING || vars.AWS_ACCOUNT }}
8698
8799 - name : Set vars
88100 if : env.AWS_ENABLED == '1'
@@ -102,10 +114,6 @@ jobs:
102114 echo "run_id=${GITHUB_RUN_ID}" >> "$GITHUB_OUTPUT"
103115 echo "run_num=${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
104116
105- - name : Get branch name
106- shell : bash
107- run : echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV"
108-
109117 - name : Set up Docker buildx
110118 id : buildx
111119 uses : docker/setup-buildx-action@v3
@@ -115,12 +123,12 @@ jobs:
115123 - name : Build image and push
116124 if : env.AWS_ENABLED == '1'
117125 uses : docker/build-push-action@v6
118- env :
119- # REGISTRY: "${{ env.ECR_REGISTRY }}/"
120- # https://hub.docker.com/r/amazon/aws-otel-collector/tags
121- BASE_IMAGE_TAG : ' v0.47.0'
122126 with :
123127 file : ${{ env.DOCKER_FILE }}
128+ # https://hub.docker.com/r/amazon/aws-otel-collector/tags
129+ build-args : |
130+ AWS_REGION=${{ vars.AWS_REGION }}
131+ BASE_IMAGE_TAG='v0.47.0'
124132 context : .
125133 builder : ${{ steps.buildx.outputs.name }}
126134 push : true
0 commit comments