Skip to contentSkip to conversation

kdevops: small fixes

PATCH New [email protected] 1 participant 5 messages Feb 6, 2025

lore
Share & tools
lore
#0 lore raw

cover kdevops: small fixes

Last commit should fix CI permission errors like this one:

https://github.com/linux-kdevops/linux-mm-kpd/actions/runs/13187146801/job/36811867463

I think we'd need first to run make bringup to propage permissions or delete the folder/update permissions manually in the CI runners.

---
Daniel Gomez (4):
install_terraform: fix missing deps
linux-mirror: fix variable initialization
scripts: lib: rename KDEVOPS_WORKFLOW_FSTESTS
bringup_guestfs: ensure pool correct permissions

 .../roles/install_terraform/tasks/install-deps/debian/main.yml   | 9 +++++++++
 playbooks/roles/linux-mirror/defaults/main.yml                   | 2 ++
 scripts/bringup_guestfs.sh                                       | 9 +++++----
 scripts/lib.sh                                                   | 2 +-
 4 files changed, 17 insertions(+), 5 deletions(-)

---
base-commit: 4bffd17ac6a3ac757a26897a75ffa185d623a8e4
change-id: 20250206-small-fixes-ba71a39256dc

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>
#1 lore raw

PATCH 1/4 install_terraform: fix missing deps

From: Daniel Gomez <[email protected]>

In a freshed Debian Testing machine, Terraform can't be extracted because it requires zip to be present. Add a task to check Terraform packages before unpacking Terraform release.

