generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 7
130 lines (119 loc) · 4.54 KB
/
_integration-tests.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
name: integration tests
on:
workflow_call:
inputs:
image:
description: 'The image to test'
required: true
type: string
trigger_btp:
description: 'Trigger BTP integration test'
required: false
type: boolean
default: false
jobs:
operator-integration-test:
if: ${{ !startsWith(github.event_name, 'pull_request') || github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/create-k3d-cluster
- name: run test
run: |
make -C components/operator deploy
make -C tests/operator test
env:
IMG: ${{ inputs.image }}
- if: ${{ always() }}
uses: ./.github/actions/collect-cluster-info
gardener-integration-test:
if: ${{ !startsWith(github.event_name, 'pull_request') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- name: provision gardener
run: |
echo "$GARDENER_SA" > $GARDENER_SA_PATH
echo "Used kubeconfig file has $(sed -n '$=' $GARDENER_SA_PATH) lines"
make -C hack provision-gardener
env:
GARDENER_SECRET_NAME: ${{ secrets.GARDENER_SECRET_NAME }}
GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }}
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
GARDENER_SA: ${{ secrets.GARDENER_SA }}
- name: run test
run: |
make -C components/operator deploy
make -C tests/operator test
env:
IMG: ${{ inputs.image }}
- name: deprovision gardener
if: ${{ always() }}
run: make -C hack deprovision-gardener
env:
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
btp-integration-tests:
if: ${{ inputs.trigger_btp }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests/btp/hack
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-kyma
with:
path: "tests/btp/bin"
- name: Create btp account with kyma enable
run: |
. ./set-tf-envs.sh
terraform -chdir=../tf init
terraform -chdir=../tf apply -auto-approve
echo "SUBACC_ID=$(terraform -chdir=../tf output -raw subaccount_id)" >> $GITHUB_ENV
env:
BTP_ENV: ${{ secrets.BTP_INTEGRATION_TEST }}
TF_VAR_BTP_NEW_SUBACCOUNT_NAME: docker-registry-test-${{ github.sha }}-${{ github.run_attempt }}
- name: Generate access
run: |
sudo ln -sf bash /bin/sh
. ./set-tf-envs.sh
mkdir -p tmp
CLUSTERROLE=cluster-admin make service-account-kubeconfig
env:
BTP_ENV: ${{ secrets.BTP_INTEGRATION_TEST }}
- name: Add bindings
run: |
. ./set-tf-envs.sh
KUBECONFIG=tmp/sa-kubeconfig.yaml BTP_PROVIDER_SUBACCOUNT_ID=$TF_VAR_BTP_PROVIDER_SUBACCOUNT_ID make share-sm-service-operator-access
KUBECONFIG=tmp/sa-kubeconfig.yaml make create-object-store-reference
make -C ../../../components/operator/ render-manifest
KUBECONFIG=tmp/sa-kubeconfig.yaml OPERATOR_MANIFEST=../../../dockerregistry-operator.yaml make enable_docker_registry
env:
BTP_ENV: ${{ secrets.BTP_INTEGRATION_TEST }}
IMG: ${{ inputs.image }}
- name: Test if docker registry is working
shell: bash
run: |
KUBECONFIG=tmp/sa-kubeconfig.yaml make docker_registry_login
KUBECONFIG=tmp/sa-kubeconfig.yaml make docker_push_simple_app
KUBECONFIG=tmp/sa-kubeconfig.yaml make deploy_simple_app
- uses: ./.github/actions/setup-btp
if: always()
with:
path: "tests/btp/bin"
- name: Cleanup Kyma
shell: bash
run: |
KUBECONFIG=tmp/sa-kubeconfig.yaml make cleanup-kyma
- name: Force delete btp account
if: always()
run: |
. ./set-tf-envs.sh
../bin/btp login --url $TF_VAR_BTP_BACKEND_URL --user $TF_VAR_BTP_BOT_USER --password $TF_VAR_BTP_BOT_PASSWORD --idp $TF_VAR_BTP_CUSTOM_IAS_TENANT --subdomain $TF_VAR_BTP_GLOBAL_ACCOUNT
../bin/btp delete accounts/subaccount ${SUBACC_ID} --global-account ${TF_VAR_BTP_GLOBAL_ACCOUNT} --force-delete true --confirm true
env:
BTP_ENV: ${{ secrets.BTP_INTEGRATION_TEST }}