-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cicd cleanup Co-authored-by: sharnoff <[email protected]>
- Loading branch information
Showing
13 changed files
with
3,343 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
|
||
env: | ||
KUSTOMIZE_VERSION: "4.5.7" | ||
CONTROLLER_TOOLS_VERSION: "0.10.0" | ||
CODE_GENERATOR_VERSION: "0.25.4" | ||
GOFLAGS: "-buildvcs=false" | ||
IMG: "neondatabase/neonvm-controller" | ||
IMG_RUNNER: "neondatabase/neonvm-runner" | ||
VM_KERNEL_IMAGE: "neondatabase/vm-kernel" | ||
VM_KERNEL_VERSION: "5.15.80" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- id: get_version | ||
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | ||
|
||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
- name: install golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
- name: generate go code | ||
run: | | ||
git clone --branch=v${{ env.CODE_GENERATOR_VERSION }} --depth=1 https://github.com/kubernetes/code-generator.git ${RUNNER_TEMP}/code-generator | ||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v${{ env.CONTROLLER_TOOLS_VERSION }} | ||
${RUNNER_TEMP}/code-generator/generate-groups.sh "deepcopy,client,informer,lister" github.com/neondatabase/neonvm/client github.com/neondatabase/neonvm/apis neonvm:v1 --go-header-file hack/boilerplate.go.txt | ||
controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
- name: build binaries | ||
run: make 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 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 | ||
#push: ${{ github.event_name != 'pull_request' }} | ||
file: runner/Dockerfile | ||
tags: ${{ env.IMG_RUNNER }}:${{ steps.get_version.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_version.outputs.version }} | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
#push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ env.IMG }}:${{ steps.get_version.outputs.version }} | ||
|
||
- name: render kubernetes resources | ||
uses: stefanprodan/kube-tools@v1 | ||
with: | ||
kustomize: ${{ env.KUSTOMIZE_VERSION }} | ||
command: | | ||
kustomize version --short | ||
cd config/controller && kustomize edit set image controller=${{ env.IMG }}:${{ steps.get_version.outputs.version }} | ||
cd ${GITHUB_WORKSPACE} && kustomize build config/default --output neonvm.yaml | ||
- name: github release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
neonvm.yaml | ||
bin/vm-builder |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: vm-example | ||
|
||
on: | ||
schedule: | ||
- cron: '40 * * * *' | ||
workflow_dispatch: # adds ability to run this manually | ||
|
||
env: | ||
VM_EXAMPLE_SOURCE: postgres:14-alpine | ||
VM_EXAMPLE_IMAGE: neondatabase/vm-postgres:14-alpine | ||
|
||
jobs: | ||
vm-example: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: install golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
- name: build vm-builder | ||
run: go build -o bin/vm-builder tools/vm-builder/main.go | ||
|
||
- 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: build and push vm-example image | ||
run: | | ||
bin/vm-builder -src ${{ env.VM_EXAMPLE_SOURCE }} -dst ${{ env.VM_EXAMPLE_IMAGE }} | ||
docker push -q ${{ env.VM_EXAMPLE_IMAGE }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: vm-kernel | ||
|
||
on: | ||
schedule: | ||
- cron: '40 * * * *' | ||
workflow_dispatch: # adds ability to run this manually | ||
|
||
env: | ||
VM_KERNEL_IMAGE: "neondatabase/vm-kernel" | ||
VM_KERNEL_VERSION: "5.15.80" | ||
|
||
jobs: | ||
vm-kernel: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- 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: build linux kernel | ||
uses: docker/build-push-action@v3 | ||
with: | ||
build-args: KERNEL_VERSION=${{ env.VM_KERNEL_VERSION }} | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
pull: true | ||
no-cache: true | ||
file: hack/Dockerfile.kernel-builder | ||
tags: ${{ env.VM_KERNEL_IMAGE }}:${{ env.VM_KERNEL_VERSION }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
resources: | ||
- manager.yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
images: | ||
- name: controller | ||
newName: controller | ||
newTag: dev | ||
commonAnnotations: | ||
redeploy-at: "1669290550" | ||
|
||
resources: | ||
- manager.yaml |
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
Oops, something went wrong.