Skip to content

Conversation

cvicentiu
Copy link
Member

@cvicentiu cvicentiu commented Feb 10, 2025

This pull request cleans up and documents a lot of variables in master-libvirt.

Additionally it refactors bash_lib to handle URL archive & logic instead of having it coded into the master.cfg.

@cvicentiu cvicentiu force-pushed the refactor_master_libvirt branch 3 times, most recently from 7ae4362 to 74c34d8 Compare February 12, 2025 07:03
@cvicentiu cvicentiu changed the title WIP: Refactor master libvirt Cleanup master libvirt Feb 12, 2025
@cvicentiu cvicentiu requested a review from fauust February 12, 2025 07:06
@cvicentiu cvicentiu changed the title Cleanup master libvirt MDBF-960: Document environment variables in master-libvirt Feb 12, 2025
@cvicentiu cvicentiu force-pushed the refactor_master_libvirt branch from 74c34d8 to 86d1a4c Compare February 12, 2025 07:22
@cvicentiu cvicentiu marked this pull request as ready for review February 12, 2025 07:26
@cvicentiu
Copy link
Member Author

@fauust I need your eyes on the bash_lib.sh changes. I'm no expert in bash writing, but I have tested that the URLs are generated properly on almalinux8.

@cvicentiu
Copy link
Member Author

@RazvanLiviuVarzaru I need your review on the other code changes. Again, all these were tested locally and I don't expect surprises, but I may have missed something.

Copy link
Collaborator

@fauust fauust left a comment

Choose a reason for hiding this comment

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

There are a lot of changes so this is quite complex to review without testing.
Your key is not deployed on VMs but I will deploy them today and explain you how you can manually test your changes on the DEV platform.

For now, error is:

INFO: setup MariaDB repository for 11.7 branch
+ command -v wget
+ local baseurl
+ wget -q --spider https://rpm.mariadb.org/11.7/almalinux9-almalinux9-amd64
+ wget -q --spider https://archive.mariadb.org/mariadb-11.7/yum//almalinux9-almalinux9-amd64
./bash_lib.sh: line 372: baseurl: unbound variable

Almalinux 9 AMD64 running :
./rpm-upgrade.sh https://buildbot.mariadb.org/#/builders/612/builds/1817.

@fauust
Copy link
Collaborator

fauust commented Feb 12, 2025

Ok, your keys are deployed (or currently being deployed on DEV), here is how to test those scripts:

1/ start a VM on the host, example with AMD64 and almalinux 9:

ssh ro-apexis-bbw03-x64 
faust@ro-apexis-bbw03-x64:~$ sudo virsh list --all
 Id    Name                                                  State
-----------------------------------------------------------------------
 1     bb-rhel9-docker                                       running
 260   bb-ro-apexis-bbw03-x64-openeuler-2403-amd64_install   running
 -     bb-ro-apexis-bbw03-x64-almalinux-8-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-almalinux-9-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-centos-7-amd64                 shut off
 -     bb-ro-apexis-bbw03-x64-centos-stream9-amd64           shut off
 -     bb-ro-apexis-bbw03-x64-debian-10-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-11-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-12-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-sid-amd64               shut off
 -     bb-ro-apexis-bbw03-x64-fedora-38-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-39-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-40-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-41-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-15-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-1505-amd64            shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-1506-amd64            shut off
 -     bb-ro-apexis-bbw03-x64-rhel-8-amd64                   shut off
 -     bb-ro-apexis-bbw03-x64-rhel-9-amd64                   shut off
 -     bb-ro-apexis-bbw03-x64-rockylinux-8-amd64             shut off
 -     bb-ro-apexis-bbw03-x64-rockylinux-9-amd64             shut off
 -     bb-ro-apexis-bbw03-x64-sles-1506-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-1804-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2004-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2204-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2404-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2410-amd64              shut off

faust@ro-apexis-bbw03-x64:~$ sudo virsh start bb-ro-apexis-bbw03-x64-almalinux-9-amd64

2/ find the VM IP:

faust@ro-apexis-bbw03-x64:~$ sudo virsh net-dhcp-leases default 
 Expiry Time           MAC address         Protocol   IP address           Hostname                                      Client ID or DUID
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2025-02-12 15:57:57   52:54:00:6f:7f:d8   ipv4       192.168.122.244/24   bb-ro-apexis-bbw03-x64-almalinux-9-amd64      01:52:54:00:6f:7f:d8

3/ make sure your local ssh config contain something similar to:

host bb-vm
hostname 192.168.122.244
User buildbot
ProxyJump ro-apexis-bbw03-x64

4/ scp the scripts to the VM and run a BB build:

