Repository: osbuild/osbuild-composer
Pull request #4229 (2024-06-25 16:13:06)

Fix executor setting its own hostname
Cloud-init data was broken + the script wasn't executable :facepalm: 

ezr-ondrej: Failing on Fedora 40 if I'm reading it correctly.
jrusz: There is something wrong with the filesystem.sh test on fedora-40, it seem image-info has issue there, I'd wait with the transition for now to fix the stage runners.
ezr-ondrej: Yeah I'd agree, otherwise we'd need to get it in broken to fix stage, right?
jrusz: > Yeah I'd agree, otherwise we'd need to get it in broken to fix stage, right?

Well breaking `main` is not desirable so I'd say otherwise we'd need to debug and fix the issue which would delay the fix for stage :)
jrusz: > > There is something wrong with the filesystem.sh test on fedora-40, it seem image-info has issue there, I'd wait with the transition for now to fix the stage runners.
> 
> Can't run fedora-38 anymore since the rpmrepo snapshots got deleted, so main currently is broken already.

Yeah well in that case I'd just not run it for now and fix in a followup... I read the comments and it seems there was something missing in the kernel, we should check if it's there already.
croissanne: > > > There is something wrong with the filesystem.sh test on fedora-40, it seem image-info has issue there, I'd wait with the transition for now to fix the stage runners.
> > 
> > 
> > Can't run fedora-38 anymore since the rpmrepo snapshots got deleted, so main currently is broken already.
> 
> Yeah well in that case I'd just not run it for now and fix in a followup... I read the comments and it seems there was something missing in the kernel, we should check if it's there already.

the issue now seems to be image-info:
```
Traceback (most recent call last):
  File "/usr/libexec/osbuild-composer-test/image-info", line 2891, in <module>
    main()
  File "/usr/libexec/osbuild-composer-test/image-info", line 2885, in main
    report = analyse_image(target)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/osbuild-composer-test/image-info", line 2731, in analyse_image
    append_partitions(report, target)
  File "/usr/libexec/osbuild-composer-test/image-info", line 2706, in append_partitions
    append_filesystem(report, root_tree)
  File "/usr/libexec/osbuild-composer-test/image-info", line 2317, in append_filesystem
    dnf_conf = read_dnf_conf(tree)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/osbuild-composer-test/image-info", line 2158, in read_dnf_conf
    dnf_config = _read_inifile_to_dict(f"{tree}/etc/dnf/dnf.conf")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/osbuild-composer-test/image-info", line 2124, in _read_inifile_to_dict
    parser.readfp(f)
    ^^^^^^^^^^^^^
AttributeError: 'RawConfigParser' object has no attribute 'readfp'. Did you mean: 'read'?
ERROR image-info failed, show last few kernel message to debug
```

Patch:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 709851c56..a140f437b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -92,10 +92,10 @@ RPM:
   parallel:
     matrix:
       - RUNNER:
-          - aws/fedora-38-x86_64
-          - aws/fedora-38-aarch64
           - aws/fedora-39-x86_64
           - aws/fedora-39-aarch64
+          - aws/fedora-40-x86_64
+          - aws/fedora-40-aarch64
           - aws/rhel-8.4-ga-x86_64
           - aws/rhel-8.4-ga-aarch64
           - aws/rhel-8.9-ga-x86_64
@@ -175,8 +175,6 @@ Base:
   parallel:
     matrix:
       - RUNNER:
-          - aws/fedora-38-x86_64
-          - aws/fedora-38-aarch64
           - aws/fedora-39-x86_64
           - aws/fedora-39-aarch64
           - aws/rhel-8.4-ga-x86_64
@@ -204,8 +202,6 @@ Base:
   parallel:
     matrix:
       - RUNNER:
-          - aws/fedora-38-x86_64
-          - aws/fedora-38-aarch64
           - aws/fedora-39-x86_64
           - aws/fedora-39-aarch64
       - RUNNER:
@@ -340,7 +336,6 @@ Trigger-rhel-edge-ci:
 
 .fedora_runners: &fedora_runners
     RUNNER:
-      - aws/fedora-38-x86_64
       - aws/fedora-39-x86_64
 
 .integration_fedora:
@@ -474,14 +469,11 @@ vmware.sh_ova:
   variables:
     SCRIPT: vmware.sh ova
 
+# TODO add fedora runners here
 filesystem.sh:
   extends: .integration
   parallel:
     matrix:
-    - RUNNER:
-      # don't execute on fedora-39 yet until https://lkml.kernel.org/linux-xfs/20230823220225.3591135-1-david@fromorbit.com/#t is in the kernel
-      # see also https://github.com/osbuild/osbuild-composer/pull/3820#issuecomment-1881587335 for more details
-      - aws/fedora-38-x86_64
     - *rhel_runners
 
   variables:
