Skip to content

Allow rate-limit of changes on cluster #1034

Allow rate-limit of changes on cluster

Allow rate-limit of changes on cluster #1034

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: "1.21"
- uses: golangci/golangci-lint-action@v3
with:
version: v1.56
- run: make test
integration:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
k8s_version:
- 1.24.13 # current version at GKE stable channel (https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions)
- 1.25.8 # current version at GKE regular channel (https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions)
steps:
- uses: actions/checkout@master
- name: Running up Kubernetes (using Minikube)
uses: medyagh/setup-minikube@master
with:
kubernetes-version: v${{ matrix.k8s_version }}
- uses: azure/setup-helm@v1
with:
version: v3.7.0
- uses: actions/setup-go@v3
with:
go-version: "1.21"
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-goleak-
- name: Run integration tests
env:
GOPATH: /tmp/go
INSTALL_CERT_MANAGER: "true"
CLUSTER_PROVIDER: minikube
DEBUG: "true"
run: |
./scripts/localkube-integration.sh
rpaas-api-docker-image:
name: "Publish rpaas-api image on dockerhub"
needs:
- test
- integration
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: Surgo/docker-smart-tag-action@v1
id: smarttag
with:
docker_image: tsuru/rpaas-api
default_branch: main
tag_with_sha: "true"
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v5
with:
file: ./Dockerfile.api
push: true
tags: ${{ steps.smarttag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64
rpaas-operator-docker-image:
name: "Publish rpaas-operator image on dockerhub"
needs:
- test
- integration
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: Surgo/docker-smart-tag-action@v1
id: smarttag
with:
docker_image: tsuru/rpaas-operator
default_branch: main
tag_with_sha: "true"
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v5
with:
file: ./Dockerfile.operator
push: true
tags: ${{ steps.smarttag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64
rpaas-purger-docker-image:
name: "Publish rpaas-purger image on dockerhub"
needs:
- test
- integration
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: Surgo/docker-smart-tag-action@v1
id: smarttag
with:
docker_image: tsuru/rpaas-purger
default_branch: main
tag_with_sha: "true"
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v5
with:
file: ./Dockerfile.purger
push: true
tags: ${{ steps.smarttag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64
release:
name: "Release artifacts on github"
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
needs:
- test
- integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Set VERSION env
run: echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: generate manifest.json
env:
VERSION: ${{ env.VERSION }}
run: |
cat >manifest.json <<EOF
{
"SchemaVersion": "1.0",
"Metadata": {
"Name": "rpaasv2",
"Version": "${VERSION}"
},
"URLPerPlatform": {
"darwin/arm64": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Darwin_arm64.tar.gz",
"darwin/amd64": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Darwin_x86_64.tar.gz",
"linux/arm64": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Linux_arm64.tar.gz",
"linux/386": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Linux_i386.tar.gz",
"linux/amd64": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Linux_x86_64.tar.gz",
"windows/386": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Windows_i386.zip",
"windows/amd64": "https://github.com/tsuru/rpaas-operator/releases/download/v${VERSION}/rpaasv2_${VERSION}_Windows_x86_64.zip"
}
}
EOF
- uses: actions/setup-go@v3
with:
go-version: "1.21"
- uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}