Skip to content

release

release #95

Workflow file for this run

name: release
on:
push:
tags:
- "v*.*.*"
env:
AGENT_IMAGE: "neondatabase/autoscaler-agent"
SCHED_IMAGE: "neondatabase/autoscale-scheduler"
MONITOR_IMAGE: "neondatabase/vm-monitor"
KUSTOMIZE_VERSION: "4.5.7"
CONTROLLER_TOOLS_VERSION: "0.10.0"
CODE_GENERATOR_VERSION: "0.25.11"
IMG: "neondatabase/neonvm-controller"
IMG_VXLAN: "neondatabase/neonvm-vxlan-controller"
IMG_RUNNER: "neondatabase/neonvm-runner"
VM_KERNEL_IMAGE: "neondatabase/vm-kernel"
VM_KERNEL_VERSION: "5.15.80"
CLUSTER_AUTOSCALER_IMAGE: "neondatabase/cluster-autoscaler-neonvm"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: get version and git info
id: get_vcs_info
run: |
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo -n "git_info=" >> $GITHUB_OUTPUT
# note: --tags enables matching on lightweight (i.e. not annotated) tags, which normally
# wouldn't be necessary, except that actions/checkout@v3 does weird things to setup the
# repository that means that we actually end up checked out with *just* a lightweight tag
# to the tagged commit.
git describe --tags --long --dirty >> $GITHUB_OUTPUT
- name: get CA base git tag
id: get_ca_tag
run: |
echo -n "ca_git_tag=" >> $GITHUB_OUTPUT
cat cluster-autoscaler/ca.tag >> $GITHUB_OUTPUT
- name: install golang
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: check everything builds
run: go build ./...
- name: build binaries
run: |
make \
VM_MONITOR_IMG=${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }} \
build
- name: docker - install qemu
uses: docker/setup-qemu-action@v2
- name: docker - setup buildx
uses: docker/setup-buildx-action@v2
- name: login to docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
- name: load vm kernel
run: |
docker pull --quiet ${{ env.VM_KERNEL_IMAGE }}:${{ env.VM_KERNEL_VERSION }}
ID=$(docker create ${{ env.VM_KERNEL_IMAGE }}:${{ env.VM_KERNEL_VERSION }} true)
docker cp ${ID}:/vmlinuz neonvm/hack/vmlinuz
docker rm -f ${ID}
- name: build and push runner image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: neonvm/runner/Dockerfile
tags: ${{ env.IMG_RUNNER }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push controller image
uses: docker/build-push-action@v3
with:
build-args: VM_RUNNER_IMAGE=${{ env.IMG_RUNNER }}:${{ steps.get_vcs_info.outputs.version }}
context: .
platforms: linux/amd64
push: true
file: neonvm/Dockerfile
tags: ${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push vxlan controller image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: neonvm/tools/vxlan/Dockerfile
tags: ${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push autoscale-scheduler image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/autoscale-scheduler/Dockerfile
tags: ${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
- name: build and push autoscaler-agent image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/autoscaler-agent/Dockerfile
tags: ${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
- name: build and push vm-monitor image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/vm-monitor/Dockerfile
tags: ${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
- name: render kubernetes resources
uses: stefanprodan/kube-tools@v1
with:
kustomize: ${{ env.KUSTOMIZE_VERSION }}
command: |
kustomize version --short
cd ${GITHUB_WORKSPACE}/neonvm/config/common/controller && kustomize edit set image controller=${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/neonvm/config/default-vxlan/vxlan-controller && kustomize edit set image vxlan-controller=${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/deploy/scheduler && kustomize edit set image autoscale-scheduler=${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/deploy/agent && kustomize edit set image autoscaler-agent=${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}
mkdir -p rendered_manifests
kustomize build neonvm/config/default-vxlan/whereabouts > rendered_manifests/whereabouts.yaml
kustomize build neonvm/config/default-vxlan/multus-eks > rendered_manifests/multus-eks.yaml
kustomize build neonvm/config/default-vxlan/multus > rendered_manifests/multus.yaml
kustomize build neonvm/config/default-vxlan > rendered_manifests/neonvm.yaml
kustomize build deploy/scheduler > rendered_manifests/autoscale-scheduler.yaml
kustomize build deploy/agent > rendered_manifests/autoscaler-agent.yaml
# Because we want a docker image for the VM monitor, the easiest way for us to also provide
# a binary is by just extracting it from the container image itself.
- name: extract vm-monitor binary
run: |
ID=$(docker create ${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }})
docker cp $ID:/usr/bin/vm-monitor bin/vm-monitor
docker rm -f $ID
- name: build and push cluster-autoscaler image
uses: docker/build-push-action@v3
with:
tags: ${{ env.CLUSTER_AUTOSCALER_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
context: cluster-autoscaler
push: true
build-args: |
CA_GIT_TAG=${{ steps.get_ca_tag.outputs.ca_git_tag }}
- name: github release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
bin/vm-builder
bin/vm-builder-generic
bin/vm-monitor
rendered_manifests/autoscale-scheduler.yaml
rendered_manifests/autoscaler-agent.yaml
rendered_manifests/neonvm.yaml
rendered_manifests/multus.yaml
rendered_manifests/multus-eks.yaml
rendered_manifests/whereabouts.yaml
deploy/vmscrape.yaml