Skip to content

BRANCH: Kubernetes 1.30.X #17

BRANCH: Kubernetes 1.30.X

BRANCH: Kubernetes 1.30.X #17

Workflow file for this run

name: deploy-cloud-autoscaler
on:
push:
tags:
- v*
env:
REGISTRY: ${{ secrets.REGISTRY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESSKEY: ${{ secrets.AWS_ACCESSKEY }}
AWS_PROFILE: ${{ secrets.AWS_PROFILE }}
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_SECRETKEY: ${{ secrets.AWS_SECRETKEY }}
IAM_ROLE_ARN: ${{ secrets.IAM_ROLE_ARN }}
PRIVATE_DOMAIN_NAME: ${{ secrets.PRIVATE_DOMAIN_NAME }}
ROUTE53_ZONEID: ${{ secrets.ROUTE53_ZONEID }}
SEED_IMAGE: ${{ vars.SEED_IMAGE }}
SEED_USER: ${{ vars.SEED_USER }}
SSH_KEYNAME: ${{ secrets.SSH_KEYNAME }}
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
VPC_SECURITY_GROUPID: ${{ secrets.VPC_SECURITY_GROUPID }}
VPC_SUBNET_ID: ${{ secrets.VPC_SUBNET_ID }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install LXD
uses: canonical/setup-lxd@main
with:
channel: 6.1/stable
- name: Cache vendor
uses: actions/cache@v4
env:
cache-name: cache-vendor
with:
path: vendor
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
- name: test-in-docker
shell: bash
run: |
./test/bin/test.sh
deploy:
name: Deploy
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache vendor
uses: actions/cache@v4
env:
cache-name: cache-vendor
with:
path: vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Prepare docker buildx
id: prep
shell: bash
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/}
echo "tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
docker buildx version;
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin;
docker context create builders
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
use: true
- name: Build docker image
id: build
shell: bash
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/}
make -e REGISTRY=$REGISTRY -e TAG="${IMAGE_TAG}" container-push-manifest
sudo chown -R $USER out vendor
cp out/linux/amd64/kubernetes-cloud-autoscaler kubernetes-cloud-autoscaler-amd64
cp out/linux/arm64/kubernetes-cloud-autoscaler kubernetes-cloud-autoscaler-arm64
- name: Remove same release
uses: liudonghua123/delete-release-action@v1
with:
release_name: ${{ steps.prep.outputs.tag }}
suppress_errors: true
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.prep.outputs.tag }}
draft: false
# token: ${{ secrets.GIT_PAT }}
files: |
kubernetes-cloud-autoscaler-amd64
kubernetes-cloud-autoscaler-arm64