| # --------------------------------------------------------------------------- |
| # 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: |
| - 'proposals/**' |
| - '**.adoc' |
| - 'KEYS' |
| - 'LICENSE' |
| - 'NOTICE' |
| push: |
| branches: |
| - main |
| - "release-*" |
| paths-ignore: |
| - 'proposals/**' |
| - '**.adoc' |
| - 'KEYS' |
| - 'LICENSE' |
| - 'NOTICE' |
| |
| jobs: |
| build: |
| |
| 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.13.x |
| - name: Set up operator-sdk |
| run: | |
| curl -L https://github.com/operator-framework/operator-sdk/releases/download/v1.3.0/operator-sdk_linux_amd64 -o operator-sdk |
| chmod +x operator-sdk |
| sudo mv operator-sdk /usr/local/bin/ |
| - 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: |
| node_image: kindest/node:v1.20.2 |
| - 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 LOCAL_IMAGE=$KIND_REGISTRY/apache/camel-k |
| echo "LOCAL_IMAGE=${LOCAL_IMAGE}:$(make get-version)" >> $GITHUB_ENV |
| make IMAGE_NAME=${LOCAL_IMAGE} 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 }}") |
| |
| |
| # CSV the patch to force OLM upgrade |
| export RELEASE_VERSION=$(make get-version | grep -Po "\d.\d.\d") |
| cat <<EOF > config/manifests/patch.yml |
| apiVersion: operators.coreos.com/v1alpha1 |
| kind: ClusterServiceVersion |
| metadata: |
| namespace: placeholder |
| name: camel-k.v$(make get-last-released-version) |
| annotations: |
| olm.skipRange: ">=1.0.0 <${RELEASE_VERSION}" |
| EOF |
| |
| echo "Patching CSV with" |
| cat config/manifests/patch.yml |
| $(cd config/manifests && kustomize edit add patch patch.yml) |
| |
| export LOCAL_IMAGE_BUNDLE=$KIND_REGISTRY/apache/camel-k-bundle:$(make get-version) |
| echo "LOCAL_IMAGE_BUNDLE=${LOCAL_IMAGE_BUNDLE}" >> $GITHUB_ENV |
| make bundle-build METADATA_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} BUNDLE_METADATA_OPTS="--channels stable" |
| docker push ${LOCAL_IMAGE_BUNDLE} |
| - name: Create new index image |
| run: | |
| export LOCAL_IIB=$KIND_REGISTRY/apache/camel-k-iib:$(make get-version) |
| echo "LOCAL_IIB=${LOCAL_IIB}" >> $GITHUB_ENV |
| opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -u 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 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=$KIND_REGISTRY/apache/camel-k:$(make get-version) |
| |
| # Then run integration tests |
| make test-upgrade |