Add Upgrade testing workflow #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DSP Install and Upgrade | |
on: | |
workflow_dispatch: | |
inputs: | |
released-version: | |
default: 'v1.y.y' | |
description: 'Most recently released DSP version' | |
required: true | |
candidate-version: | |
default: 'v1.x.x' | |
description: 'Candidate version for upgrade' | |
required: true | |
pull_request: | |
branches: | |
- main | |
- 'release-*' | |
paths-ignore: | |
- 'docs/**' | |
- '**.adoc' | |
- '**.md' | |
- 'LICENSE' | |
concurrency: | |
group: ${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
kubernetes-olm-upgrade: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 60 | |
env: | |
OLM_VERSION: v0.24.0 | |
VERSION: "v0.0.0-ghaction" # Need to supply some semver version for bundle to be properly generated | |
CATALOG_BASE_IMG: "registry.access.redhat.com/redhat/community-operator-index:v4.13" | |
steps: | |
- name: Cleanup | |
run: | | |
ls -lart | |
echo "Initial status:" | |
df -h | |
echo "Cleaning up resources:" | |
sudo swapoff -a | |
sudo rm -f /swapfile | |
sudo apt clean | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
docker rmi $(docker image ls -aq) | |
echo "Final status:" | |
df -h | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetching also previous commits to get tags | |
- name: Set Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: v1.19 | |
- name: Set up gotestfmt | |
uses: gotesttools/gotestfmt-action@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup and start KinD cluster | |
uses: ./.github/actions/kind | |
- name: Install OLM | |
run: | | |
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/crds.yaml | |
# wait for a while to be sure CRDs are installed | |
sleep 1 | |
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/olm.yaml | |
echo Wait for default CatalogSource to start | |
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s | |
env: | |
CATALOG_SOURCE_NAME: "operatorhubio-catalog" | |
CATALOG_SOURCE_NAMESPACE: "olm" | |
- name: Create openshift-operator namespace and OperatorGroup | |
run: | | |
kubectl create namespace openshift-operators | |
kubectl create -f .github/resources-olm-install/operatorgroup.yaml | |
- name: Apply DeploymentConfig CRD | |
run: | | |
kubectl apply -f .github/resources-crds/deploymentconfig-crd.yaml | |
- name: Apply ImageStreams CRD | |
run: | | |
kubectl apply -f .github/resources-crds/imagestream-crd.yaml | |
- name: Apply BuildConfig CRD | |
run: | | |
kubectl apply -f .github/resources-crds/buildconfig-crd.yaml | |
- name: Apply ServiceMonitor CRD | |
run: | | |
kubectl apply -f .github/resources-crds/servicemonitor-crd.yaml | |
- name: Deploy latest released OpenDataHub operator from OLM | |
id: deploy | |
run: | | |
echo Deploying operator using Subscription | |
envsubst < .github/resources-olm-install/catalogsource.yaml > ${{ env.TEMP_DIR }}/catalogsource.yaml | |
envsubst < .github/resources-olm-install/subscription.yaml > ${{ env.TEMP_DIR }}/subscription.yaml | |
kubectl create -f ${{ env.TEMP_DIR }}/catalogsource.yaml | |
echo Wait for CatalogSource ${{ env.CATALOG_SOURCE_NAME }} to start | |
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=300s | |
kubectl create -f ${{ env.TEMP_DIR }}/subscription.yaml | |
echo Waiting for Subscription to be ready | |
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s | |
echo Waiting for Deployment to be ready | |
timeout 60 bash -c 'until [[ $(kubectl get deployment/opendatahub-operator-controller-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/opendatahub-operator-controller-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done' | |
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/opendatahub-operator-controller-manager --for=condition=Available=true --timeout=60s | |
env: | |
CATALOG_SOURCE_NAME: "odh-olm-test" | |
CATALOG_SOURCE_NAMESPACE: "olm" | |
SUBSCRIPTION_NAME: "opendatahub-operator" | |
SUBSCRIPTION_NAMESPACE: "openshift-operators" | |
- name: Create Namespace for DSPO | |
run: | | |
kubectl create namespace ${{ env.DSPO_NS }} | |
kubectl config set-context --current --namespace=${{ env.DSPO_NS }} | |
env: | |
DSPO_NS: data-science-pipelines-operator | |
- name: Prepare for Upgrade Testing | |
run: | | |
# Update the KfDef manifest with the latest released version | |
# Example: Update KfDef manifest to point to the latest released version | |
sed -i "s/main/${{ inputs.released-version }}/" ${{ github.workspace }}/.github/resources-kfdef/kfdef.yaml | |
working-directory: .github/resources-kfdef/ | |
- name: Print KfDef Manifest Contents | |
run: cat ${{ github.workspace }}/.github/resources-kfdef/kfdef.yaml | |
- name: Deploy DSPO KfDef | |
run: | | |
kubectl apply -f .github/resources-kfdef/kfdef.yaml | |
env: | |
DSPO_NS: "data-science-pipelines-operator" | |
- name: Deploy first DSP instance | |
run: | | |
kubectl create namespace ${{ env.DSPA_NS }} | |
cd ${{ env.WORKING_DIR }}/config/samples | |
kustomize build . | kubectl -n ${{ env.DSPA_NS }} apply -f - | |
env: | |
DSPA_NS: test-ds-project-1 | |
WORKING_DIR: ${{ github.workspace }} | |
- name: Prepare for Upgrade Testing | |
run: | | |
# Update the KfDef manifest with the candidate version | |
sed -i "s/main/${{ inputs.candidate-version }}/" ${{ github.workspace }}/.github/resources-kfdef/kfdef.yaml | |
working-directory: .github/resources-kfdef/ | |
- name: Print KfDef Manifest Contents | |
run: cat ${{ github.workspace }}/.github/resources-kfdef/kfdef.yaml | |
- name: Deploy KfDef Core for the candidate DSP Version | |
run: | | |
kubectl apply -f .github/resources-kfdef/kfdef.yaml -n ${{ env.DSPO_NS }} | |
env: | |
DSPO_NS: data-science-pipelines-operator | |
- name: Deploy a DSPA instance for the candidate DSP Version | |
run: | | |
kubectl create namespace ${{ env.DSPA_NS }} | |
cd ${{ github.workspace }}/config/samples | |
kustomize build . | kubectl -n ${{ env.DSPA_NS }} apply -f - | |
env: | |
DSPA_NS: test-ds-project-2 # Adjust the namespace as needed |