From 16298e1668e75245462b535c1f9ccd0998434168 Mon Sep 17 00:00:00 2001 From: Jack Green Date: Wed, 14 Aug 2024 14:47:00 +0100 Subject: [PATCH] Fix private test repository access [DI-236] (#221) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In [DI-222](https://hazelcast.atlassian.net/browse/DI-222) the test repositories were made private, but that caused [build failures](https://github.com/hazelcast/hazelcast-packaging/actions/runs/10365877156/job/28693937495). While the _initial_ connection to the repositories to get metadata was authenticated, the ultimate `install` was not and failed. Fixed by adding the credentials to the URL as advised by [JFrog documentation](https://jfrog.com/help/r/jfrog-artifactory-documentation/configure-authenticated-access-to-debian-servers) Fixes: [DI-236](https://hazelcast.atlassian.net/browse/DI-236) [DI-222]: https://hazelcast.atlassian.net/browse/DI-222?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [DI-236]: https://hazelcast.atlassian.net/browse/DI-236?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Ɓukasz Dziedziul (cherry picked from commit d12e3f1338c6f555346e60d795a1522405eb20fe) --- .github/workflows/publish-brew-package.yml | 4 ++++ .github/workflows/publish-deb-package.yml | 1 + .github/workflows/publish-rpm-package.yml | 9 +++++++-- common.sh | 7 ++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-brew-package.yml b/.github/workflows/publish-brew-package.yml index 2c07a15e..fb82f44d 100644 --- a/.github/workflows/publish-brew-package.yml +++ b/.github/workflows/publish-brew-package.yml @@ -19,6 +19,10 @@ on: description: 'Version of the package e.g. 5.1.1, 5.1.1-1, defaults to HZ_VERSION' type: string +env: + JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }} + JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }} + concurrency: group: 'brew-${{ github.job }}-${{ inputs.HZ_VERSION }}-${{ inputs.HZ_DISTRIBUTION}}' diff --git a/.github/workflows/publish-deb-package.yml b/.github/workflows/publish-deb-package.yml index 413ce0d5..44f57611 100644 --- a/.github/workflows/publish-deb-package.yml +++ b/.github/workflows/publish-deb-package.yml @@ -20,6 +20,7 @@ on: type: string env: + JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }} JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }} concurrency: diff --git a/.github/workflows/publish-rpm-package.yml b/.github/workflows/publish-rpm-package.yml index 602f3f4b..94eb9277 100644 --- a/.github/workflows/publish-rpm-package.yml +++ b/.github/workflows/publish-rpm-package.yml @@ -20,6 +20,7 @@ on: type: string env: + JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }} JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }} DEVOPS_PRIVATE_KEY: ${{ secrets.DEVOPS_PRIVATE_KEY }} BINTRAY_PASSPHRASE: ${{ secrets.BINTRAY_PASSPHRASE }} @@ -79,11 +80,15 @@ jobs: HZ_LICENSEKEY: ${{ secrets.HZ_LICENSEKEY }} run: | source ./common.sh + + # Bake authentication into the returned URLs wget \ ${RPM_REPO_BASE_URL}/${PACKAGE_REPO}/hazelcast-rpm-${PACKAGE_REPO}.repo \ --header "Authorization: Bearer ${{ env.JFROG_TOKEN }}" \ - --output-document hazelcast-rpm-${PACKAGE_REPO}.repo - mv hazelcast-rpm-${PACKAGE_REPO}.repo /etc/yum.repos.d/ + --output-document - | \ + sed "s#https://#https://${{ env.JFROG_USERNAME }}:${{ env.JFROG_TOKEN }}@#g" > \ + /etc/yum.repos.d/hazelcast-rpm-${PACKAGE_REPO}.repo + yum install -y ${{ env.HZ_DISTRIBUTION}}-${RPM_HZ_VERSION} HAZELCAST_CONFIG="$(pwd)/config/integration-test-hazelcast.yaml" hz-start > hz.log 2>&1 & diff --git a/common.sh b/common.sh index add9e6d4..91f82319 100755 --- a/common.sh +++ b/common.sh @@ -61,9 +61,8 @@ export BREW_PACKAGE_VERSION if [ "${USE_TEST_REPO}" == "true" ]; then # PRs publish to test repositories and install the packages from there export DEBIAN_REPO=debian-test-local - export DEBIAN_REPO_BASE_URL="https://repository.hazelcast.com/${DEBIAN_REPO}" + export DEBIAN_REPO_BASE_URL="https://${JFROG_USERNAME}:${JFROG_TOKEN}@repository.hazelcast.com/${DEBIAN_REPO}" export RPM_REPO=rpm-test-local - export RPM_REPO_BASE_URL="https://repository.hazelcast.com/${RPM_REPO}" # This is a clone of the hazelcast/homebrew-hz repository export BREW_GIT_REPO_NAME="hazelcast/homebrew-hz-test" @@ -72,8 +71,10 @@ else export DEBIAN_REPO=debian-local export DEBIAN_REPO_BASE_URL="https://repository.hazelcast.com/${DEBIAN_REPO}" export RPM_REPO=rpm-local - export RPM_REPO_BASE_URL="https://repository.hazelcast.com/${RPM_REPO}" export BREW_GIT_REPO_NAME="hazelcast/homebrew-hz" export BREW_TAP_NAME="hazelcast/hz" fi + +export RPM_REPO_BASE_URL="https://repository.hazelcast.com/${RPM_REPO}" +export HZ_DISTRIBUTION_FILE=distribution.tar.gz