Add the option to opt out of service account token automounting and a… #166
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: Go | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- '*' | |
pull_request: | |
env: | |
KUBECONFIG: /tmp/kubeconfig | |
OPERATOR_SDK_VERSION: v0.18.2 | |
IMAGE_NAME: quay.io/mittwald/kubernetes-secret-generator | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.15 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.15 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Install golangci-lint | |
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.33.0 | |
- name: Run golangci-lint | |
run: $(go env GOPATH)/bin/golangci-lint run -v --timeout 5m | |
- name: Create kind cluster and apply crds | |
run: make crd | |
- name: Hack Code Climate and Go Modules | |
if: github.event_name != 'pull_request' | |
run: mkdir -p github.com/mittwald && ln -sf $(pwd) github.com/mittwald/kubernetes-secret-generator | |
- name: Test & publish code coverage | |
if: github.event_name != 'pull_request' | |
uses: paambaati/codeclimate-action@v2.3.0 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.codeClimateReporterID }} | |
with: | |
coverageCommand: go test -coverprofile=c.out ./... | |
debug: true | |
prefix: 'github.com/${{ github.repository }}/' | |
- name: Go Test | |
if: github.event_name == 'pull_request' | |
run: go test -coverprofile=c.out -coverpkg=./pkg/... ./... | |
build: | |
name: Build Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.15 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.15 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Install operator-sdk | |
run: sudo curl -L -o /usr/local/bin/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu" && sudo chmod +x /usr/local/bin/operator-sdk | |
- name: Build Image | |
run: operator-sdk build "$IMAGE_NAME:latest" --go-build-args "-ldflags -X=version.Version=${GITHUB_SHA::8}" | |
deploymaster: | |
name: Deploy Latest Image | |
runs-on: ubuntu-latest | |
needs: ['test', 'build'] | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Set up Go 1.15 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.15 | |
id: go | |
- name: Registry Login | |
run: docker login -u "${{ secrets.dockerLoginUsername }}" -p "${{ secrets.dockerLoginPassword }}" quay.io | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Install operator-sdk | |
run: sudo curl -L -o /usr/local/bin/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu" && sudo chmod +x /usr/local/bin/operator-sdk | |
- name: Build latest image | |
run: operator-sdk build "$IMAGE_NAME:latest" --go-build-args "-ldflags -X=version.Version=${GITHUB_SHA::8}" | |
- name: Push latest tag | |
run: docker push "$IMAGE_NAME:latest" | |
deploytagged: | |
name: Deploy Tagged Image | |
runs-on: ubuntu-latest | |
needs: ['test', 'build'] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Set up Go 1.15 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.15 | |
id: go | |
- name: Registry Login | |
run: docker login -u "${{ secrets.dockerLoginUsername }}" -p "${{ secrets.dockerLoginPassword }}" quay.io | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Install operator-sdk | |
run: sudo curl -L -o /usr/local/bin/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu" && sudo chmod +x /usr/local/bin/operator-sdk | |
- name: Build tagged image | |
run: operator-sdk build "$IMAGE_NAME:latest" --go-build-args "-ldflags -X=version.Version=${GITHUB_REF##*/}" | |
- name: Tag versioned image | |
run: docker tag "$IMAGE_NAME:latest" "$IMAGE_NAME:${GITHUB_REF##*/}" | |
- name: Push images | |
run: docker push "$IMAGE_NAME:latest" && docker push "$IMAGE_NAME:${GITHUB_REF##*/}" | |
- name: Run chart version bump | |
uses: mittwald/bump-app-version-action@v1 | |
with: | |
mode: 'publish' | |
chartYaml: './deploy/helm-chart/kubernetes-secret-generator/Chart.yaml' | |
env: | |
GITHUB_TOKEN: "${{ secrets.RELEASE_USER_TOKEN }}" | |
HELM_REPO_PASSWORD: "${{ secrets.HELM_REPO_PASSWORD }}" |