Skip to content

Commit 1f1a6b4

Browse files
committed
ci: Run e2e test on PRs and merges to main
1 parent a653580 commit 1f1a6b4

File tree

8 files changed

+75
-4
lines changed

8 files changed

+75
-4
lines changed

.github/workflows/e2e.yaml

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: e2e
22

33
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
48
workflow_dispatch:
59

610
jobs:
@@ -9,12 +13,33 @@ jobs:
913
steps:
1014
- name: Checkout
1115
uses: actions/[email protected]
12-
- name: Setup
16+
- name: Setup | Go
1317
uses: actions/[email protected]
1418
with:
1519
go-version: 1.20.x
16-
- name: Prepare
20+
- name: Setup | Kubernetes Cluster
21+
uses: helm/[email protected]
22+
with:
23+
version: v0.18.0
24+
cluster_name: pipeline-controller
25+
node_image: kindest/node:v1.26.3@sha256:61b92f38dff6ccc29969e7aa154d34e38b89443af1a2c14e6cfbd2df6419c66f
26+
- name: Setup | Flux
27+
run: curl -s https://fluxcd.io/install.sh | sudo bash
28+
- name: Prepare | Go # .netrc is used by docker-build, ~/.netrc is used by go test
29+
run: echo "machine github.com login ${{ github.actor }} password ${{ secrets.BUILD_BOT_TOKEN }}" | tee ~/.netrc .netrc
30+
- name: Prepare | Kubernetes Cluster
1731
run: |
18-
echo "machine github.com login ${{ github.actor }} password ${{ secrets.BUILD_BOT_TOKEN }}" > ~/.netrc
32+
echo "Create flux-system namespace"
33+
kubectl create namespace flux-system
34+
echo "Adding GitHub promotion credentials"
35+
kubectl create secret generic -n flux-system github-promotion-credentials \
36+
--from-literal="username=${{ secrets.PROMOTION_GITHUB_USERNAME }}" \
37+
--from-literal="password=${{ secrets.PROMOTION_GITHUB_TOKEN }}" \
38+
--from-literal="token=${{ secrets.PROMOTION_GITHUB_TOKEN }}"
39+
echo "Adding GitLab promotion credentials"
40+
kubectl create secret generic -n flux-system gitlab-promotion-credentials \
41+
--from-literal="username=${{ secrets.PROMOTION_GITLAB_USERNAME }}" \
42+
--from-literal="password=${{ secrets.PROMOTION_GITLAB_TOKEN }}" \
43+
--from-literal="token=${{ secrets.PROMOTION_GITLAB_TOKEN }}"
1944
- name: Run E2E tests
2045
run: make e2e

Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,13 @@ e2e: e2e-setup e2e-test e2e-clean
214214
.PHONY: e2e-setup
215215
e2e-setup: e2e-kind deploy
216216
kubectl wait -n pipeline-system deployment/pipeline-controller --for=condition=available
217-
kubectl apply -f e2e/testdata --recursive
217+
kubectl apply -k e2e/testdata/pipelines/github
218+
kubectl apply -k e2e/testdata/pipelines/gitlab
218219

219220
e2e-kind: docker-build
221+
ifneq ($(CI), true)
220222
kind create cluster --name=pipeline-controller || kubectx kind-pipeline-controller
223+
endif
221224
kind load docker-image --name=pipeline-controller $(IMG)
222225
flux install
223226

@@ -227,4 +230,9 @@ e2e-test:
227230

228231
.PHONY: e2e-clean
229232
e2e-clean:
233+
kubectl delete -k e2e/testdata/pipelines/github
234+
kubectl delete -k e2e/testdata/pipelines/gitlab
235+
flux uninstall --silent
236+
ifneq ($(CI), true)
230237
kind delete cluster --name=pipeline-controller
238+
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- podinfo-dev/
5+
- podinfo-prod/
6+
- pipeline.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- namespace.yaml
5+
- source.yaml
6+
- release.yaml
7+
- notification.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- namespace.yaml
5+
- source.yaml
6+
- release.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- podinfo-dev/
5+
- podinfo-prod/
6+
- pipeline.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- namespace.yaml
5+
- source.yaml
6+
- release.yaml
7+
- notification.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- namespace.yaml
5+
- source.yaml
6+
- release.yaml

0 commit comments

Comments
 (0)