Skip to content

Commit ef06e9e

Browse files
committed
Bump python-gardenlinux-lib to 0.8.7 and improve GitHub workflow
This commit fixes an issue with missing "needs" declaration for the GitHub workflow `upload_oci.yml` This reverts commit fdbe5d0.
1 parent fbced82 commit ef06e9e

1 file changed

Lines changed: 36 additions & 42 deletions

File tree

.github/workflows/upload_oci.yml

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,34 @@ jobs:
1111
uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@bced61a3657ac2335f3baf1cae37e0f859313ee1
1212
with:
1313
flags: '--exclude "bare-*" --no-arch --json-by-arch --build --test'
14-
upload_gl_artifacts_to_oci:
14+
upload_gl_artifacts:
1515
name: upload to OCI
1616
needs: [ generate_matrix_publish ]
1717
runs-on: ubuntu-latest
1818
defaults:
1919
run:
2020
shell: bash
21+
env:
22+
CNAME: ''
2123
permissions:
2224
id-token: write
2325
packages: write
2426
strategy:
25-
max-parallel: 5
2627
fail-fast: false
2728
matrix: ${{ fromJson(needs.generate_matrix_publish.outputs.matrix) }}
29+
max-parallel: 8
2830
steps:
2931
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
3032
with:
31-
submodules: 'true'
33+
submodules: true
3234
- uses: oras-project/setup-oras@v1
3335
- run: oras version
3436
- name: Install python-gardenlinux-lib
35-
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@a7545af15d3a1fa96675b24807eace643483da96 # pin@0.8.0
37+
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@8901e3679feb077060f4b33769efe071133f3199 # pin@0.8.7
3638
- name: Install cosign
3739
uses: sigstore/cosign-installer@v3.9.1
3840
with:
3941
cosign-release: 'v2.4.1'
40-
# bin/garden-version reads and writes from and to ./VERSION which is read by ./build --resolve-cname
4142
- name: Set flavor version reference
4243
run: |
4344
git rev-parse HEAD | cut -c1-8 | tee COMMIT
@@ -53,77 +54,70 @@ jobs:
5354
GL_CLI_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5455
GL_CLI_REGISTRY_USERNAME: ${{ github.repository_owner }}
5556
run: |
56-
mkdir "$CNAME" manifests
57+
mkdir "$CNAME"
5758
5859
tar -C "$CNAME" -xzf "$CNAME.tar.gz"
5960
6061
gl-oci push-manifest \
61-
--dir ${CNAME} \
62+
--dir "${CNAME}" \
6263
--container "ghcr.io/${{ github.repository }}" \
6364
--arch ${{ matrix.arch }} \
6465
--version ${{ inputs.version }} \
65-
--cname ${CNAME} \
66-
--cosign_file digest \
67-
--manifest_file "manifests/oci_manifest_entry_${CNAME}.json"
66+
--cname "${CNAME}" \
67+
--cosign_file digest.txt \
68+
--manifest_file "oci_manifest_entry_${CNAME}.json"
6869
- name: Add additional semver tag
6970
run: |
7071
echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io
7172
oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.version }}.0-${CNAME//_/-}-${{ matrix.arch }}
72-
- name: Upload oci manifest artifact
73-
uses: actions/upload-artifact@v4
73+
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3
7474
with:
75-
name: oci_manifest_entry_${{ env.CNAME }}.json
76-
path: manifests/
75+
path: oci_manifest_entry_${{ env.CNAME }}.json
76+
key: oci-manifest-${{ matrix.flavor }}-${{ matrix.arch }}-${{ github.run_id }}
7777
- name: Output digest to be signed
7878
run: |
79-
cat digest
79+
cat digest.txt
8080
8181
upload_manifests_entries:
82-
needs: "upload_gl_artifacts_to_oci"
82+
needs: [ generate_matrix_publish, upload_gl_artifacts ]
8383
name: upload manifest entries into OCI index
8484
runs-on: ubuntu-latest
8585
defaults:
8686
run:
8787
shell: bash
88+
env:
89+
CNAME: ''
8890
permissions:
8991
id-token: write
9092
packages: write
9193
actions: write
94+
strategy:
95+
fail-fast: false
96+
matrix: ${{ fromJson(needs.generate_matrix_publish.outputs.matrix) }}
97+
max-parallel: 1
9298
steps:
9399
- name: Install python-gardenlinux-lib
94-
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@a7545af15d3a1fa96675b24807eace643483da96 # pin@0.8.0
95-
- name: Download OCI manifest artifacts
96-
uses: actions/download-artifact@v4
100+
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@8901e3679feb077060f4b33769efe071133f3199 # pin@0.8.7
101+
- name: Set flavor version reference
102+
run: |
103+
echo "${{ github.sha }}" | cut -c1-8 | tee COMMIT
104+
echo "${{ inputs.version }}" | tee VERSION
105+
- name: Set CNAME
106+
run: |
107+
echo "CNAME=$(gl-features-parse --cname ${{ matrix.flavor }}-${{ matrix.arch }} cname)" | tee -a "$GITHUB_ENV"
108+
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3
97109
with:
98-
path: manifests
99-
pattern: oci_manifest_entry_*
100-
merge-multiple: true
110+
path: oci_manifest_entry_${{ env.CNAME }}.json
111+
key: oci-manifest-${{ matrix.flavor }}-${{ matrix.arch }}-${{ github.run_id }}
101112
- name: Update index using glcli tool
102113
env:
103114
GL_CLI_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104115
GL_CLI_REGISTRY_USERNAME: ${{ github.repository_owner }}
105116
run: |
117+
mkdir manifests
118+
mv oci_manifest_entry_${CNAME}.json manifests/
119+
106120
gl-oci update-index \
107121
--container "ghcr.io/${{ github.repository }}" \
108122
--version ${{ inputs.version }} \
109123
--manifest_folder manifests
110-
- name: Delete temporary OCI manifest entry files
111-
uses: actions/github-script@v7
112-
with:
113-
script: |
114-
const artifacts = await github.rest.actions.listArtifactsForRepo({
115-
owner: context.repo.owner,
116-
repo: context.repo.repo,
117-
per_page: 100
118-
});
119-
for (const artifact of artifacts.data.artifacts) {
120-
if (artifact.name.startsWith('oci_manifest_entry_')) {
121-
console.log(`Deleting artifact: ${artifact.name}`);
122-
await github.rest.actions.deleteArtifact({
123-
owner: context.repo.owner,
124-
repo: context.repo.repo,
125-
artifact_id: artifact.id
126-
});
127-
console.log(`Successfully deleted artifact: ${artifact.name}`);
128-
}
129-
}

0 commit comments

Comments
 (0)