From bdbd6a9aa90ba9e68e0fc9d4f11f9c7ace4d1d26 Mon Sep 17 00:00:00 2001 From: Rashed K <89036140+rashedkvm@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:18:06 -0500 Subject: [PATCH] fix: v0.8.x - Maven SNAPSHOT artifact version without snapshotVersion (#265) Signed-off-by: Rashed Kamal --- .github/workflows/ci.yaml | 19 ++++++++++--------- .ko.yaml | 2 +- controllers/internal.go | 8 ++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c7b1d1..99bceb9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/.ko.yaml b/.ko.yaml index c6897fa..4675019 100644 --- a/.ko.yaml +++ b/.ko.yaml @@ -1 +1 @@ -defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:2879c44347b5aba185d5a8306db4e87eb437edfedf085a3b442f5ad79cdc6a6a +defaultBaseImage: paketobuildpacks/run-jammy-tiny@sha256:9e9d47afb33cd415f670149df263935b30bcfee338499fd3109078d42aa79cf9 diff --git a/controllers/internal.go b/controllers/internal.go index 224f6e0..9073e4e 100755 --- a/controllers/internal.go +++ b/controllers/internal.go @@ -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 {