From cee36d84e07a3f551d49a5c35a572688785d8945 Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Wed, 5 Jun 2024 18:21:43 +0200 Subject: [PATCH 1/2] Signing the releases Adding some annotationsto help with ArtifactHub Signed-off-by: Emmanuel Hugonnet --- .github/workflows/ci_kind.yaml | 16 +++++++++------- .github/workflows/helm.yaml | 31 +++++++++++++++++++++++++------ charts/wildfly/Chart.yaml | 10 ++++++++++ cr.yml | 2 ++ 4 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 cr.yml diff --git a/.github/workflows/ci_kind.yaml b/.github/workflows/ci_kind.yaml index a7509ba9..5b236928 100644 --- a/.github/workflows/ci_kind.yaml +++ b/.github/workflows/ci_kind.yaml @@ -2,7 +2,7 @@ name: Helm Chart CI on: - pull_request -# - push + - push # Only run the latest job concurrency: @@ -12,22 +12,24 @@ concurrency: jobs: test: runs-on: ubuntu-latest + permissions: + packages: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.6 with: fetch-depth: 0 submodules: recursive - name: Install Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: v3.13.3 - name: Setup Bats and Bats libs - uses: bats-core/bats-action@1.5.4 + uses: bats-core/bats-action@2.0.0 with: - bats-version: 1.10.0 + bats-version: 1.11.0 support-path: ${{ github.workspace }}/tests/test-common/bats-support assert-path: ${{ github.workspace }}/tests/test-common/bats-assert @@ -39,7 +41,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.5.0 + uses: helm/kind-action@v1.10.0 with: node_image: "kindest/node:v1.29.0" config: ./.github/workflows/ci/kind-config.yaml @@ -64,4 +66,4 @@ jobs: - name: Run Tests run: |- cd tests/bats - export IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }} && export PUSH_TO_REGISTRY=true && export USE_OPENSHIFT=false && export BATS_LIBS_BASEDIR=../test-common && export_CLUSTER_CLIENT=kubectl && bats --timing --trace --verbose-run -r . + export IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }} && export PUSH_TO_REGISTRY=true && export USE_OPENSHIFT=false && export BATS_LIBS_BASEDIR=../test-common && export CLUSTER_CLIENT=kubectl && bats --timing --trace --verbose-run -r . diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index cab43d67..523913c7 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -6,7 +6,7 @@ name: Helm Chart Release on: # Triggers the workflow on push or pull request for the release branch push: - branches: [ release ] +# branches: [ release ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -24,15 +24,34 @@ jobs: run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + - name: List keys + run: gpg -K + - name: Prepare GPG key + run: | + gpg_dir=.cr-gpg + mkdir "$gpg_dir" + keyring=~/.gnupg/pubring.gpg + base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring" + passphrase_file="$gpg_dir/passphrase" + echo "$GPG_PASSPHRASE" > "$passphrase_file" + echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV" + env: + GPG_KEYRING_BASE64: "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" + GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}" - name: Install Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3.5 with: version: v3.4.0 - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.1.0 - with: - charts_repo_url: http://docs.wildfly.org/wildfly-charts/ + uses: helm/chart-releaser-action@v1.6.0 + # with: + # charts_repo_url: http://docs.wildfly.org/wildfly-charts/ env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/charts/wildfly/Chart.yaml b/charts/wildfly/Chart.yaml index 91236e0e..ab03b8c0 100644 --- a/charts/wildfly/Chart.yaml +++ b/charts/wildfly/Chart.yaml @@ -16,6 +16,16 @@ icon: https://design.jboss.org/wildfly/logo/final/wildfly_logomark_256px.png annotations: charts.openshift.io/name: WildFly charts.openshift.io/provider: WildFly + artifacthub.io/category: ApplicationServer + artifacthub.io/images: | + - name: builderImage + image: quay.io/wildfly/wildfly-s2i:latest + - name: runtimeImage + image: quay.io/wildfly/wildfly-runtime:latest + artifacthub.io/license: Apache-2.0 + artifacthub.io/signKey: | + fingerprint: 54CBE792CAFD9AD9E59D7C8E9E0332B74DCA3EF1 + url: http://lacrosse.corp.redhat.com/~ehugonne/signing_key.asc dependencies: - name: wildfly-common diff --git a/cr.yml b/cr.yml new file mode 100644 index 00000000..cb773bd2 --- /dev/null +++ b/cr.yml @@ -0,0 +1,2 @@ +sign: true +key: ehugonne@redhat.com From 880c3d84595476c07286b562dc2296c64411e14a Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Mon, 10 Jun 2024 13:51:11 +0200 Subject: [PATCH 2/2] Using local registry when testing with kind. Signed-off-by: Emmanuel Hugonnet --- .github/workflows/ci/setup-image-registry.sh | 50 ++++++++++++++++++++ .github/workflows/ci_kind.yaml | 17 +++---- .github/workflows/helm.yaml | 2 +- charts/wildfly/Chart.yaml | 2 +- tests/bats/ingress.bats | 4 -- tests/bats/metadata.bats | 4 -- tests/bats/setup_suite.bash | 1 + 7 files changed, 59 insertions(+), 21 deletions(-) create mode 100755 .github/workflows/ci/setup-image-registry.sh diff --git a/.github/workflows/ci/setup-image-registry.sh b/.github/workflows/ci/setup-image-registry.sh new file mode 100755 index 00000000..ed3f3045 --- /dev/null +++ b/.github/workflows/ci/setup-image-registry.sh @@ -0,0 +1,50 @@ +#!/bin/sh +set -o errexit + +echo 1. Create registry container unless it already exists +reg_name='kind-registry' +reg_port='5001' +if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then + docker run \ + -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ + registry:2 +fi + +echo 2. Add the registry config to the nodes + +# This is necessary because localhost resolves to loopback addresses that are +# network-namespace local. +# In other words: localhost in the container is not localhost on the host. +# +# We want a consistent name that works from both ends, so we tell containerd to +# alias localhost:${reg_port} to the registry container when pulling images +kind get nodes --name chart-testing +REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}" +for node in $(kind get nodes --name chart-testing); do + docker exec "${node}" mkdir -p "${REGISTRY_DIR}" + cat <&3 docker push ${IMAGE_REGISTRY}/helloworld echo "docker push of ${IMAGE_REGISTRY}/helloworld was successful" >&3 popd