chore(ci): move to harbor docker registry (#4237)

This commit is contained in:
Kevin Duret 2023-02-23 17:24:11 +01:00 committed by David Boucher
parent 07f85b3f86
commit c4fe39fa55
9 changed files with 54 additions and 36 deletions

View File

@ -27,11 +27,14 @@ inputs:
sign:
description: Wether to sign the package or not
default: ""
artifactory_username:
description: The artifactory username
registry_url:
description: Docker registry url
required: true
artifactory_password:
description: The artifactory password
registry_username:
description: Docker registry username
required: true
registry_password:
description: Docker registry password
required: true
runs:
@ -41,9 +44,9 @@ runs:
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: docker.centreon.com
username: ${{ inputs.artifactory_username }}
password: ${{ inputs.artifactory_password }}
registry: ${{ inputs.registry_url }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
- name: Package
uses: ./.github/actions/runner-docker
@ -51,8 +54,9 @@ runs:
script_name: ${{ inputs.script_name }}
image_name: ${{ inputs.image_name }}
image_version: latest
artifactory_username: ${{ inputs.artifactory_username }}
artifactory_password: ${{ inputs.artifactory_password }}
registry_url: ${{ inputs.registry_url }}
registry_username: ${{ inputs.registry_username }}
registry_password: ${{ inputs.registry_password }}
params: ${{ inputs.version }} ${{ inputs.release }} "${{ inputs.plugins }}"
- name: Sign
@ -62,8 +66,9 @@ runs:
script_name: rpm-signing
image_name: rpm-signing
image_version: ubuntu
artifactory_username: ${{ inputs.artifactory_username }}
artifactory_password: ${{ inputs.artifactory_password }}
registry_url: ${{ inputs.registry_url }}
registry_username: ${{ inputs.registry_username }}
registry_password: ${{ inputs.registry_password }}
- name: Cache packaged files
uses: actions/cache@v3

View File

@ -13,11 +13,14 @@ inputs:
centreon_pat:
description: "Secret"
required: false
artifactory_username:
description: The artifactory username
registry_url:
description: Docker registry url
required: true
artifactory_password:
description: The artifactory password
registry_username:
description: Docker registry username
required: true
registry_password:
description: Docker registry password
required: true
params:
description: "params for script"
@ -28,9 +31,9 @@ runs:
- name: Login to Registry (via runner)
uses: docker/login-action@v2
with:
registry: docker.centreon.com
username: ${{ inputs.artifactory_username }}
password: ${{ inputs.artifactory_password }}
registry: ${{ inputs.registry_url }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_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 }}
- run: docker run -i -e TOKEN=${{ inputs.centreon_pat }} --entrypoint /src/.github/scripts/${{ inputs.script_name }}.sh -v "$PWD:/src" ${{ inputs.registry_url }}/${{ inputs.image_name }}:${{ inputs.image_version }} ${{ inputs.params }}
shell: bash

View File

@ -1,4 +1,6 @@
FROM docker-proxy.centreon.com/almalinux:8
ARG REGISTRY_URL
FROM ${REGISTRY_URL}/almalinux:8
RUN <<EOF

View File

@ -1,4 +1,6 @@
FROM docker-proxy.centreon.com/almalinux:9
ARG REGISTRY_URL
FROM ${REGISTRY_URL}/almalinux:9
RUN <<EOF

View File

@ -1,4 +1,6 @@
FROM docker-proxy.centreon.com/debian:bullseye
ARG REGISTRY_URL
FROM ${REGISTRY_URL}/debian:bullseye
# fix locale
RUN <<EOF

View File

@ -1,4 +1,6 @@
FROM docker-proxy.centreon.com/centos:7
ARG REGISTRY_URL
FROM ${REGISTRY_URL}/centos:7
RUN <<EOF

View File

@ -33,16 +33,16 @@ jobs:
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: docker.centreon.com
username: ${{ secrets.REPOS_USERNAME }}
password: ${{ secrets.REPOS_PASSWORD }}
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
- name: Login to proxy registry
uses: docker/login-action@v2
with:
registry: docker-proxy.centreon.com
username: ${{ secrets.REPOS_USERNAME }}
password: ${{ secrets.REPOS_PASSWORD }}
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
- uses: docker/setup-buildx-action@v2
@ -50,6 +50,7 @@ jobs:
with:
file: .github/docker/Dockerfile.packaging-${{ matrix.project }}-${{ matrix.distrib }}
context: .
build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}"
pull: true
push: true
tags: docker.centreon.com/packaging-${{ matrix.project }}-${{ matrix.distrib }}:latest
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/packaging-${{ matrix.project }}-${{ matrix.distrib }}:latest

View File

@ -11,9 +11,9 @@ on:
required: true
type: string
secrets:
artifactory_username:
registry_username:
required: true
artifactory_password:
registry_password:
required: true
jobs:
@ -87,5 +87,6 @@ jobs:
release: ${{ inputs.release }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
sign: true
artifactory_username: ${{ secrets.artifactory_username }}
artifactory_password: ${{ secrets.artifactory_password }}
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
registry_username: ${{ secrets.registry_username }}
registry_password: ${{ secrets.registry_password }}

View File

@ -95,8 +95,8 @@ jobs:
version: ${{ needs.get-environment.outputs.version }}
release: ${{ needs.get-environment.outputs.release }}
secrets:
artifactory_username: ${{ secrets.REPOS_USERNAME }}
artifactory_password: ${{ secrets.REPOS_PASSWORD }}
registry_username: ${{ secrets.DOCKER_REGISTRY_ID }}
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
deliver:
needs: [get-environment, package]