-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit re-introduces a working CI to the project to build containers in GitHub Actions and push them to Quay. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
- Loading branch information
Showing
3 changed files
with
78 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- "*" | ||
pull_request: | ||
branches: [ main ] | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
container: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build container | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
|
||
push: | ||
if: github.event_name != 'pull_request' | ||
needs: | ||
- container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
- name: Determine SHA | ||
id: sha | ||
run: echo "::set-output name=sha::$(git describe --always --tags --dirty)" | ||
- name: Build and push | ||
id: push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/arm64, linux/amd64 | ||
tags: quay.io/observatorium/namespace-provisioner:latest, quay.io/observatorium/namespace-provisioner:${{ steps.sha.outputs.sha }} | ||
- name: Determine digest | ||
run: echo ${{ steps.push.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
FROM alpine:3.12 | ||
FROM --platform=$BUILDPLATFORM golang:1.21-alpine3.19 AS build | ||
|
||
COPY ./namespace-provisioner /usr/bin/namespace-provisioner | ||
COPY . /src | ||
WORKDIR /src | ||
RUN go mod vendor | ||
ARG TARGETOS TARGETARCH | ||
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build . | ||
|
||
FROM scratch as runner | ||
COPY --from=build /src/namespace-provisioner /usr/bin/namespace-provisioner | ||
|
||
LABEL vendor="Observatorium" \ | ||
name="observatorium/namespace-provisioner" \ | ||
description="Create temporary namespaces in a Kubernetes cluster" \ | ||
io.k8s.display-name="observatorium/namespace-provisioner" \ | ||
io.k8s.description="Create temporary namespaces in a Kubernetes cluster" \ | ||
maintainer="Observatorium <team-monitoring@redhat.com>" \ | ||
org.label-schema.description="Create temporary namespaces in a Kubernetes cluster" \ | ||
org.label-schema.name="observatorium/namespace-provisioner" \ | ||
org.label-schema.schema-version="1.0" \ | ||
org.label-schema.vendor="Observatorium" | ||
|
||
ENTRYPOINT ["/usr/bin/namespace-provisioner"] |