Skip to content

Commit c084216

Browse files
authored
github-actions: enable provenance for the jar files (#250)
* support provenance * use script
1 parent 7bbcb40 commit c084216

File tree

6 files changed

+59
-2
lines changed

6 files changed

+59
-2
lines changed

.buildkite/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ agents:
22
provider: "gcp"
33
image: "family/ecs-logging-java-ubuntu-2204"
44

5+
env:
6+
TARBALL_FILE: ${TARBALL_FILE:-artifacts.tar}
7+
58
steps:
69
- label: "Run the release"
710
key: "release"
811
commands: .ci/release.sh
9-
artifact_paths: "release.txt"
12+
artifact_paths:
13+
- "release.txt"
14+
- "${TARBALL_FILE}"
1015

1116
notify:
1217
- slack: "#apm-agent-java"

.buildkite/snapshot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ agents:
22
provider: "gcp"
33
image: "family/ecs-logging-java-ubuntu-2204"
44

5+
env:
6+
TARBALL_FILE: ${TARBALL_FILE:-artifacts.tar}
7+
58
steps:
69
- label: "Run the snapshot"
710
key: "release"
811
commands: .ci/snapshot.sh
912
artifact_paths:
1013
- "snapshot.txt"
1114
- "**/target/*"
15+
- "${TARBALL_FILE}"
1216

1317
notify:
1418
- slack: "#apm-agent-java"

.ci/release.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ fi
3838

3939
echo "--- Release the binaries to Maven Central :maven: [./mvnw ${GOAL})] ${DRY_RUN_MSG}"
4040
./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt
41+
42+
echo "--- Archive the target folder with jar files"
43+
.ci/published-artifacts-list.sh | tee artifacts.list
44+
tar -cvf "${TARBALL_FILE:-artifacts.tar}" -T artifacts.list

.ci/snapshot.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ fi
3535

3636
echo "--- Deploy the snapshot :package: [./mvnw ${GOAL})] ${DRY_RUN_MSG}"
3737
./mvnw -V -s .ci/settings.xml -Pgpg clean ${GOAL} -DskipTests --batch-mode | tee snapshot.txt
38+
39+
echo "--- Archive the target folder with jar files"
40+
.ci/published-artifacts-list.sh | tee artifacts.list
41+
tar -cvf "${TARBALL_FILE:-artifacts.tar}" -T artifacts.list

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ jobs:
6666
if: ${{ ! inputs.skip_maven_deploy }}
6767
needs:
6868
- validate-tag
69+
permissions:
70+
contents: write
71+
id-token: write
72+
env:
73+
TARBALL_FILE: artifacts.tar
6974
steps:
7075
- id: buildkite
7176
name: Run Release
@@ -75,11 +80,26 @@ jobs:
7580
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
7681
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
7782
pipeline: ecs-logging-java-release
83+
artifactName: releases
84+
artifactPath: ${{ env.TARBALL_FILE }}
7885
waitFor: true
7986
printBuildLogs: false
8087
buildEnvVars: |
8188
ref=${{ inputs.ref }}
8289
dry_run=${{ inputs.dry_run || 'false' }}
90+
TARBALL_FILE=${{ env.TARBALL_FILE }}
91+
92+
- uses: actions/download-artifact@v3
93+
with:
94+
name: releases
95+
96+
- name: untar the buildkite tarball
97+
run: tar xvf ${{ env.TARBALL_FILE }}
98+
99+
- name: generate build provenance
100+
uses: github-early-access/generate-build-provenance@main
101+
with:
102+
subject-path: "${{ github.workspace }}/**/target/*.jar"
83103

84104
- if: ${{ success() }}
85105
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current

.github/workflows/snapshot.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ jobs:
3737
runs-on: ubuntu-latest
3838
needs: validate
3939
if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }}
40+
permissions:
41+
contents: write
42+
id-token: write
43+
env:
44+
TARBALL_FILE: artifacts.tar
4045
steps:
4146
- id: buildkite
4247
name: Run Deploy
@@ -46,10 +51,25 @@ jobs:
4651
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
4752
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
4853
pipeline: ecs-logging-java-snapshot
49-
waitFor: false
54+
artifactName: snapshots
55+
artifactPath: ${{ env.TARBALL_FILE }}
56+
waitFor: true
5057
printBuildLogs: false
5158
buildEnvVars: |
5259
dry_run=${{ inputs.dry_run || 'false' }}
60+
TARBALL_FILE=${{ env.TARBALL_FILE }}
61+
62+
- uses: actions/download-artifact@v3
63+
with:
64+
name: snapshots
65+
66+
- name: untar the buildkite tarball
67+
run: tar xvf ${{ env.TARBALL_FILE }}
68+
69+
- name: generate build provenance
70+
uses: github-early-access/generate-build-provenance@main
71+
with:
72+
subject-path: "${{ github.workspace }}/**/target/*.jar"
5373

5474
- if: ${{ failure() }}
5575
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current

0 commit comments

Comments
 (0)