forked from apache/camel-k
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (145 loc) · 5.94 KB
/
upgrade.yml
File metadata and controls
160 lines (145 loc) · 5.94 KB
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
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
name: upgrade
on:
pull_request:
branches:
- main
- "release-*"
paths-ignore:
- 'docs/**'
- 'proposals/**'
- '**.adoc'
- '**.md'
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
push:
branches:
- main
- "release-*"
paths-ignore:
- 'docs/**'
- 'proposals/**'
- '**.adoc'
- '**.md'
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
upgrade:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cleanup
run: |
ls -lart
echo "Initial status:"
df -h
echo "Cleaning up resources:"
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
echo "Final status:"
df -h
- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
with:
version: "11"
- name: Set Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Set up opm tool
run: |
curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
chmod +x opm
sudo mv opm /usr/local/bin/
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1
with:
version: v0.11.0
node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- name: Info
run: |
kubectl cluster-info
kubectl describe nodes
- name: Install OLM
run: |
kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.17.0/crds.yaml
# wait for a while to be sure CRDs are installed
sleep 1
kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.17.0/olm.yaml
- name: Get Kamel CLI
run: |
export KAMEL_VERSION=$(make get-last-released-version)
curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz -o kamel.tar.gz
tar -zxf kamel.tar.gz
sudo mv kamel /usr/local/bin/
- name: Build Operator
run: |
echo "Build project"
export CUSTOM_IMAGE=${KIND_REGISTRY}/apache/camel-k
echo "LOCAL_IMAGE_NAME=${CUSTOM_IMAGE}" >> $GITHUB_ENV
echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
- name: Build Operator bundle
run: |
echo "Build Operator bundle"
# reinstall kustomize to be always on the same version
sudo rm $(which kustomize)
make kustomize
# replace image
$(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ env.LOCAL_IMAGE_NAME }}:${{ env.LOCAL_IMAGE_VERSION }}")
# Patch CSV with the 'replaces' field to define the upgrade graph
# Use sed as the manifest/bases file is not included in the kustomize config
BASE_VERSION=$(echo ${{ env.LOCAL_IMAGE_VERSION }} | grep -Po "\d.\d.\d")
sed -i "/ version: ${BASE_VERSION}/a \ \ replaces: camel-k-operator.v$(make get-last-released-version)" config/manifests/bases/camel-k.clusterserviceversion.yaml
export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
export LOCAL_IMAGE_BUNDLE=$KIND_REGISTRY/apache/camel-k-bundle:${{ env.LOCAL_IMAGE_VERSION }}
echo "LOCAL_IMAGE_BUNDLE=${LOCAL_IMAGE_BUNDLE}" >> $GITHUB_ENV
make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="stable" CHANNELS="stable"
docker push ${LOCAL_IMAGE_BUNDLE}
- name: Create new index image
run: |
export LOCAL_IIB=$KIND_REGISTRY/apache/camel-k-iib:${{ env.LOCAL_IMAGE_VERSION }}
echo "LOCAL_IIB=${LOCAL_IIB}" >> $GITHUB_ENV
opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -c docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
docker push ${LOCAL_IIB}
- name: Run IT
run: |
# Use the last released Kamel CLI
export RELEASED_KAMEL_BIN=/usr/local/bin/kamel
# Configure install options
export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
export KAMEL_INSTALL_REGISTRY_INSECURE=true
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
export CAMEL_K_NEW_IIB=${{ env.LOCAL_IIB }}
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# Then run integration tests
make test-upgrade