From 8fcabfc2c25c5f9f07e4e94e10d28edd5f7aad20 Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Fri, 3 Mar 2023 10:54:34 +0100 Subject: [PATCH] chore(ci): upload to artifactory connectors repository (#4239) Refs: MON-16173 --- .github/actions/deb-delivery/action.yml | 13 +++++++++++-- .github/actions/rpm-delivery/action.yml | 18 +++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/actions/deb-delivery/action.yml b/.github/actions/deb-delivery/action.yml index f03a28b5b..59bd779e5 100644 --- a/.github/actions/deb-delivery/action.yml +++ b/.github/actions/deb-delivery/action.yml @@ -35,7 +35,17 @@ runs: path: ./*.deb key: ${{ inputs.cache_key }} - - name: Publish DEBS to Nexus + - uses: jfrog/setup-jfrog-cli@v3 + env: + JF_URL: https://centreon.jfrog.io + JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} + + - name: Publish DEBs to artifactory + run: | + jf rt upload "*.deb" "apt-connectors-${{ inputs.stability }}/pool/" --deb "${{ inputs.distrib }}/main/all" + shell: bash + + - name: Publish DEBs to Nexus run: | for MAJOR in "22.04" "22.10"; do echo "Delivering to $MAJOR ${{ inputs.stability }}" @@ -46,6 +56,5 @@ runs: fi 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 36c9304bd..a4d2dd614 100644 --- a/.github/actions/rpm-delivery/action.yml +++ b/.github/actions/rpm-delivery/action.yml @@ -44,6 +44,16 @@ runs: path: ./*.rpm key: ${{ inputs.cache_key }} + - uses: jfrog/setup-jfrog-cli@v3 + env: + JF_URL: https://centreon.jfrog.io + JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} + + - name: Publish RPMs to connectors repository + run: | + jf rt upload "*.rpm" "rpm-connectors/${{ inputs.distrib }}/${{ inputs.stability }}/noarch/" + shell: bash + - name: Setup awscli run: | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" @@ -51,7 +61,7 @@ runs: sudo ./aws/install shell: bash - - name: Publish RPMS + - name: Publish RPMs to standard repositories run: | FILES="*.rpm" @@ -71,18 +81,12 @@ 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"