1818 enabled : ${{ startsWith(github.ref, 'refs/tags') }}
1919
2020 packages :
21- uses : ./.github/workflows/packages.yml
21+ permissions :
22+ id-token : write
23+ contents : write
24+ runs-on : ubuntu-latest
25+ steps :
26+ - uses : actions/checkout@v4
27+ - uses : ./.github/actions/packages
2228
2329 publish-pypi :
2430 needs :
4652 repository-url : https://test.pypi.org/legacy/
4753
4854 build-distribution :
49- uses : ./.github/workflows/build-distribution.yml
55+ permissions :
56+ id-token : write
57+ contents : write
58+ runs-on : ubuntu-latest
59+ steps :
60+ - uses : actions/checkout@v4
61+ - uses : ./.github/actions/build-distribution
62+ - name : generate build provenance
63+ uses : github-early-access/generate-build-provenance@main
64+ with :
65+ subject-path : " ${{ github.workspace }}/build/dist/elastic-apm-python-lambda-layer.zip"
5066
5167 publish-lambda-layers :
5268 needs :
6379 secrets : |
6480 secret/observability-team/ci/service-account/apm-agent-python access_key_id | AWS_ACCESS_KEY_ID ;
6581 secret/observability-team/ci/service-account/apm-agent-python secret_access_key | AWS_SECRET_ACCESS_KEY
66- - uses : actions/download-artifact@v3
82+ - uses : actions/download-artifact@v4
6783 with :
6884 name : build-distribution
6985 path : ./build
86102 needs :
87103 - build-distribution
88104 runs-on : ubuntu-latest
105+ permissions :
106+ id-token : write
107+ contents : write
89108 env :
90109 DOCKER_IMAGE_NAME : docker.elastic.co/observability/apm-agent-python
91110 steps :
97116 url : ${{ secrets.VAULT_ADDR }}
98117 roleId : ${{ secrets.VAULT_ROLE_ID }}
99118 secretId : ${{ secrets.VAULT_SECRET_ID }}
100- - uses : actions/download-artifact@v3
119+ - uses : actions/download-artifact@v4
101120 with :
102121 name : build-distribution
103122 path : ./build
@@ -107,25 +126,30 @@ jobs:
107126 if [ "${{ startsWith(github.ref, 'refs/tags') }}" == "false" ] ; then
108127 # for testing purposes
109128 echo "tag=test" >> "${GITHUB_OUTPUT}"
129+ echo "latest=test-latest" >> "${GITHUB_OUTPUT}"
110130 else
111131 # version without v prefix (e.g. 1.2.3)
112132 echo "tag=${GITHUB_REF_NAME/v/}" >> "${GITHUB_OUTPUT}"
133+ echo "latest=latest" >> "${GITHUB_OUTPUT}"
113134 fi
114- - name : Docker build
115- run : >-
116- docker build
117- -t ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
118- --build-arg AGENT_DIR=./build/dist/package/python
119- .
120- - name : Docker retag
121- run : >-
122- docker tag
123- ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
124- ${{ env.DOCKER_IMAGE_NAME }}:latest
125- - name : Docker push
126- if : startsWith(github.ref, 'refs/tags')
127- run : |-
128- docker push --all-tags ${{ env.DOCKER_IMAGE_NAME }}
135+ - name : Build and push image
136+ id : push
137+ 138+ with :
139+ context : .
140+ push : true
141+ tags : |
142+ ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
143+ ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.latest }}
144+ build-args : |
145+ AGENT_DIR=./build/dist/package/python
146+
147+ - name : Attest image
148+ uses : github-early-access/generate-build-provenance@main
149+ with :
150+ subject-name : " ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}"
151+ subject-digest : ${{ steps.push.outputs.digest }}
152+ push-to-registry : false
129153
130154 github-draft :
131155 permissions :
0 commit comments