From ba7f10e8cce67b44e0a5107926166fc163c8bbee Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Fri, 17 Feb 2023 11:18:25 +0100 Subject: [PATCH] fix(ci): fix plugins delivery to debian and artifactory (#4230) --- .github/actions/deb-delivery/action.yml | 14 +++++++++----- .github/actions/rpm-delivery/action.yml | 9 +++++++++ .github/workflows/plugin-delivery.yml | 13 +++++++++---- .github/workflows/plugins.yml | 5 +++-- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/actions/deb-delivery/action.yml b/.github/actions/deb-delivery/action.yml index 058a7db2b..f03a28b5b 100644 --- a/.github/actions/deb-delivery/action.yml +++ b/.github/actions/deb-delivery/action.yml @@ -4,11 +4,11 @@ inputs: distrib: description: "The distribution used for packaging" required: true - artifactory_username: - description: The artifactory username + nexus_username: + description: The nexus username required: true - artifactory_password: - description: The artifactory password + nexus_password: + description: The nexus password required: true version: description: "Centreon packaged version" @@ -22,6 +22,9 @@ inputs: stability: description: "The package stability (stable, testing, unstable)" required: true + artifactory_token: + description: "token for artifactory" + required: true runs: using: "composite" @@ -42,6 +45,7 @@ runs: FOLDER_SUFFIX="" fi - find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl -u "${{ inputs.artifactory_username }}":"${{ inputs.artifactory_password }}" -H "Content-Type: multipart/form-data" --data-binary "@%" https://apt.centreon.com/repository/$MAJOR$FOLDER_SUFFIX/ + find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl --fail -v -u "${{ inputs.nexus_username }}":"${{ inputs.nexus_password }}" -H "Content-Type: multipart/form-data" --data-binary "@%" https://apt.centreon.com/repository/$MAJOR$FOLDER_SUFFIX/ + find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl --fail -v -H "Authorization: Bearer ${{ inputs.artifactory_token }}" -X PUT "https://centreon.jfrog.io/artifactory/apt-$MAJOR-${{ inputs.stability }}/pool/%;deb.distribution=${{ inputs.distrib }};deb.component=main;deb.architecture=all" -T "%" done shell: bash diff --git a/.github/actions/rpm-delivery/action.yml b/.github/actions/rpm-delivery/action.yml index aab466b21..36c9304bd 100644 --- a/.github/actions/rpm-delivery/action.yml +++ b/.github/actions/rpm-delivery/action.yml @@ -31,6 +31,9 @@ inputs: stability: description: "The package stability (stable, testing, unstable)" required: true + artifactory_token: + description: "token for artifactory" + required: true runs: using: "composite" @@ -68,12 +71,18 @@ runs: if [ "$REPOTYPE" == "stable" ]; then TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/RPMS" + ARTIFACTORY_TARGET="https://centreon.jfrog.io/artifactory/rpm/$PROJECT_PATH/$MAJOR/$DISTRIB/${{ inputs.stability }}/$ARCH" else FOLDER="centreon-$PROJECT-$VERSION-$RELEASE" TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT/$FOLDER" PROJECT_LOCATION="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT" + ARTIFACTORY_TARGET="https://centreon.jfrog.io/artifactory/rpm/$PROJECT_PATH/$MAJOR/$DISTRIB/${{ inputs.stability }}/$ARCH/$PROJECT/$FOLDER" fi + for FILE in $FILES; do + curl --fail -v -H "Authorization: Bearer ${{ inputs.artifactory_token }}" -X PUT "$ARTIFACTORY_TARGET/$FILE" -T "./$FILE" + done + echo "[DEBUG] - Folder: $FOLDER" echo "[DEBUG] - Project : $PROJECT" echo "[DEBUG] - Target : $TARGET" diff --git a/.github/workflows/plugin-delivery.yml b/.github/workflows/plugin-delivery.yml index e3406ec24..1263bf83c 100644 --- a/.github/workflows/plugin-delivery.yml +++ b/.github/workflows/plugin-delivery.yml @@ -14,9 +14,9 @@ on: type: string required: true secrets: - artifactory_username: + nexus_username: required: true - artifactory_password: + nexus_password: required: true update_repo_path: description: "The update repo script path" @@ -30,6 +30,9 @@ on: yum_repo_key: description: "The repo key" required: true + artifactory_token: + description: "The artifactory token" + required: true jobs: deliver-rpm: @@ -54,6 +57,7 @@ jobs: yum_repo_address: ${{ secrets.yum_repo_address }} yum_repo_key: ${{ secrets.yum_repo_key }} stability: ${{ inputs.stability }} + artifactory_token: ${{ secrets.artifactory_token }} deliver-deb: runs-on: [self-hosted, common] @@ -71,7 +75,8 @@ jobs: distrib: ${{ matrix.distrib }} version: ${{ inputs.version }} release: ${{ inputs.release }} - artifactory_username: ${{ secrets.artifactory_username }} - artifactory_password: ${{ secrets.artifactory_password }} + nexus_username: ${{ secrets.nexus_username }} + nexus_password: ${{ secrets.nexus_password }} cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} stability: ${{ inputs.stability }} + artifactory_token: ${{ secrets.artifactory_token }} diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 70bfa301d..b98977c66 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -107,9 +107,10 @@ jobs: release: ${{ needs.get-environment.outputs.release }} stability: ${{ needs.get-environment.outputs.stability }} secrets: - artifactory_username: ${{ secrets.NEXUS_USER }} - artifactory_password: ${{ secrets.NEXUS_PASSWD }} + nexus_username: ${{ secrets.NEXUS_USERNAME }} + nexus_password: ${{ secrets.NEXUS_PASSWORD }} update_repo_path: ${{ secrets.UPDATE_REPO_PATH }} cloudfront_id: ${{ secrets.CLOUDFRONT_ID }} yum_repo_address: ${{ secrets.YUM_REPO_ADDRESS }} yum_repo_key: ${{ secrets.YUM_REPO_KEY }} + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}