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

spectro-cicd #4

Open
wants to merge 2 commits into
base: spectro-v1beta1_v2
Choose a base branch
from
Open
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
68 changes: 68 additions & 0 deletions .github/workflows/spectro-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Spectro Release
run-name: Release for Cluster API cluster-api-control-plane-provider-microk8s ${{ github.event.inputs.release_version }}
on:
workflow_dispatch:
inputs:
release_version:
description: 'Cluster API Version to Build'
required: true
default: '0.0.0'
jobs:
builder:
# edge-runner machine group is a bunch of machines in US Datacenter
runs-on: ubuntu-latest
# Initialize all secrets required for the job
# Ensure that the credentials are provided as encrypted secrets
env:
SPECTRO_VERSION: ${{ github.event.inputs.release_version }}
steps:
-
uses: mukunku/[email protected]
id: checkTag
with:
tag: v${{ github.event.inputs.release_version }}-spectro
-
if: ${{ steps.checkTag.outputs.exists == 'true' }}
run: |
echo "Tag already exists for v${{ github.event.inputs.release_version }}-spectro..."
exit 1
-
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to private registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
-
name: Build Image
env:
REGISTRY: gcr.io/spectro-images-public/release/cluster-api-control-plane-provider-microk8s
run: |
make docker-build
make docker-push
-
name: Build Image - FIPS Mode
env:
FIPS_ENABLE: yes
REGISTRY: gcr.io/spectro-images-public/release-fips/cluster-api-control-plane-provider-microk8s
run: |
make docker-build
make docker-push
-
name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.release_version }}-spectro
release_name: Release v${{ github.event.inputs.release_version }}-spectro
body: |
Release version ${{ github.event.inputs.release_version }}
draft: false
prerelease: false
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
FROM golang:1.19.8 as builder

ARG arch

ARG CRYPTO_LIB
ENV GOEXPERIMENT=${CRYPTO_LIB:+boringcrypto}
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
Expand All @@ -17,8 +18,13 @@ COPY api/ api/
COPY controllers/ controllers/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -a -ldflags '-s -w' -o manager main.go

RUN if [ ${CRYPTO_LIB} ]; \
then \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "-linkmode=external -extldflags=-static" -o manager main.go ;\
else \
CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -a -ldflags '-s -w' -o manager main.go ;\
fi
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

# Image URL to use all building/pushing image targets
IMG ?= gcr.io/spectro-dev-public/microk8s/capi-control-plane-provider-microk8s:20221207


FIPS_ENABLE ?= ""

RELEASE_LOC := release
ifeq ($(FIPS_ENABLE),yes)
RELEASE_LOC := release-fips
endif

SPECTRO_VERSION ?= 4.0.0-dev

REGISTRY ?= gcr.io/spectro-dev-public/microk8s/${RELEASE_LOC}/cluster-api
TAG ?= v1.11.0-spectro-${SPECTRO_VERSION}
IMG ?= gcr.io/spectro-dev-public/microk8s/${RELEASE_LOC}/capi-control-plane-provider-microk8s:${TAG}
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.23
# Components file to be used by clusterctl
Expand Down