Skip to content

Commit fdbe5d0

Browse files
authored
Revert "Bump python-gardenlinux-lib to 0.8.7 and improve GitHub workflow"
1 parent a3976db commit fdbe5d0

1 file changed

Lines changed: 40 additions & 34 deletions

File tree

.github/workflows/upload_oci.yml

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,26 @@ jobs:
1818
defaults:
1919
run:
2020
shell: bash
21-
env:
22-
CNAME: ''
2321
permissions:
2422
id-token: write
2523
packages: write
2624
strategy:
25+
max-parallel: 5
2726
fail-fast: false
2827
matrix: ${{ fromJson(needs.generate_matrix_publish.outputs.matrix) }}
29-
max-parallel: 8
3028
steps:
3129
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
3230
with:
33-
submodules: true
31+
submodules: 'true'
3432
- uses: oras-project/setup-oras@v1
3533
- run: oras version
3634
- name: Install python-gardenlinux-lib
37-
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@8901e3679feb077060f4b33769efe071133f3199 # pin@0.8.7
35+
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@a7545af15d3a1fa96675b24807eace643483da96 # pin@0.8.0
3836
- name: Install cosign
3937
uses: sigstore/cosign-installer@v3.9.1
4038
with:
4139
cosign-release: 'v2.4.1'
40+
# bin/garden-version reads and writes from and to ./VERSION which is read by ./build --resolve-cname
4241
- name: Set flavor version reference
4342
run: |
4443
git rev-parse HEAD | cut -c1-8 | tee COMMIT
@@ -54,29 +53,30 @@ jobs:
5453
GL_CLI_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5554
GL_CLI_REGISTRY_USERNAME: ${{ github.repository_owner }}
5655
run: |
57-
mkdir "$CNAME"
56+
mkdir "$CNAME" manifests
5857
5958
tar -C "$CNAME" -xzf "$CNAME.tar.gz"
6059
6160
gl-oci push-manifest \
62-
--dir "${CNAME}" \
61+
--dir ${CNAME} \
6362
--container "ghcr.io/${{ github.repository }}" \
6463
--arch ${{ matrix.arch }} \
6564
--version ${{ inputs.version }} \
66-
--cname "${CNAME}" \
67-
--cosign_file digest.txt \
68-
--manifest_file "oci_manifest_entry_${CNAME}.json"
65+
--cname ${CNAME} \
66+
--cosign_file digest \
67+
--manifest_file "manifests/oci_manifest_entry_${CNAME}.json"
6968
- name: Add additional semver tag
7069
run: |
7170
echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io
7271
oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.version }}.0-${CNAME//_/-}-${{ matrix.arch }}
73-
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3
72+
- name: Upload oci manifest artifact
73+
uses: actions/upload-artifact@v4
7474
with:
75-
path: oci_manifest_entry_${{ env.CNAME }}.json
76-
key: oci-manifest-${{ matrix.flavor }}-${{ matrix.arch }}-${{ github.run_id }}
75+
name: oci_manifest_entry_${{ env.CNAME }}.json
76+
path: manifests/
7777
- name: Output digest to be signed
7878
run: |
79-
cat digest.txt
79+
cat digest
8080
8181
upload_manifests_entries:
8282
needs: "upload_gl_artifacts_to_oci"
@@ -85,39 +85,45 @@ jobs:
8585
defaults:
8686
run:
8787
shell: bash
88-
env:
89-
CNAME: ''
9088
permissions:
9189
id-token: write
9290
packages: write
9391
actions: write
94-
strategy:
95-
fail-fast: false
96-
matrix: ${{ fromJson(needs.generate_matrix_publish.outputs.matrix) }}
97-
max-parallel: 1
9892
steps:
9993
- name: Install python-gardenlinux-lib
100-
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@8901e3679feb077060f4b33769efe071133f3199 # pin@0.8.7
101-
- name: Set flavor version reference
102-
run: |
103-
git rev-parse HEAD | 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
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
10997
with:
110-
path: oci_manifest_entry_${{ env.CNAME }}.json
111-
key: oci-manifest-${{ matrix.flavor }}-${{ matrix.arch }}-${{ github.run_id }}
98+
path: manifests
99+
pattern: oci_manifest_entry_*
100+
merge-multiple: true
112101
- name: Update index using glcli tool
113102
env:
114103
GL_CLI_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115104
GL_CLI_REGISTRY_USERNAME: ${{ github.repository_owner }}
116105
run: |
117-
mkdir manifests
118-
mv oci_manifest_entry_${CNAME}.json manifests/
119-
120106
gl-oci update-index \
121107
--container "ghcr.io/${{ github.repository }}" \
122108
--version ${{ inputs.version }} \
123109
--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)