Add e2e tests and release workflow
This commit is contained in:
parent
959e088337
commit
338975a253
|
@ -0,0 +1,6 @@
|
||||||
|
FROM giantswarm/tiny-tools
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -0,0 +1,9 @@
|
||||||
|
name: 'kubebuilder'
|
||||||
|
description: 'A GitHub Action to run kubebuilder commands'
|
||||||
|
author: 'Stefan Prodan'
|
||||||
|
branding:
|
||||||
|
icon: 'command'
|
||||||
|
color: 'blue'
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh -l
|
||||||
|
|
||||||
|
VERSION=2.3.1
|
||||||
|
|
||||||
|
curl -sL https://go.kubebuilder.io/dl/${VERSION}/linux/amd64 | tar -xz -C /tmp/
|
||||||
|
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/kubebuilder
|
||||||
|
mv /tmp/kubebuilder_${VERSION}_linux_amd64/* $GITHUB_WORKSPACE/kubebuilder/
|
||||||
|
ls -lh $GITHUB_WORKSPACE/kubebuilder/bin
|
||||||
|
|
||||||
|
echo "::add-path::$GITHUB_WORKSPACE/kubebuilder/bin"
|
||||||
|
echo "::add-path::$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/kubebuilder/bin"
|
|
@ -0,0 +1,6 @@
|
||||||
|
FROM giantswarm/tiny-tools
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -0,0 +1,9 @@
|
||||||
|
name: 'kustomize'
|
||||||
|
description: 'A GitHub Action to run kustomize commands'
|
||||||
|
author: 'Stefan Prodan'
|
||||||
|
branding:
|
||||||
|
icon: 'command'
|
||||||
|
color: 'blue'
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh -l
|
||||||
|
|
||||||
|
VERSION=3.1.0
|
||||||
|
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v${VERSION}/kustomize_${VERSION}_linux_amd64
|
||||||
|
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/bin
|
||||||
|
cp ./kustomize $GITHUB_WORKSPACE/bin
|
||||||
|
chmod +x $GITHUB_WORKSPACE/bin/kustomize
|
||||||
|
ls -lh $GITHUB_WORKSPACE/bin
|
||||||
|
|
||||||
|
echo "::add-path::$GITHUB_WORKSPACE/bin"
|
||||||
|
echo "::add-path::$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin"
|
|
@ -0,0 +1,61 @@
|
||||||
|
name: e2e
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
kind:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Restore Go cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v2-beta
|
||||||
|
with:
|
||||||
|
go-version: 1.14.x
|
||||||
|
- name: Setup Kubernetes
|
||||||
|
uses: engineerd/setup-kind@v0.3.0
|
||||||
|
- name: Setup Kustomize
|
||||||
|
uses: ./.github/actions/kustomize
|
||||||
|
- name: Setup Kubebuilder
|
||||||
|
uses: ./.github/actions/kubebuilder
|
||||||
|
- name: Run tests
|
||||||
|
run: make test
|
||||||
|
env:
|
||||||
|
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||||
|
- name: Check if working tree is dirty
|
||||||
|
run: |
|
||||||
|
if [[ $(git diff --stat) != '' ]]; then
|
||||||
|
echo 'run make test and commit changes'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Build container image
|
||||||
|
run: make docker-build IMG=test/notification-controller:latest
|
||||||
|
env:
|
||||||
|
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||||
|
- name: Load test image
|
||||||
|
run: kind load docker-image test/notification-controller:latest
|
||||||
|
- name: Deploy controller
|
||||||
|
run: |
|
||||||
|
make dev-deploy IMG=test/notification-controller:latest
|
||||||
|
kubectl -n notification-system rollout status deploy/notification-controller --timeout=1m
|
||||||
|
env:
|
||||||
|
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||||
|
- name: Logs
|
||||||
|
run: |
|
||||||
|
kubectl -n notification-system logs deploy/notification-controller
|
||||||
|
- name: Debug failure
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
kubectl -n notification-system get providers -oyaml
|
||||||
|
kubectl -n notification-system get alerts -oyaml
|
|
@ -0,0 +1,52 @@
|
||||||
|
name: release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup Kustomize
|
||||||
|
uses: ./.github/actions/kustomize
|
||||||
|
- name: Get version
|
||||||
|
id: get_version
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||||
|
- name: Generate release asset
|
||||||
|
run: |
|
||||||
|
mkdir -p config/release
|
||||||
|
cp config/default/* config/release
|
||||||
|
cd config/release
|
||||||
|
kustomize edit set image fluxcd/notification-controller=fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }}
|
||||||
|
kustomize build . > notification-controller.yaml
|
||||||
|
- name: Push image
|
||||||
|
uses: docker/build-push-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
repository: fluxcd/notification-controller
|
||||||
|
tag_with_ref: true
|
||||||
|
- name: Create release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: true
|
||||||
|
body: |
|
||||||
|
[CHANGELOG](https://github.com/fluxcd/notification-controller/blob/master/CHANGELOG.md)
|
||||||
|
- name: Upload artifacts
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./config/release/notification-controller.yaml
|
||||||
|
asset_name: notification-controller.yaml
|
||||||
|
asset_content_type: text/plain
|
|
@ -1,2 +1,8 @@
|
||||||
# notification-controller
|
# notification-controller
|
||||||
|
|
||||||
|
[](https://github.com/fluxcd/notification-controller/actions)
|
||||||
|
[](https://goreportcard.com/report/github.com/fluxcd/notification-controller)
|
||||||
|
[](https://github.com/fluxcd/notification-controller/blob/master/LICENSE)
|
||||||
|
[](https://github.com/fluxcd/notification-controller/releases)
|
||||||
|
|
||||||
Experimental notification dispatcher
|
Experimental notification dispatcher
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
images:
|
images:
|
||||||
- name: fluxcd/notification-controller
|
- name: fluxcd/notification-controller
|
||||||
newName: fluxcd/notification-controller
|
newName: fluxcd/notification-controller
|
||||||
|
|
Loading…
Reference in New Issue