Skip to content

Don't drain protected services #784

Don't drain protected services

Don't drain protected services #784

Workflow file for this run

name: CD / Controller
on:
pull_request:
branches:
- "master"
paths:
- "go/controller/**"
push:
tags:
- 'v*.*.*'
permissions:
contents: read
env:
GOPATH: /home/runner/go
GOBIN: /home/runner/go/bin
GOPROXY: "https://proxy.golang.org"
jobs:
test:
name: Unit test
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: go/controller
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Set up Go
uses: actions/setup-go@v4.1.0
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- name: Test
run: PATH=$PATH:$GOPATH/bin make test
publish-docker:
name: Build and push controller container
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: go/controller
needs: [ test ]
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/pluralsh/deployment-controller
gcr.io/pluralsh/deployment-controller
docker.io/pluralsh/deployment-controller
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: google-github-actions/auth@v1
with:
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
service_account: 'terraform@pluralsh.iam.gserviceaccount.com'
token_format: 'access_token'
create_credentials_file: true
- uses: google-github-actions/setup-gcloud@v1.0.1
- name: Login to gcr
run: gcloud auth configure-docker -q
- name: Login to Docker
uses: docker/login-action@v3
with:
username: mjgpluralsh
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Build and push
uses: docker/build-push-action@v5.1.0
with:
context: "./go"
file: "./go/controller/Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GIT_COMMIT=${{ github.sha }}
VERSION=${{ steps.meta.outputs.version }}