Skip to content

Commit

Permalink
enh(packaging): add rpm sign to workflow 2210 (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntoja authored Dec 12, 2022
1 parent 1f2771c commit 5395b8d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,28 @@ runs:
echo "[DEBUG] - File: $FILE"
VERSION=${{ inputs.version }}
MAJOR="$VERSION"
DISTRIB="${{ inputs.distrib }}";
REPOTYPE="$SUBREPO"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
PROJECT=${{ inputs.module_name }}
FOLDER=$(basename $FILE .rpm)
PROJECT_PATH="standard"
echo "[DEBUG] - Arch: $ARCH"
echo "[DEBUG] - Suprepo: $SUBREPO"
echo "[DEBUG] - FILES: $FILES"
echo "[DEBUG] - DISTRIB: $DISTRIB"
echo "[DEBUG] - Version: $VERSION"
if [[ "${{ env.extfile }}" == "deb" ]] ; then
echo "[DEBUG] - https://artifactory.apps.centreon.com/artifactory/debian-$VERSION-$REPO/pool/$FILE;deb.distribution=bullseye;deb.component=main;deb.architecture=amd64"
curl -v -u "${{ inputs.repos_username }}":"${{ inputs.repos_password }}" -X PUT "https://artifactory.apps.centreon.com/artifactory/debian-$VERSION-$REPO/pool/$FILE;deb.distribution=bullseye;deb.component=main;deb.architecture=amd64" -T "./$FILE"
curl -u "${{ inputs.repo_username }}":"${{ inputs.repo_password }}" -H "Content-Type: multipart/form-data" --data-binary "@./$FILE" https://apt.centreon.com/repository/23.04-$SUBREPO/
else
#echo "[DEBUG] - https://artifactory.apps.centreon.com/artifactory/rpm-$VERSION-$REPO/$DISTRIB/$REPO/x86_64/centreon-collect"
#curl -v -u "${{ inputs.repos_username }}":"${{ inputs.repos_password }}" -X PUT "https://artifactory.apps.centreon.com/artifactory/rpm-$VERSION-$REPO/$DISTRIB/$REPO/x86_64/centreon-collect/$FILE" -T "./$FILE"
DISTRIB="${{ inputs.distrib }}"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
FOLDER=$(basename $FILE .rpm)
echo "[DEBUG] - DISTRIB: $DISTRIB"
echo "[DEBUG] - Arch: $ARCH"
echo "[DEBUG] - FOLDER: $FOLDER"
eval `ssh-agent`
ssh-add - <<< "${{ inputs.yum_repo_key }}"
TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT/$FOLDER"
Expand Down
36 changes: 36 additions & 0 deletions .github/actions/package-sign/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: rpm-sign-in-docker
description: Run step in docker container
inputs:
script_name:
description: "script_name"
required: true
image_name:
description: "image_name"
required: true
image_version:
description: "image_version"
required: true
centreon_pat:
description: "Secret"
required: false
username:
description: The artifactory username
required: true
password:
description: The artifactory password
required: true
params:
description: "params for script"
required: false
runs:
using: "composite"
steps:
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: docker.centreon.com
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- run: docker run -i -e TOKEN=${{ inputs.centreon_pat }} --entrypoint /src/.github/scripts/${{ inputs.script_name }}.sh -v "$PWD:/src" docker.centreon.com/${{ inputs.image_name }}:${{ inputs.image_version}} ${{ inputs.params }}
shell: bash
5 changes: 5 additions & 0 deletions .github/scripts/rpm-signing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -ex
export GPG_TTY=$(tty)
rpmsign --addsign /src/*.rpm
9 changes: 9 additions & 0 deletions .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ jobs:
image_version: ${{ env.imgversion }}
env_variable: -e DISTRIB="${{ matrix.distrib }}" -e VERSION="${{ env.version }}" -e RELEASE="${{ env.release }}"

- name: sign rpm ${{ matrix.image }}
uses: ./.github/actions/package-sign
with:
script_name: rpm-signing
image_name: rpm-signing
image_version: ubuntu
username: ${{ secrets.REPOS_USERNAME }}
password: ${{ secrets.REPOS_PASSWORD }}

- name: Use cache RPM files
uses: actions/cache@v3
env:
Expand Down

0 comments on commit 5395b8d

Please sign in to comment.