fix(ci): fix plugins delivery to debian and artifactory (#4230)

This commit is contained in:
Kevin Duret 2023-02-17 11:18:25 +01:00 committed by David Boucher
parent a6496efd04
commit ba7f10e8cc
4 changed files with 30 additions and 11 deletions

View File

@ -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

View File

@ -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"

View File

@ -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 }}

View File

@ -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 }}