Skip to content

Add Namespace to Role and RoleBinding for config-map RBAC #416

Add Namespace to Role and RoleBinding for config-map RBAC

Add Namespace to Role and RoleBinding for config-map RBAC #416

Workflow file for this run

name: Build Test and Lint
on:
workflow_dispatch:
push:
branches:
- main
- release-*
pull_request:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v5
# Setup GoLang build environment
# https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
# Download dependencies
- run: go mod download
# Build Go binary
- run: go build -v cmd/main.go
# Compile test packages without running them to warm the build cache.
# The test job restores this cache and only needs to execute the binaries.
- run: go test -run=^$ ./...
lint:
name: Lint
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v5
# Setup GoLang build environment
# https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- name: Install Helm
uses: azure/setup-helm@v3.5
# Run Go linters
# https://github.com/golangci/golangci-lint-action
- name: Run linters
uses: golangci/golangci-lint-action@v7
with:
version: v2.4.0
- name: Regenerate CRDs
run: make generate manifests
- name: Check for CRD drift
run: |
git diff --compact-summary --exit-code -- config/crd deploy/charts || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate manifests' and commit."; exit 1)
- name: Lint Helm manifests
run: make lint-manifests
## TODO: These integration tests are breaking in GitHub Actions. Need to investigate further as to why.
# integration:
# name: Integration Test with cert-manager
# needs: test
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# certmanagerversion:
# - '1.15.0'
# - '1.14.6'
# - '1.12.11'
# - '1.13.6'
# steps:
# # Checkout code
# # https://github.com/actions/checkout
# - name: Checkout code
# uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
# - run: sudo apt-get install jq curl openssl
# # Setup GoLang build environment
# # https://github.com/actions/setup-go
# - name: Set up Go 1.x
# uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
# with:
# go-version-file: 'go.mod'
# cache: true
# # Install cmctl
# - name: Install cmctl
# run: |
# OS=$(go env GOOS); ARCH=$(go env GOARCH); curl -fsSL -o cmctl https://github.com/cert-manager/cmctl/releases/latest/download/cmctl_${OS}_${ARCH}
# chmod +x cmctl
# sudo mv cmctl /usr/local/bin
# cmctl --help
# # Create a single-node K8s cluster with Kind
# # Then, deploy an ephemeral EJBCA and SignServer
# - uses: m8rmclaren/ejbca-signserver-k8s@main
# with:
# deploy-k8s: 'true'
# deploy-nginx-ingress: 'true'
# deploy-signserver: 'false'
# # Set up cert-manager
# - name: Set up cert-manager
# run: |
# helm repo add jetstack https://charts.jetstack.io
# helm repo update
# helm install \
# cert-manager jetstack/cert-manager \
# --namespace cert-manager \
# --create-namespace \
# --version "${{ matrix.certmanagerversion }}" \
# --set installCRDs=true
# # Run integration test
# - name: Run integration test
# run: |
# chmod +x test/integrationtest.sh
# ./test/integrationtest.sh