Skip to content

Commit bdbd6a9

Browse files
authored
fix: v0.8.x - Maven SNAPSHOT artifact version without snapshotVersion (#265)
Signed-off-by: Rashed Kamal <[email protected]>
1 parent 93d3ee5 commit bdbd6a9

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: actions/setup-go@v4
18+
- uses: actions/setup-go@v5
1919
with:
2020
go-version-file: "go.mod"
2121
- name: Generate
@@ -47,10 +47,10 @@ jobs:
4747
BUNDLE: registry.local/source/bundle
4848
steps:
4949
- uses: actions/checkout@v4
50-
- uses: actions/setup-go@v4
50+
- uses: actions/setup-go@v5
5151
with:
5252
go-version-file: "go.mod"
53-
- uses: carvel-dev/setup-action@v1
53+
- uses: carvel-dev/setup-action@v2
5454
with:
5555
token: ${{ secrets.GITHUB_TOKEN }}
5656
- name: Generate certs
@@ -136,7 +136,7 @@ jobs:
136136
imgpkg push -f "${scratch}" -b "${BUNDLE}"
137137
imgpkg copy -b "${BUNDLE}" --to-tar source-controller-bundle.tar
138138
echo "##[endgroup]"
139-
- uses: actions/upload-artifact@v3
139+
- uses: actions/upload-artifact@v4
140140
with:
141141
name: source-controller-bundle.tar
142142
path: source-controller-bundle.tar
@@ -165,15 +165,16 @@ jobs:
165165
- 1.26.6
166166
- 1.27.3
167167
- 1.28.0
168+
- 1.29.0
168169
env:
169170
REGISTRY_NAME: registry.local
170171
BUNDLE: registry.local/source/bundle
171172
steps:
172173
- uses: actions/checkout@v4
173-
- uses: actions/setup-go@v4
174+
- uses: actions/setup-go@v5
174175
with:
175176
go-version-file: "go.mod"
176-
- uses: carvel-dev/setup-action@v1
177+
- uses: carvel-dev/setup-action@v2
177178
with:
178179
token: ${{ secrets.GITHUB_TOKEN }}
179180
- name: Install kind
@@ -284,7 +285,7 @@ jobs:
284285
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
285286
EOF
286287
- name: Download staged Source Controller build
287-
uses: actions/download-artifact@v3
288+
uses: actions/download-artifact@v4
288289
with:
289290
name: source-controller-bundle.tar
290291
- name: Relocate bundle
@@ -550,7 +551,7 @@ jobs:
550551
release_name: Release ${{ steps.get_version.outputs.VERSION }}
551552
draft: true
552553
- name: Download staged Source Controller build
553-
uses: actions/download-artifact@v3
554+
uses: actions/download-artifact@v4
554555
with:
555556
name: source-controller-bundle.tar
556557
- name: Upload Source Controller release
@@ -561,4 +562,4 @@ jobs:
561562
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
562563
asset_path: source-controller-bundle.tar
563564
asset_name: source-controller-bundle-${{ steps.get_version.outputs.VERSION }}.tar
564-
asset_content_type: application/x-tar
565+
asset_content_type: application/x-tar

.ko.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:2879c44347b5aba185d5a8306db4e87eb437edfedf085a3b442f5ad79cdc6a6a
1+
defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:9e9d47afb33cd415f670149df263935b30bcfee338499fd3109078d42aa79cf9

controllers/internal.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ func (r *MavenResolver) processSnapshotVersion(ctx context.Context, client *http
136136
return err
137137
}
138138

139-
// update artifact resolved version
140-
r.ResolvedVersion = metadata.SnapshotResolvedVersion(r.Artifact.Type)
139+
// if metadata contains snapshotVersions, resolve using snapshotVersions
140+
if len(metadata.Versioning.SnapshotVersions.SnapshotVersion) > 0 {
141+
r.ResolvedVersion = metadata.SnapshotResolvedVersion(r.Artifact.Type)
142+
} else {
143+
r.ResolvedVersion = r.Artifact.Version
144+
}
141145

142146
// set artificat filename
143147
if len(r.Artifact.Classifier) > 0 {

0 commit comments

Comments
 (0)