@@ -5,13 +5,9 @@ name: OpenTelemetry
55
66on :
77 push :
8- # branches:
9- # - main
10- # - qa
11- # tags: [prod]
128 paths :
139 - .github/workflows/otel.yml
14- - ' deploy/aws-otel-collector.Dockerfile'
10+ - deploy/aws-otel-collector.Dockerfile
1511 - ' otel/*'
1612 # pull_request:
1713 # # branches: [main]
2420 IMAGE_NAME : aws-otel-collector
2521 # Name of org in GHCR Docker repository (must be lowercase)
2622 IMAGE_OWNER : ${{ github.repository_owner }}
27- # IMAGE_OWNER: foo
28- # ECR Docker repo org name (may be blank, otherwise must have trailing slash)
23+ # IMAGE_OWNER: cogini
24+ # AWS ECR Docker repo " org" name (may be blank, otherwise must have trailing slash)
2925 ECR_IMAGE_OWNER : cogini/
30- # Tag for release images
26+ # ECR_IMAGE_OWNER: ''
27+ # Tag for release images, used to find the latest deployed image.
3128 # IMAGE_TAG: ${{ (github.ref == 'refs/heads/main' && 'staging') || (github.ref == 'refs/heads/qa' && 'qa') }}
3229 IMAGE_TAG : latest
33- # Registry for test images
30+ IMAGE_VER : ${{ github.sha }}
31+ # Registry for internal images
3432 REGISTRY : ghcr.io/
35- # Registry for public images, default is docker.io
36- PUBLIC_REGISTRY : ' '
33+ # Registry for public images, default (blank) is docker.io
34+ # PUBLIC_REGISTRY: ''
35+ # Assume that base image has been synced to local registry
36+ PUBLIC_REGISTRY : ' ghcr.io/'
37+ # Git "main" branch. This might be "master" for old repos
3738 MAIN_BRANCH : main
38- # Give GitHub Actions access to AWS
39- AWS_ENABLED : 1
40- # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
41- # AWS_ROLE_TO_ASSUME: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/cogini-foo-dev-app-github-action
42- # AWS_REGION: us-east-1
39+ # GitHub Environment secrets and variables
40+ # Docker Hub credentials to pull base images without rate limits
41+ # secrets.DOCKERHUB_USERNAME
42+ # secrets.DOCKERHUB_TOKEN
43+ # AWS Account
44+ # secrets.AWS_ACCOUNT_ID
45+ # AWS default region
46+ # vars.AWS_REGION
47+ # AWS role allowing GitHub Actions to access resources and deploy
48+ # 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
4353 # Docker
4454 DOCKER_BUILDKIT : ' 1'
4555 DOCKER_FILE : deploy/aws-otel-collector.Dockerfile
@@ -52,34 +62,36 @@ jobs:
5262 packages : write
5363 runs-on : ubuntu-latest
5464 environment : ${{ (github.ref_name == 'main' && 'staging') || (github.ref_name == 'qa' && 'qa') || (github.ref_name == 'prod' && 'production') }}
65+ env :
66+ AWS_ENABLED : ' 1'
5567 steps :
5668 - name : Log in to Docker Hub
57- uses : docker/login-action@v3
69+ uses : docker/login-action@v4
5870 with :
5971 username : ${{ secrets.DOCKERHUB_USERNAME }}
6072 password : ${{ secrets.DOCKERHUB_TOKEN }}
6173
6274 - name : Configure AWS credentials
63- if : ${{ env.AWS_ENABLED == 1 }}
64- uses : aws-actions/configure-aws-credentials@v5
75+ if : env.AWS_ENABLED == '1'
76+ uses : aws-actions/configure-aws-credentials@v6
6577 with :
6678 role-to-assume : ${{ secrets.AWS_ROLE_TO_ASSUME }}
6779 aws-region : ${{ vars.AWS_REGION }}
6880
6981 - name : Log in to Amazon ECR
70- if : ${{ env.AWS_ENABLED == 1 }}
82+ if : env.AWS_ENABLED == '1'
7183 id : ecr-login
7284 uses : aws-actions/amazon-ecr-login@v2
7385
7486 - name : Set vars
75- if : ${{ env.AWS_ENABLED == 1 }}
87+ if : env.AWS_ENABLED == '1'
7688 run : echo "ECR_REGISTRY=${{ steps.ecr-login.outputs.registry }}" >> "$GITHUB_ENV"
7789
7890 - name : Set vars
7991 run : echo "NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
8092
8193 - name : Check out source
82- uses : actions/checkout@v4
94+ uses : actions/checkout@v6
8395
8496 - name : Set variables
8597 id : vars
@@ -100,11 +112,13 @@ jobs:
100112 driver-opts : network=host
101113
102114 - name : Build image and push
103- if : ${{ env.AWS_ENABLED == 1 }}
115+ if : env.AWS_ENABLED == '1'
104116 uses : docker/build-push-action@v6
105117 env :
106- REGISTRY : " ${{ env.ECR_REGISTRY }}/"
118+ # REGISTRY: "${{ env.ECR_REGISTRY }}/"
107119 AWS_REGION : ${{ vars.AWS_REGION }}
120+ # https://hub.docker.com/r/amazon/aws-otel-collector/tags
121+ BASE_IMAGE_TAG : ' v0.47.0
108122 with:
109123 file: ${{ env.DOCKER_FILE }}
110124 context: .
@@ -121,6 +135,9 @@ jobs:
121135 org.opencontainers.image.created=${{ env.NOW }}
122136 org.opencontainers.image.revision=${{ github.sha }}
123137 org.opencontainers.image.version=${{ github.run_number }}
138+ app.kubernetes.io/name=${{ env.IMAGE_NAME }}
139+ app.kubernetes.io/part-of=${{ github.repository }}
140+ app.kubernetes.io/version=${{ github.run_number }}
124141 tags : |
125142 ${{ env.ECR_REGISTRY }}/${{ env.ECR_IMAGE_OWNER }}${{ env.IMAGE_NAME }}:${{ github.sha }}
126143 ${{ env.ECR_REGISTRY }}/${{ env.ECR_IMAGE_OWNER }}${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
0 commit comments