Skip to content

Merge pull request #26 from timebertt/scale-up-apiserver #267

Merge pull request #26 from timebertt/scale-up-apiserver

Merge pull request #26 from timebertt/scale-up-apiserver #267

Workflow file for this run

name: Verify and Build
on:
release:
types:
- published
push:
branches:
- '*'
tags:
- v*
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
jobs:
verify:
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/kubernetes-controller-sharding/kubernetes-controller-sharding/go
defaults:
run:
working-directory: go/src/github.com/timebertt/kubernetes-controller-sharding
steps:
- uses: actions/checkout@v3
with:
path: go/src/github.com/timebertt/kubernetes-controller-sharding
- uses: actions/setup-go@v4
with:
go-version-file: go/src/github.com/timebertt/kubernetes-controller-sharding/webhosting-operator/go.mod
cache-dependency-path: go/src/github.com/timebertt/kubernetes-controller-sharding/webhosting-operator/go.sum
- name: Verify
run: make -C webhosting-operator verify
images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: webhosting-operator/go.mod
cache-dependency-path: webhosting-operator/go.sum
- uses: ko-build/[email protected]
with:
version: v0.14.1
- name: Prepare image metadata
id: meta
# generate comma-separated tags and labels for image build (similar to docker/metadata-action)
run: |
short_ref=${{ github.ref_name }}
if ${{ github.event_name == 'pull_request' }} ; then
# for PR events, ref_name is '<pr-number>/merge' but tags may not contain /
short_ref=pr-${{ github.event.pull_request.number }}
fi
tags=(
$short_ref
sha-$( echo ${{ github.sha }} | head -c7 )
)
if ${{ github.ref_name == 'master' }} ; then
tags+=( latest )
fi
echo "tags=$(IFS=, ; echo "${tags[*]}")" >> $GITHUB_OUTPUT
labels=(
org.opencontainers.image.created=$( date -u +%Y-%m-%dT%H:%M:%SZ )
org.opencontainers.image.licenses=Apache-2.0
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.version=$short_ref
)
echo "labels=$(IFS=, ; echo "${labels[*]}")" >> $GITHUB_OUTPUT
- name: ko build
run: |
set -ex
cd ./webhosting-operator
ko build --push=${{ github.event_name != 'pull_request' }} --sbom none --base-import-paths --platform linux/amd64,linux/arm64 \
--tags "${{ steps.meta.outputs.tags }}" --image-label "${{ steps.meta.outputs.labels }}" \
./cmd/experiment \
./cmd/webhosting-operator