Error:
"msg": "Failed to find handler for
\"/home/dagomez/.ansible/tmp/ansible-tmp-1738158342.0404465-41967-103098 632274351/terraform_1.2.3_linux_amd649158dhyg.zip\". Make sure the required command to extract the file is installed.\nCommand \"/usr/bin/tar\" could not handle archive: Unable to list files in the archive: /usr/bin/tar: This does not look like a tar archive\n/usr/bin/tar: Skipping to next header\n/usr/bin/tar: Exiting with failure status due to previous errors\n\nUnable to find required 'unzip' or 'zipinfo' binary in the path.\nCommand \"/usr/bin/tar\" could not handle archive: Unable to list files in the archive: xz:
(stdin): File format not recognized\n/usr/bin/tar: Child returned status 1\n/usr/bin/tar: Error is not recoverable: exiting now\n\nUnable to find required 'unzip' or 'unzip' binary in the path.\nCommand \"/usr/bin/tar\" could not handle archive: Unable to list files in the
archive: zstd: /*stdin*\\: unsupported format \n/usr/bin/tar: Child returned status 1\n/usr/bin/tar: Error is not recoverable: exiting now\n\nCommand \"/usr/bin/tar\" could not handle archive: Unable to list files in the archive: bzip2: (stdin) is not a bzip2 file.\n/usr/bin/tar:
Child returned status 2\n/usr/bin/tar: Error is not recoverable: exiting now\n"
}

---
 .../roles/install_terraform/tasks/install-deps/debian/main.yml   | 9 +++++++++
 1 file changed, 9 insertions(+)
playbooks/roles/install_terraform/tasks/install-deps/debian/main.yml +9 -0
index 3397f403cbf53254c0ac0d8ff0468512eaf0f758..f7753f8667d950cf7d7d2b5ccbc0a89f9b882a69 100644
@@ -6,6 +6,15 @@
   failed_when: terraform_present.rc != 0 and terraform_present.rc != 1
   tags: [ 'terraform', 'verify' ]
 
+- name: Install Terraform Dependencies
+  become: true
+  become_method: sudo
+  ansible.builtin.apt:
+    name:
+      - unzip
+    state: present
+    update_cache: true
+
 - name: Download Terraform from the latest release and install locally
   become: yes
   become_method: sudo
Signature · 1 line
2.47.2
#2 lore raw

PATCH 2/4 linux-mirror: fix variable initialization

In reply to [email protected]

From: Daniel Gomez <[email protected]>

Fixes error:
TASK [linux-mirror : Import optional extra_args file]
ok: [localhost] => (item=/media/tarkir/dagomez/src/linux-kdevops/kdevops/extra_vars.yaml)

TASK [linux-mirror : Fail if linux_mirror_nfs is enabled but user is not root]
fatal: [localhost]: FAILED! => {}

MSG:

The conditional check 'linux_mirror_nfs | bool' failed. The error
was: error while evaluating conditional (linux_mirror_nfs | bool):
'linux_mirror_nfs' is undefined

The error appears to be in '/media/tarkir/dagomez/src/linux-kdevops/kdevops/playbooks/roles/linux-m irror/tasks/main.yml': line 19, column 3, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Fail if linux_mirror_nfs is enabled but user is not root ^ here

---
 playbooks/roles/linux-mirror/defaults/main.yml | 2 ++
 1 file changed, 2 insertions(+)
playbooks/roles/linux-mirror/defaults/main.yml +2 -0
index 2839068c1244395fa392392f6f64ac616353a354..c95342591090b405c3b5ca02cedc27917b3e942f 100644
@@ -23,3 +23,5 @@ mirror_stable_url: "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
 mirror_torvalds_url: "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
 
 install_only_git_daemon: false
+
+linux_mirror_nfs: False
Signature · 1 line
2.47.2
#3 lore raw

PATCH 3/4 scripts: lib: rename KDEVOPS_WORKFLOW_FSTESTS

In reply to [email protected]

From: Daniel Gomez <[email protected]>

kdevops variable was renamed and this was silently failing. Make sure the proper workflow variable is checked but only if defined/set to avoid 'unbound variable' issue.

---
 scripts/lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib.sh +1 -1
index 041b7e279a0f9793bcb5ee797caa244ceeccdd01..56093b1a58ea1af104d9c0af2842b105783dbe80 100644
@@ -33,7 +33,7 @@ FSTESTS_STARTED_FILE="${TOPDIR}/workflows/fstests/.begin"
 BLKTESTS_STARTED_FILE="${TOPDIR}/workflows/blktests/.begin"
 REBOOT_LIMIT_STARTED_FILE="${TOPDIR}/workflows/demos/reboot-limit/.begin"
 
-if [[ "$CONFIG_KDEVOPS_WORKFLOW_FSTESTS" == "y" ]]; then
+if [[ "${CONFIG_KDEVOPS_WORKFLOW_ENABLE_FSTESTS+x}" && "$CONFIG_KDEVOPS_WORKFLOW_ENABLE_FSTESTS" == "y" ]]; then
 	FSTYP="$CONFIG_FSTESTS_FSTYP"
 	TEST_DEV="$CONFIG_FSTESTS_TEST_DEV"
 fi
Signature · 1 line
2.47.2
#4 lore raw

PATCH 4/4 bringup_guestfs: ensure pool correct permissions

In reply to [email protected]

From: Daniel Gomez <[email protected]>

Ensure correct permissions for the storage pool path top directory. Otherwise, this directory ends with root permissions when LIBVIRT_URI_SYSTEM is used (default).

---
 scripts/bringup_guestfs.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/bringup_guestfs.sh +5 -4
index 74eeceace9040f6ec716234f8d80ebfe7940dac7..3180b30e5e2d72147c382056f9ee474cce157722 100755
@@ -14,7 +14,8 @@ IMG_FMT="qcow2"
 if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
-STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGETOPDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}"
+STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
@@ -274,9 +275,9 @@ $USE_SUDO mkdir -p $BASE_IMAGE_DIR
 
 
 if [[ "$CONFIG_LIBVIRT_URI_SYSTEM" == "y" ]]; then
-	sudo chgrp -R $QEMU_GROUP $STORAGEDIR
-	sudo chmod -R g+rw $STORAGEDIR
-	sudo chmod -R g+s $STORAGEDIR
+	sudo chown -R $(whoami):$QEMU_GROUP $STORAGETOPDIR
+	sudo chmod -R g+rw $STORAGETOPDIR
+	sudo chmod -R g+s $STORAGETOPDIR
 fi
 
 cmdfile=$(mktemp)
Signature · 1 line
2.47.2