Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ubi images in the build workflow #1350

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 37 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "release/**"

env:
PKG_NAME: "consul-k8s-control-plane"
PKG_NAME: "consul-k8s"

jobs:
get-go-version:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Copy link
Contributor Author

@ishustava ishustava Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev version already has the -dev suffix and so our images before ended up having -dev-dev suffix

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 }}
6 changes: 4 additions & 2 deletions control-plane/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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} && \
Expand Down Expand Up @@ -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
Expand Down