~/buildbot refactor_master_libvirt
.venv ❯ scp -r scripts/ bb-vm:
deb-install.sh                                                                       100% 5705    52.1KB/s   00:00    
docker-library-build.sh                                                              100% 5319    48.8KB/s   00:00    
pam-test.sh                                                                          100% 2289    21.5KB/s   00:00    
aix-build-and-test.sh                                                                100% 4896    35.6KB/s   00:00    
rpm-install.sh                                                                       100% 3206    30.1KB/s   00:00    
rpm-upgrade.sh                                                                       100% 8763    80.4KB/s   00:00    
deb-upgrade.sh                                                                       100% 7851    73.5KB/s   00:00    
docker-library-test.sh                                                               100%  637     6.0KB/s   00:00    
service-test.sh                                                                      100% 7331    69.4KB/s   00:00    
bb_package_rotation.sh                                                               100% 1488    14.1KB/s   00:00    
docker-library-manifest.sh                                                           100% 6322    46.4KB/s   00:00    
bash_lib.sh                                                                          100%   25KB 157.0KB/s   00:00    

~/buildbot refactor_master_libvirt 9s
.venv ❯ ssh bb-vm
[buildbot@bb-ro-apexis-bbw03-x64-almalinux-9-amd64 ~]$ cd scripts/
[buildbot@bb-ro-apexis-bbw03-x64-almalinux-9-amd64 scripts]$ ./rpm-upgrade.sh https://buildbot.mariadb.org/#/builders/612/builds/1817

5/ power off the VM (sudo poweroff) when happy. The VM will be replaced by the original clean image.

@cvicentiu cvicentiu force-pushed the refactor_master_libvirt branch from 86d1a4c to 0042bfc Compare February 13, 2025 05:30
@cvicentiu
Copy link
Member Author

There are a lot of changes so this is quite complex to review without testing. Your key is not deployed on VMs but I will deploy them today and explain you how you can manually test your changes on the DEV platform.

For now, error is:

INFO: setup MariaDB repository for 11.7 branch
+ command -v wget
+ local baseurl
+ wget -q --spider https://rpm.mariadb.org/11.7/almalinux9-almalinux9-amd64
+ wget -q --spider https://archive.mariadb.org/mariadb-11.7/yum//almalinux9-almalinux9-amd64
./bash_lib.sh: line 372: baseurl: unbound variable

Fixed this issue.

@RazvanLiviuVarzaru
Copy link
Collaborator

Ok, your keys are deployed (or currently being deployed on DEV), here is how to test those scripts:

1/ start a VM on the host, example with AMD64 and almalinux 9:

❯ ssh ro-apexis-bbw03-x64 
faust@ro-apexis-bbw03-x64:~$ sudo virsh list --all
 Id    Name                                                  State
-----------------------------------------------------------------------
 1     bb-rhel9-docker                                       running
 260   bb-ro-apexis-bbw03-x64-openeuler-2403-amd64_install   running
 -     bb-ro-apexis-bbw03-x64-almalinux-8-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-almalinux-9-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-centos-7-amd64                 shut off
 -     bb-ro-apexis-bbw03-x64-centos-stream9-amd64           shut off
 -     bb-ro-apexis-bbw03-x64-debian-10-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-11-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-12-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-debian-sid-amd64               shut off
 -     bb-ro-apexis-bbw03-x64-fedora-38-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-39-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-40-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-fedora-41-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-15-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-1505-amd64            shut off
 -     bb-ro-apexis-bbw03-x64-opensuse-1506-amd64            shut off
 -     bb-ro-apexis-bbw03-x64-rhel-8-amd64                   shut off
 -     bb-ro-apexis-bbw03-x64-rhel-9-amd64                   shut off
 -     bb-ro-apexis-bbw03-x64-rockylinux-8-amd64             shut off
 -     bb-ro-apexis-bbw03-x64-rockylinux-9-amd64             shut off
 -     bb-ro-apexis-bbw03-x64-sles-1506-amd64                shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-1804-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2004-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2204-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2404-amd64              shut off
 -     bb-ro-apexis-bbw03-x64-ubuntu-2410-amd64              shut off

faust@ro-apexis-bbw03-x64:~$ sudo virsh start bb-ro-apexis-bbw03-x64-almalinux-9-amd64

2/ find the VM IP:

faust@ro-apexis-bbw03-x64:~$ sudo virsh net-dhcp-leases default 
 Expiry Time           MAC address         Protocol   IP address           Hostname                                      Client ID or DUID
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2025-02-12 15:57:57   52:54:00:6f:7f:d8   ipv4       192.168.122.244/24   bb-ro-apexis-bbw03-x64-almalinux-9-amd64      01:52:54:00:6f:7f:d8

