This repository is currently being migrated. It's locked while the migration is in progress.
-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (88 loc) · 3.84 KB
/
test-index-image.yml
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
name: Test index image
on:
push:
pull_request:
jobs:
find-bundle-change:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check if there's a bundle change
run: bash scripts/find-changed-bundle.sh
build-and-test-image:
needs: find-bundle-change
runs-on: ubuntu-latest
name: Build and test index image
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Find changed bundle and set variables
run: |
source scripts/find-changed-bundle.sh
echo "BUNDLE_VERSION=$BUNDLE_VER" >> $GITHUB_ENV
- name: Set bundle image name
run: echo "BUNDLE_IMAGE_NAME=ghcr.io/storageos/operator-bundle" >> $GITHUB_ENV
- name: Set versioned bundle image with tag
run: echo "BUNDLE_IMAGE=${{ env.BUNDLE_IMAGE_NAME }}:v${{ env.BUNDLE_VERSION }}" >> $GITHUB_ENV
- name: Set test bundle image
run: echo "TEST_BUNDLE_IMAGE=${{ env.BUNDLE_IMAGE_NAME }}:${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Set index image name
run: echo "INDEX_IMAGE=ghcr.io/storageos/operator-index:${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Build bundle image
run: |
make bundle-build
docker tag ${{ env.BUNDLE_IMAGE }} ${{ env.TEST_BUNDLE_IMAGE }}
docker push ${{ env.TEST_BUNDLE_IMAGE }}
- name: Build catalog index image
run: |
make index-build INDEX_BUNDLES=${{ env.TEST_BUNDLE_IMAGE }} INDEX_IMAGE=${{ env.INDEX_IMAGE }}
docker push ${{ env.INDEX_IMAGE }}
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
version: v0.11.1
cluster_name: kind
- name: Wait for k8s node to be ready
run: |
for i in {1..60}; do
kubectl get nodes -o 'jsonpath="{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}"' | grep "Ready=True" \
&& break || sleep 2
done
- name: Install OLM
run: |
RELEASE_VERSION=v1.8.1
sudo curl -Lo /usr/local/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64
sudo chmod +x /usr/local/bin/operator-sdk
operator-sdk olm install
- name: Load bundle and index image in kind cluster
run: |
kind load docker-image ${{ env.TEST_BUNDLE_IMAGE}}
kind load docker-image ${{ env.INDEX_IMAGE }}
- name: Install kubectl-operator plugin
run: |
cd /tmp
curl -Lo operator.tar.gz https://github.com/operator-framework/kubectl-operator/releases/download/v0.0.6/kubectl-operator_v0.0.6_linux_amd64.tar.gz
tar -zxvf operator.tar.gz
sudo mv kubectl-operator /usr/local/bin/
- name: Install catalog
run: |
make yq
./bin/yq w -i examples/catalogsource.yaml spec.image ${{ env.INDEX_IMAGE }}
kubectl apply -f examples/catalogsource.yaml
until kubectl get pods | grep storageos-catalog | grep -q Running; do sleep 5; done
kubectl operator catalog list -A
kubectl operator list-available -c storageos-catalog
until kubectl get packagemanifests.packages.operators.coreos.com | grep -q storageos2; do sleep 3; done
kubectl get all
- name: Install operator
run: |
kubectl operator install storageos2 --create-operator-group
- name: Wait for the operator to be installed successfully
run: |
until kubectl operator list | grep storageos2 | grep -q AtLatestKnown; do sleep 3; done
kubectl operator list -A