Skip to content

Commit

Permalink
fix: v0.8.x - Maven SNAPSHOT artifact version without snapshotVersion (
Browse files Browse the repository at this point in the history
…#265)

Signed-off-by: Rashed Kamal <[email protected]>
  • Loading branch information
rashedkvm authored Mar 6, 2024
1 parent 93d3ee5 commit bdbd6a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Generate
Expand Down Expand Up @@ -47,10 +47,10 @@ jobs:
BUNDLE: registry.local/source/bundle
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- uses: carvel-dev/setup-action@v1
- uses: carvel-dev/setup-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate certs
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
imgpkg push -f "${scratch}" -b "${BUNDLE}"
imgpkg copy -b "${BUNDLE}" --to-tar source-controller-bundle.tar
echo "##[endgroup]"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: source-controller-bundle.tar
path: source-controller-bundle.tar
Expand Down Expand Up @@ -165,15 +165,16 @@ jobs:
- 1.26.6
- 1.27.3
- 1.28.0
- 1.29.0
env:
REGISTRY_NAME: registry.local
BUNDLE: registry.local/source/bundle
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- uses: carvel-dev/setup-action@v1
- uses: carvel-dev/setup-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install kind
Expand Down Expand Up @@ -284,7 +285,7 @@ jobs:
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF
- name: Download staged Source Controller build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: source-controller-bundle.tar
- name: Relocate bundle
Expand Down Expand Up @@ -550,7 +551,7 @@ jobs:
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: true
- name: Download staged Source Controller build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: source-controller-bundle.tar
- name: Upload Source Controller release
Expand All @@ -561,4 +562,4 @@ jobs:
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
asset_path: source-controller-bundle.tar
asset_name: source-controller-bundle-${{ steps.get_version.outputs.VERSION }}.tar
asset_content_type: application/x-tar
asset_content_type: application/x-tar
2 changes: 1 addition & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:2879c44347b5aba185d5a8306db4e87eb437edfedf085a3b442f5ad79cdc6a6a
defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:9e9d47afb33cd415f670149df263935b30bcfee338499fd3109078d42aa79cf9
8 changes: 6 additions & 2 deletions controllers/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ func (r *MavenResolver) processSnapshotVersion(ctx context.Context, client *http
return err
}

// update artifact resolved version
r.ResolvedVersion = metadata.SnapshotResolvedVersion(r.Artifact.Type)
// if metadata contains snapshotVersions, resolve using snapshotVersions
if len(metadata.Versioning.SnapshotVersions.SnapshotVersion) > 0 {
r.ResolvedVersion = metadata.SnapshotResolvedVersion(r.Artifact.Type)
} else {
r.ResolvedVersion = r.Artifact.Version
}

// set artificat filename
if len(r.Artifact.Classifier) > 0 {
Expand Down

0 comments on commit bdbd6a9

Please sign in to comment.