3/ make sure your local ssh config contain something similar to:

host bb-vm
hostname 192.168.122.244
User buildbot
ProxyJump ro-apexis-bbw03-x64

4/ scp the scripts to the VM and run a BB build:

~/buildbot refactor_master_libvirt
.venv ❯ scp -r scripts/ bb-vm:
deb-install.sh                                                                       100% 5705    52.1KB/s   00:00    
docker-library-build.sh                                                              100% 5319    48.8KB/s   00:00    
pam-test.sh                                                                          100% 2289    21.5KB/s   00:00    
aix-build-and-test.sh                                                                100% 4896    35.6KB/s   00:00    
rpm-install.sh                                                                       100% 3206    30.1KB/s   00:00    
rpm-upgrade.sh                                                                       100% 8763    80.4KB/s   00:00    
deb-upgrade.sh                                                                       100% 7851    73.5KB/s   00:00    
docker-library-test.sh                                                               100%  637     6.0KB/s   00:00    
service-test.sh                                                                      100% 7331    69.4KB/s   00:00    
bb_package_rotation.sh                                                               100% 1488    14.1KB/s   00:00    
docker-library-manifest.sh                                                           100% 6322    46.4KB/s   00:00    
bash_lib.sh                                                                          100%   25KB 157.0KB/s   00:00    

~/buildbot refactor_master_libvirt 9s
.venv ❯ ssh bb-vm
[buildbot@bb-ro-apexis-bbw03-x64-almalinux-9-amd64 ~]$ cd scripts/
[buildbot@bb-ro-apexis-bbw03-x64-almalinux-9-amd64 scripts]$ ./rpm-upgrade.sh https://buildbot.mariadb.org/#/builders/612/builds/1817

5/ power off the VM (sudo poweroff) when happy. The VM will be replaced by the original clean image.

@fauust Don't we need buildbot key-pair? It doesn't work for me.

"dist_name": os_name,
"version_name": OS_INFO[os_info_name]["version_name"],
"arch": build_arch,
"arch": platform,
Copy link
Collaborator

@RazvanLiviuVarzaru RazvanLiviuVarzaru Feb 20, 2025

Choose a reason for hiding this comment

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

@cvicentiu We need to test on Dev if a re-build is causing a re-calculation of the "arch" property.
My guess is Yes, but if "arch" is not updated on re-build then we end up with an incompatible change with the scripts.
We need to be sure that we can re-build runs at least for a couple of days in the past.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be logical for properties to be recomputed, but yes, I agree, we should check this.

Copy link
Collaborator

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 10, 2025

Choose a reason for hiding this comment

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

I tested this now, the properties are re-computed on rebuild but there are 2 conditions for a production release:

https://buildbot.dev.mariadb.org/#/builders/231/builds/41
arch: "almalinux8-aarch64"

re-run: https://buildbot.dev.mariadb.org/#/builders/231/builds/42
arch: "aarch64"
  1. After this patch is merged to Main, we need to immediately deploy the buildbot configuration changes to PROD and restart master-libvirt
  2. No libvirt builders running at the time of the merge to Main

Why?

  • the worker is downloading the script from the main branch
  • bash_lib changes are incompatible with the current buildbot configuration so both pieces (script,bb config) need to be deployed together

@RazvanLiviuVarzaru
Copy link
Collaborator

RazvanLiviuVarzaru commented Mar 10, 2025

There are a lot of changes so this is quite complex to review without testing. Your key is not deployed on VMs but I will deploy them today and explain you how you can manually test your changes on the DEV platform.

For now, error is:

INFO: setup MariaDB repository for 11.7 branch
+ command -v wget
+ local baseurl
+ wget -q --spider https://rpm.mariadb.org/11.7/almalinux9-almalinux9-amd64
+ wget -q --spider https://archive.mariadb.org/mariadb-11.7/yum//almalinux9-almalinux9-amd64
./bash_lib.sh: line 372: baseurl: unbound variable

Almalinux 9 AMD64 running : ./rpm-upgrade.sh https://buildbot.mariadb.org/#/builders/612/builds/1817.

@cvicentiu @fauust
this cannot be tested with ./rpm-upgrade https://#build#
because the "arch" property from any completed build is not the correct one for this patch.

I will test this PR on VM's by replacing "arch" value from the build instance with what will result from the changes in this patch. Will post the results soon.

@RazvanLiviuVarzaru
Copy link
Collaborator

RazvanLiviuVarzaru commented Mar 10, 2025

There are a lot of changes so this is quite complex to review without testing. Your key is not deployed on VMs but I will deploy them today and explain you how you can manually test your changes on the DEV platform.
For now, error is:

