From 181ab2ce81505603afffcc46d4f39fa69f03f1ac Mon Sep 17 00:00:00 2001 From: Iryna Shustava Date: Tue, 19 Jul 2022 11:09:18 -0600 Subject: [PATCH] Enable ubi images in the build workflow (#1350) --- .github/workflows/build.yml | 78 ++++++++++++++++++------------------- control-plane/Dockerfile | 6 ++- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a87e25396..7ca374a340 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ on: - "release/**" env: - PKG_NAME: "consul-k8s-control-plane" + PKG_NAME: "consul-k8s" jobs: get-go-version: @@ -189,7 +189,7 @@ jobs: name: ${{ env.DEB_PACKAGE }} path: out/${{ env.DEB_PACKAGE }} - build-docker-default: + build-docker: name: Docker ${{ matrix.arch }} default release build needs: [get-product-version, build] runs-on: ubuntu-latest @@ -221,44 +221,40 @@ jobs: docker.io/hashicorp/${{ env.repo }}-control-plane:${{ env.version }} 986891699432.dkr.ecr.us-east-1.amazonaws.com/hashicorp/${{ env.repo }}-control-plane:${{ env.version }} dev_tags: | - hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-dev + hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }} docker.io/hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-${{ github.sha }} -# Disabling UBI build for now so that we do not inadvertently push a ubi image that we have not tested. - # build-docker-alternate: - # name: Docker ${{ matrix.arch }} alternate release build - # needs: [get-product-version, build] - # runs-on: ubuntu-latest - # strategy: - # matrix: - # arch: ["amd64"] - # env: - # repo: ${{ github.event.repository.name }} - # version: ${{ needs.get-product-version.outputs.product-version }} - # - # steps: - # - uses: actions/checkout@v2 - # - name: Copy LICENSE.md - # run: - # cp LICENSE.md ./control-plane - # - uses: hashicorp/actions-docker-build@v1.2.1 - # with: - # smoke_test: | - # TEST_VERSION="$(docker run "${IMAGE_NAME}" consul-k8s-control-plane version | awk '{print $2}')" - # if [ "${TEST_VERSION}" != "${version}" ]; then - # echo "Test FAILED" - # exit 1 - # fi - # echo "Test PASSED" - # version: ${{ env.version }} - # target: ubi - # arch: ${{ matrix.arch }} - # pkg_name: consul-k8s-control-plane_${{ env.version }} - # bin_name: consul-k8s-control-plane - # workdir: control-plane - # tags: | - # registry.connect.redhat.com/hashicorp/consul-k8s-control-plane:${{env.version}}-ubi - # dev_tags: | - # hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-ubi-dev - # docker.io/hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-ubi-${{ github.sha }} - # + build-docker-ubi: + name: Docker ${{ matrix.arch }} alternate release build + needs: [get-product-version, build] + runs-on: ubuntu-latest + strategy: + matrix: + arch: ["amd64"] + env: + repo: ${{ github.event.repository.name }} + version: ${{ needs.get-product-version.outputs.product-version }} + steps: + - uses: actions/checkout@v2 + - name: Copy LICENSE.md + run: + cp LICENSE.md ./control-plane + - uses: hashicorp/actions-docker-build@v1.2.1 + with: + smoke_test: | + TEST_VERSION="$(docker run "${IMAGE_NAME}" consul-k8s-control-plane version | awk '{print $2}')" + if [ "${TEST_VERSION}" != "${version}" ]; then + echo "Test FAILED" + exit 1 + fi + echo "Test PASSED" + version: ${{ env.version }} + target: ubi + arch: ${{ matrix.arch }} + pkg_name: consul-k8s-control-plane_${{ env.version }} + bin_name: consul-k8s-control-plane + workdir: control-plane + redhat_tag: scan.connect.redhat.com/ospid-611ca2f89a9b407267837100/consul-k8s-control-plane:${{env.version}}-ubi + dev_tags: | + hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-ubi + docker.io/hashicorppreview/${{ env.repo }}-control-plane:${{ env.version }}-ubi-${{ github.sha }} diff --git a/control-plane/Dockerfile b/control-plane/Dockerfile index 1a895c5e22..2d0ad412a6 100644 --- a/control-plane/Dockerfile +++ b/control-plane/Dockerfile @@ -85,7 +85,8 @@ ENV VERSION=${VERSION} RUN apk add --no-cache ca-certificates curl gnupg libcap openssl su-exec iputils libc6-compat iptables # TARGETOS and TARGETARCH are set automatically when --platform is provided. -ARG TARGETOS TARGETARCH +ARG TARGETOS +ARG TARGETARCH # Create a non-root user to run the software. RUN addgroup ${BIN_NAME} && \ @@ -126,7 +127,8 @@ ENV NAME=${BIN_NAME} ENV VERSION=${VERSION} # TARGETOS and TARGETARCH are set automatically when --platform is provided. -ARG TARGETOS TARGETARCH +ARG TARGETOS +ARG TARGETARCH # Copy license for Red Hat certification. COPY LICENSE.md /licenses/mozilla.txt