@@ -523,7 +515,6 @@ API:
         INTERNAL_NETWORK: ["true"]
       - IMAGE_TYPE: ["iot-commit"]
         RUNNER:
-          - aws/fedora-38-x86_64
           - aws/fedora-39-x86_64
       - IMAGE_TYPE: ["iot-bootable-container"]
         RUNNER:
@@ -573,8 +564,7 @@ API-module-hotfixes:
   parallel:
     matrix:
       - RUNNER:
-          - rhos-01/fedora-38-x86_64
-          # - rhos-01/fedora-39-x86_64
+          - rhos-01/fedora-40-x86_64
       - RUNNER:
           - gcp/rhel-8.9-ga-x86_64
           - gcp/rhel-9.3-ga-x86_64
@@ -728,7 +718,6 @@ ContainerUpload:
   parallel:
     matrix:
       - RUNNER:
-          - aws/fedora-38-x86_64
           - aws/fedora-39-x86_64
 
 ContainerEmbedding:
diff --git a/internal/cloud/awscloud/secure-instance.go b/internal/cloud/awscloud/secure-instance.go
index 7f2db55d2..eb6b069a7 100644
--- a/internal/cloud/awscloud/secure-instance.go
+++ b/internal/cloud/awscloud/secure-instance.go
@@ -22,12 +22,18 @@ type SecureInstance struct {
 func SecureInstanceUserData(cloudWatchGroup, hostname string) string {
 	additionalFiles := ""
 
-	if cloudWatchGroup != "" {
-		additionalFiles += fmt.Sprintf(`  - path: /tmp/cloud_init_vars
+	if cloudWatchGroup != "" || hostname != "" {
+		additionalFiles += `  - path: /tmp/cloud_init_vars
     content: |
-      OSBUILD_EXECUTOR_CLOUDWATCH_GROUP='%s'
-      OSBUILD_EXECUTOR_HOSTNAME='%s'
-`, cloudWatchGroup, hostname)
+`
+	}
+	if cloudWatchGroup != "" {
+		additionalFiles += fmt.Sprintf(`      OSBUILD_EXECUTOR_CLOUDWATCH_GROUP='%s'
+`, cloudWatchGroup)
+	}
+	if hostname != "" {
+		additionalFiles += fmt.Sprintf(`      OSBUILD_EXECUTOR_HOSTNAME='%s'
+`, hostname)
 	}
 
 	return fmt.Sprintf(`#cloud-config
diff --git a/osbuild-composer.spec b/osbuild-composer.spec
index d16b52abe..bef54bee6 100644
--- a/osbuild-composer.spec
+++ b/osbuild-composer.spec
@@ -12,7 +12,7 @@
 
 %global goipath         github.com/osbuild/osbuild-composer
 
-Version:        111
+Version:        112
 
 %gometa
 
diff --git a/schutzbot/terraform b/schutzbot/terraform
index 3b2e23226..b56076f02 100644
--- a/schutzbot/terraform
+++ b/schutzbot/terraform
@@ -1,1 +1,1 @@
-86cb482645e99849de51a067b4af02fa9aca54a8
+445f5effb0cd29f2b0610bcec88acc22475f6326


Test patch:
diff --git a/internal/cloud/awscloud/secure-instance_test.go b/internal/cloud/awscloud/secure-instance_test.go
index c67734486..a759e5bbd 100644
--- a/internal/cloud/awscloud/secure-instance_test.go
+++ b/internal/cloud/awscloud/secure-instance_test.go
@@ -33,7 +33,28 @@ write_files:
       OSBUILD_EXECUTOR_HOSTNAME='test-hostname'
 `,
 		},
-	}
+		{
+			Hostname: "test-hostname",
+			ExpectedUserData: `#cloud-config
+write_files:
+  - path: /tmp/worker-run-executor-service
+    content: ''
+  - path: /tmp/cloud_init_vars
+    content: |
+      OSBUILD_EXECUTOR_HOSTNAME='test-hostname'
+`,
+		},
+		{
+			CloudWatchGroup: "test-group",
+			ExpectedUserData: `#cloud-config
+write_files:
+  - path: /tmp/worker-run-executor-service
+    content: ''
+  - path: /tmp/cloud_init_vars
+    content: |
+      OSBUILD_EXECUTOR_CLOUDWATCH_GROUP='test-group'
+`,
+		}}
 
 	for idx, tc := range testCases {
 		t.Run(fmt.Sprintf("Test case %d", idx), func(t *testing.T) {