INFO: setup MariaDB repository for 11.7 branch
+ command -v wget
+ local baseurl
+ wget -q --spider https://rpm.mariadb.org/11.7/almalinux9-almalinux9-amd64
+ wget -q --spider https://archive.mariadb.org/mariadb-11.7/yum//almalinux9-almalinux9-amd64
./bash_lib.sh: line 372: baseurl: unbound variable

Almalinux 9 AMD64 running : ./rpm-upgrade.sh https://buildbot.mariadb.org/#/builders/612/builds/1817.

@cvicentiu @fauust this cannot be tested with ./rpm-upgrade https://#build# because the "arch" property from any completed build is not the correct one for this patch.

I will test this PR on VM's by replacing "arch" value from the build instance with what will result from the changes in this patch. Will post the results soon.

Scripts OK!
Tested major / minor upgrades. The patch doesn't touch the Install code path nor debian builders.

Major-Upgrade:
https://buildbot.mariadb.org/#/builders/701/builds/1254

+ rpm_setup_mariadb_mirror 11.3 https://rpm.mariadb.org/11.3/fedora39-amd64 https://archive.mariadb.org/mariadb-11.3/yum//fedora39-amd64
+ set -u
+ [[ -n 11.3 ]]
+ [[ -n https://rpm.mariadb.org/11.3/fedora39-amd64 ]]
+ [[ -n https://archive.mariadb.org/mariadb-11.3/yum//fedora39-amd64 ]]
+ local branch=11.3
+ local mirror_url=https://rpm.mariadb.org/11.3/fedora39-amd64
+ local archive_url=https://archive.mariadb.org/mariadb-11.3/yum//fedora39-amd64
+ bb_log_info 'setup MariaDB repository for 11.3 branch'

...
...
...

+ diff -u /tmp/version.old /tmp/version.new
--- /tmp/version.old	2025-03-10 13:50:16.007807908 +0000
+++ /tmp/version.new	2025-03-10 13:50:47.392270865 +0000
@@ -1 +1 @@
-11.3.2
+11.4.6
+ res=0
+ errors=
++ comm -23 ./engines.old ./engines.new
++ wc -l
+ engines_disappeared_or_changed=0
+ set +x
[buildbot@bb-ro-apexis-bbw03-x64-fedora-39-amd64 scripts]$ echo $?
0


Minor-Upgrade-All
https://buildbot.mariadb.org/#/builders/735/builds/211


+ rpm_setup_mariadb_mirror 10.11 https://rpm.mariadb.org/10.11/opensuse156-amd64 https://archive.mariadb.org/mariadb-10.11/yum//opensuse156-amd64
+ set -u
+ [[ -n 10.11 ]]
+ [[ -n https://rpm.mariadb.org/10.11/opensuse156-amd64 ]]
+ [[ -n https://archive.mariadb.org/mariadb-10.11/yum//opensuse156-amd64 ]]
+ local branch=10.11
+ local mirror_url=https://rpm.mariadb.org/10.11/opensuse156-amd64
+ local archive_url=https://archive.mariadb.org/mariadb-10.11/yum//opensuse156-amd64
+ bb_log_info 'setup MariaDB repository for 10.11 branch'

...
...
...

INFO: Capabilities OK
+ echo 'Comparing old and new plugins'
Comparing old and new plugins
+ grep -i columnstore ./plugins.old.cmp
+ grep -i columnstore ./plugins.new.cmp
+ diff -u /tmp/columnstore.old /tmp/columnstore.new
+ diff -u ./plugins.old.cmp ./plugins.new.cmp
+ bb_log_info 'Plugins OK'
+ set +x
INFO: Plugins OK
+ '[' -n '' ']'
+ exit 0
buildbot@bb-ro-apexis-bbw03-x64-opensuse-1506-amd64:~/buildbot/scripts>

@cvicentiu cvicentiu force-pushed the refactor_master_libvirt branch 2 times, most recently from 6bc982e to 526d8eb Compare April 16, 2025 09:19
…scripts

The arch environment variable was overused to generate proper repository
paths, when the whole information was already available as part of
dist_name and version_name.

This patch moves the URL transformation logic within bash_lib.sh,
allowing master_libvirt to pass in fewer environment variables.
* Eliminate statically hardcoding environment variables such as
  tarballnum
* DEVELOPMENT_BRANCH is not used / maintained anymore, so should be
  dropped.
@cvicentiu cvicentiu force-pushed the refactor_master_libvirt branch from 526d8eb to 86aef1c Compare April 16, 2025 09:20
@cvicentiu
Copy link
Member Author

@RazvanLiviuVarzaru Ready to be merged to dev. You mentioned the need to push some changes together to prevent breakages, so I'll let you merge this when you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants