-
Notifications
You must be signed in to change notification settings - Fork 81
164 lines (141 loc) · 6.2 KB
/
kind-nightly.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Nightly E2E Tests on Kind
on:
schedule:
- cron: "0 5 * * *"
jobs:
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
env:
REGISTRY_NAME: registry.local
REGISTRY_PORT: 5000
KO_DOCKER_REPO: registry.local:5000/ko
CONTROLLER_DOMAIN_URL: controller.paac-127-0-0-1.nip.io
TEST_GITHUB_REPO_OWNER_GITHUBAPP: openshift-pipelines/pipelines-as-code-e2e-tests
KUBECONFIG: /home/runner/.kube/config.kind
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/.cache/pip
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install and run gosmee
run: |
go install -v github.com/chmouel/gosmee@main
nohup gosmee client --saveDir /tmp/gosmee-replay ${{ secrets.PYSMEE_URL }} http://${CONTROLLER_DOMAIN_URL} &
- name: Install ko
run: curl -sfL https://github.com/google/ko/releases/download/v0.12.0/ko_0.12.0_Linux_x86_64.tar.gz -o-|tar xvzf - -C /usr/local/bin ko
- name: Start installing cluster
run: |
export PAC_DIR=${PWD}
export TEST_GITEA_SMEEURL="${{ secrets.TEST_GITEA_SMEEURL }}"
bash -x ./hack/dev/kind/install.sh
- name: Create PAC github-app-secret
run: |
kubectl delete secret -n pipelines-as-code pipelines-as-code-secret || true
kubectl -n pipelines-as-code create secret generic pipelines-as-code-secret \
--from-literal github-private-key="${{ secrets.APP_PRIVATE_KEY }}" \
--from-literal github-application-id=${{ secrets.APPLICATION_ID }} \
--from-literal webhook.secret=${{ secrets.WEBHOOK_SECRET }}
# Disable Bitbucket Cloud Source IP check, since we should be god here.
kubectl patch configmap -n pipelines-as-code -p "{\"data\":{\"bitbucket-cloud-check-source-ip\": \"false\"}}" \
--type merge pipelines-as-code
# restart controller
kubectl -n pipelines-as-code delete pod -l app.kubernetes.io/name=controller
# wait for controller to start
i=0
for tt in pipelines-as-code-controller;do
while true;do
[[ ${i} == 120 ]] && exit 1
ep=$(kubectl get ep -n pipelines-as-code ${tt} -o jsonpath='{.subsets[*].addresses[*].ip}')
[[ -n ${ep} ]] && break
sleep 2
i=$((i+1))
done
done
- name: Run E2E Tests
run: |
# Nothing specific to webhook here it just that repo is private in that org and that's what we want to test
export TEST_GITHUB_PRIVATE_TASK_URL="https://github.com/openshift-pipelines/pipelines-as-code-e2e-tests-private/blob/main/remote_task.yaml"
export TEST_GITHUB_PRIVATE_TASK_NAME="task-remote"
export TEST_BITBUCKET_CLOUD_API_URL=https://api.bitbucket.org/2.0
export TEST_BITBUCKET_CLOUD_E2E_REPOSITORY=cboudjna/pac-e2e-tests
export TEST_BITBUCKET_CLOUD_TOKEN=${{ secrets.BITBUCKET_CLOUD_TOKEN }}
export TEST_BITBUCKET_CLOUD_USER=cboudjna
export TEST_EL_URL="http://${CONTROLLER_DOMAIN_URL}"
export TEST_EL_WEBHOOK_SECRET="${{ secrets.WEBHOOK_SECRET }}"
export TEST_GITEA_API_URL="http://localhost:3000"
## This is the URL used to forward requests from the webhook to the paac controller
## badly named!
export TEST_GITEA_SMEEURL="${{ secrets.TEST_GITEA_SMEEURL }}"
export TEST_GITEA_USERNAME=pac
export TEST_GITEA_PASSWORD=pac
export TEST_GITEA_REPO_OWNER=pac/pac
export TEST_GITHUB_API_URL=api.github.com
export TEST_GITHUB_REPO_INSTALLATION_ID="${{ secrets.INSTALLATION_ID }}"
export TEST_GITHUB_REPO_OWNER_GITHUBAPP=openshift-pipelines/pipelines-as-code-e2e-tests
export TEST_GITHUB_REPO_OWNER_WEBHOOK=openshift-pipelines/pipelines-as-code-e2e-tests-webhook
export TEST_GITHUB_TOKEN="${{ secrets.GH_APPS_TOKEN }}"
export TEST_GITLAB_API_URL="https://gitlab.com"
export TEST_GITLAB_PROJECT_ID="34405323"
export TEST_GITLAB_TOKEN=${{ secrets.GITLAB_TOKEN }}
# https://gitlab.com/gitlab-com/alliances/ibm-red-hat/sandbox/openshift-pipelines/pac-e2e-tests
export GO_TEST_FLAGS="-v -race -failfast"
export NIGHTLY_E2E_TEST="true"
make test-e2e
- name: Install wine
run: |
sudo apt-get update
sudo apt-get install -y --install-recommends wine
- name: Compile tkn-pac for windows
run: |
mkdir -p bin/
make windows
- name: Run a simple tkn-pac on wine test
run: |
set -e
wine ./bin/tkn-pac.exe ls -A
- name: Compile tkn-pac for linux
run: |
mkdir -p bin/
make bin/tkn-pac
- name: Run a simple tkn-pac test
run: |
set -e
./bin/tkn-pac ls -A
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Collect logs
if: ${{ always() }}
run: |
mkdir -p /tmp/logs
kind export logs /tmp/logs
[[ -d /tmp/gosmee-replay ]] && cp -a /tmp/gosmee-replay /tmp/logs/
kubectl get pipelineruns -A -o yaml > /tmp/logs/pac-pipelineruns.yaml
kubectl get repositories.pipelinesascode.tekton.dev -A -o yaml > /tmp/logs/pac-repositories.yaml
kubectl get configmap -n pipelines-as-code -o yaml > /tmp/logs/pac-configmap
kubectl get events -A > /tmp/logs/events
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: logs
path: /tmp/logs
- name: Report Status
if: ${{ always() }}
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}