Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR1 - To install and upgrade noobaa version for running the tests #8517

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/upgrade-tests.yaml
shirady marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Upgrade Tests
on: [push, pull_request, workflow_dispatch]
shirady marked this conversation as resolved.
Show resolved Hide resolved

jobs:
upgrade-tests:
runs-on: ubuntu-latest
timeout-minutes: 90
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BRANCH_NAME: ${{ github.event.inputs.branch || 'master' }}

steps:
- name: Checkout noobaa-core (master/input branch)
uses: actions/checkout@v4
with:
repository: 'noobaa/noobaa-core'
path: 'noobaa-core'
ref: ${{ env.BRANCH_NAME }}

- name: Deploy minikube
run: |
cd ./noobaa-core
sudo bash ./.travis/deploy_minikube.sh

- name: Build noobaa
run: |
cd ./noobaa-core
make noobaa NOOBAA_TAG=noobaa-core:${{ env.BRANCH_NAME || 'master' }}

- name: Checkout noobaa-core (latest)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "latest" might be confusing - as it is according to the branch that was set in the input, right?

uses: actions/checkout@v4
with:
repository: 'noobaa/noobaa-core'
path: 'noobaa-core'

- name: Build noobaa (latest)
run: |
cd ./noobaa-core
make noobaa NOOBAA_TAG=noobaa-core:upgrade-tests
shirady marked this conversation as resolved.
Show resolved Hide resolved

- name: Checkout noobaa-operator
uses: actions/checkout@v4
with:
repository: 'noobaa/noobaa-operator'
path: 'noobaa-operator'

- name: Change settings for k8s and minikube
run: |
sudo mv /root/.kube /root/.minikube $HOME
sudo chown -R $USER $HOME/.kube $HOME/.minikube
sed "s/root/home\/$USER/g" $HOME/.kube/config > tmp; mv tmp $HOME/.kube/config

- name: Build operator
run: |
cd ./noobaa-operator
make all

- name: Install noobaa system (from master)
run: |
cd ./noobaa-operator
./build/_output/bin/noobaa-operator crd create
./build/_output/bin/noobaa-operator operator install
./build/_output/bin/noobaa-operator system create \
--db-resources='{ "limits": {"cpu": "200m","memory": "2G"}, "requests": {"cpu": "200m","memory": "2G"}}' \
--core-resources='{ "limits": {"cpu": "200m","memory": "1G"}, "requests": {"cpu": "200m","memory": "1G"}}' \
--endpoint-resources='{ "limits": {"cpu": "200m","memory": "1G"}, "requests": {"cpu": "200m","memory": "1G"}}' \
--noobaa-image='noobaa-core:${{ env.BRANCH_NAME || 'master' }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the step you wrote: "Install noobaa system (from master)" - did you mean master in the core repo, right? Then why --noobaa-image='noobaa-core:${{ env.BRANCH_NAME || 'master' }}'? I think it should be noobaa-core:upgrade-tests (which according to the steps represents "Build noobaa (latest)".
Are you sure the system should be installed in the latest version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also added pull request referece in latest build (in step 4) in my last commit, it would work I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the pull request reference as we don't need it I can see the latest code logs inside the upgrade tests pipeline, this proves that we checked out to latest code. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I still don't understand it - I think that the title should be updated "Install noobaa system (from master)" It is not from master as we passed --noobaa-image='noobaa-core:${{ env.BRANCH_NAME || 'master' }}'

./build/_output/bin/noobaa-operator status

- name: Wait for phase Ready in the backingstore pod
run: |
cd ./noobaa-operator
./.travis/number_of_pods_in_system.sh --pods 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we still need this.
In PR #7237 I mentioned that:

Run a script to wait until we have the backingstore pod (in k8s we cannot wait for a resource that doesn't exist (more information kubernetes/kubectl#1516, based on the change we did in noobaa/noobaa-operator#1063).

But it was on March 2023 and since that time I think the issue was closed with a solution that we can use.
Anyway, in version 4.19 the number of pods would probably change, so better avoid it if we can.

kubectl wait --for=condition=available backingstore/noobaa-default-backing-store --timeout=5m

- name: Upgrade noobaa to latest
run: |
cd ./noobaa-operator
OPERATOR_VERSION=$(go run cmd/version/main.go)
./build/_output/bin/noobaa-operator upgrade --noobaa-image='noobaa-core:upgrade-tests' --operator-image='noobaa/noobaa-operator:$OPERATOR_VERSION'

- name: Run Upgrade Tests
run: |
set -x
cd ./noobaa-core
make test-upgrade
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ test-external-pg-sanity: build-ssl-postgres
@$(call remove_docker_network)
.PHONY: test-external-pg-sanity

test-upgrade: tester
@echo "\033[1;34mRunning Upgrade Tests - after upgrading to latest\033[0m"
chmod +x ./src/test/system_tests/run_upgrade_tests.sh && ./src/test/system_tests/run_upgrade_tests.sh
.PHONY: test-upgrade

clean:
@echo Stopping and Deleting containers
@$(CONTAINER_ENGINE) ps -a | grep noobaa_ | awk '{print $1}' | xargs $(CONTAINER_ENGINE) stop &> /dev/null
Expand Down
2 changes: 2 additions & 0 deletions src/test/system_tests/run_upgrade_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Executing upgrade tests..."
# TODO
Loading