spinnaker-operator #36
Workflow file for this run
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
name: spinnaker-operator | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
build: | |
if: github.event.review.state == 'approved' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Fetch full history | |
run: git fetch --prune --tags --unshallow | |
- name: Set up Go 1.18.2 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18.2 | |
- name: Determine build type | |
id: build_type | |
run: | | |
echo "github.ref: ${{ github.ref }}" | |
echo "github.base_ref: ${{ github.base_ref }}" | |
echo "github.head_ref: ${{ github.head_ref }}" | |
echo "branch: $(git rev-parse --abbrev-ref HEAD)" | |
if [[ ${{github.event_name }} = "pull_request" ]] ; then branch_override=${{ github.head_ref }} ; fi | |
# On PRs to release branches, build RC releases for target release branch | |
if [[ ${{github.event_name }} = "pull_request" && "x${{ github.base_ref }}" =~ ^xrelease-* ]] | |
then | |
echo "Building release candidate" | |
build_type=rc | |
branch_override=${{ github.base_ref }} | |
registry=docker.io | |
else | |
echo "Building snapshot" | |
build_type=snapshot | |
registry=armory-docker-local.jfrog.io | |
fi | |
make_args="VERSION_TYPE=$build_type REGISTRY=$registry REGISTRY_ORG=armory BRANCH_OVERRIDE=$branch_override" | |
version=$(make version $make_args) | |
echo "Version: $version" | |
# Make sure the version can be used as a tag | |
git tag v$version | |
git tag -d v$version | |
echo "build_type=$build_type" >> $GITHUB_OUTPUT | |
echo "registry=$registry" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "make_args=$make_args" >> $GITHUB_OUTPUT | |
# We need to do this for at least a few versions so that we don't force | |
# users to manually fix the CRDs when migrating from v1beta1 to v1. | |
- name: Modify spinsvc CRD to assist with migration | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq -i '.spec.preserveUnknownFields = false' deploy/crds/spinnaker.io_spinnakerservices.yaml | |
- name: Build | |
run: | | |
go mod vendor && go mod tidy | |
make build ${{ steps.build_type.outputs.make_args }} | |
make docker-build ${{ steps.build_type.outputs.make_args }} | |
- name: Package | |
run: | | |
make docker-package ${{ steps.build_type.outputs.make_args }} | |
- name: Login to docker registry | |
run: | | |
if [[ ${{ steps.build_type.outputs.registry }} = "docker.io" ]] | |
then | |
echo "Logging in to dockerhub" | |
docker login -u ${{ secrets.DOCKERHUB_USER }} -p "${{ secrets.DOCKERHUB_PASSWORD }}" docker.io | |
else | |
echo "Logging in to jfrog" | |
docker login -u ${{ secrets.JFROG_USER }} -p "${{ secrets.JFROG_PASSWORD }}" armory-docker-local.jfrog.io | |
fi | |
- name: Push | |
run: | | |
make docker-push ${{ steps.build_type.outputs.make_args }} | |
- name: Push git tag | |
if: steps.build_type.outputs.build_type == 'rc' | |
run: | | |
git tag v${{ steps.build_type.outputs.version }} | |
git push origin v${{ steps.build_type.outputs.version }} | |
# Skipping integration test | |
# - uses: engineerd/[email protected] | |
# with: | |
# version: "v0.11.1" | |
# - name: Install load balancer | |
# if: steps.build_type.outputs.build_type == 'rc' | |
# run: | | |
# kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml | |
# kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)" | |
# kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml | |
# kubectl apply -f integration_tests/kind/metallb-configmap.yaml | |
# until [ "$(kubectl get pods --all-namespaces --no-headers | grep -cEv '([0-9]+)/\1')" -ne 0 ]; do | |
# sleep 5s | |
# done | |
# | |
# - name: Run tests | |
# if: steps.build_type.outputs.build_type == 'rc' | |
# env: | |
# S3_BUCKET: ${{ secrets.INTEGRATION_TEST_S3_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.INTEGRATION_TEST_S3_USER }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.INTEGRATION_TEST_S3_PASSWORD }} | |
# AWS_DEFAULT_REGION: ${{ secrets.INTEGRATION_TEST_S3_BUCKET_REGION }} | |
# AWS_EC2_METADATA_DISABLED: true | |
# OPERATOR_IMAGE: ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }} | |
# run: | | |
# kind load docker-image ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }} | |
# halyard=$(cat halyard-version | head -1) | |
# export HALYARD_IMAGE="armory/halyard:$halyard" | |
# make integration-test |