Skip to content

Commit 9b0c70a

Browse files
authored
github-actions: enable provenance for the jar files (#3594)
1 parent 08188e6 commit 9b0c70a

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

.buildkite/release.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/apm-agent-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
912
artifact_paths:
1013
- "release.txt"
1114
- "**/target/*"
15+
- "${TARBALL_FILE}"
1216

1317
notify:
1418
- 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/apm-agent-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ fi
3232

3333
echo "--- Deploy the release :package: [./mvnw $GOAL)] $DRY_RUN_MSG"
3434
./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt
35+
36+
echo "--- Archive the target folder with jar files"
37+
echo 'gather artifacts'
38+
.ci/published-artifacts-list.sh | tee artifacts.list
39+
echo 'create tarbal'
40+
tar -cvf "${TARBALL_FILE:-artifacts.tar}" -T artifacts.list

.ci/scripts/published-artifacts-list.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env bash
1+
#!/usr/bin/env bash
22

33
targets="$(find . -type d -name 'target'|grep -v apm-agent-plugins|grep -v integration-tests|sort)"
44

.ci/snapshot.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ fi
3434

3535
echo "--- Deploy the snapshot :package: [./mvnw $GOAL)] $DRY_RUN_MSG"
3636
./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt
37+
38+
echo "--- Archive the target folder with jar files"
39+
echo 'gather artifacts'
40+
.ci/published-artifacts-list.sh | tee artifacts.list
41+
echo 'create tarbal'
42+
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
@@ -74,6 +74,11 @@ jobs:
7474
runs-on: ubuntu-latest
7575
needs:
7676
- validate-tag
77+
permissions:
78+
contents: write
79+
id-token: write
80+
env:
81+
TARBALL_FILE: artifacts.tar
7782
steps:
7883
- id: buildkite
7984
continue-on-error: true
@@ -86,8 +91,23 @@ jobs:
8691
pipeline: apm-agent-java-release
8792
waitFor: true
8893
printBuildLogs: false
94+
artifactName: releases
95+
artifactPath: ${{ env.TARBALL_FILE }}
8996
buildEnvVars: |
9097
dry_run=${{ inputs.dry_run || 'false' }}
98+
TARBALL_FILE=${{ env.TARBALL_FILE }}
99+
100+
- uses: actions/download-artifact@v3
101+
with:
102+
name: releases
103+
104+
- name: untar the buildkite tarball
105+
run: tar xvf ${{ env.TARBALL_FILE }}
106+
107+
- name: generate build provenance
108+
uses: github-early-access/generate-build-provenance@main
109+
with:
110+
subject-path: "${{ github.workspace }}/**/target/*.jar"
91111

92112
await-maven-central-artifact:
93113
name: "Wait for artifacts to be available on maven central"

.github/workflows/snapshot.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
runs-on: ubuntu-latest
3939
needs:
4040
- validate
41+
permissions:
42+
contents: write
43+
id-token: write
44+
env:
45+
TARBALL_FILE: artifacts.tar
4146
if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }}
4247
steps:
4348
- id: buildkite
@@ -48,10 +53,26 @@ jobs:
4853
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
4954
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
5055
pipeline: apm-agent-java-snapshot
51-
waitFor: false
56+
pipelineBranch: ${{ github.ref_name }}
57+
artifactName: snapshots
58+
artifactPath: ${{ env.TARBALL_FILE }}
59+
waitFor: true
5260
printBuildLogs: false
5361
buildEnvVars: |
5462
dry_run=${{ inputs.dry_run || 'false' }}
63+
TARBALL_FILE=${{ env.TARBALL_FILE }}
64+
65+
- uses: actions/download-artifact@v3
66+
with:
67+
name: snapshots
68+
69+
- name: untar the buildkite tarball
70+
run: tar xvf ${{ env.TARBALL_FILE }}
71+
72+
- name: generate build provenance
73+
uses: github-early-access/generate-build-provenance@main
74+
with:
75+
subject-path: "${{ github.workspace }}/**/target/*.jar"
5576

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

0 commit comments

Comments
 (0)