Repository: cekit/cekit
Pull request #866 (2023-09-06 09:11:42)

Switch from git to https protocol

rnc: > I wondered if cekit would need to be updated for this. My dist-git clones (created via cekit although a long time ago) are git+ssh (not plain git), and are still working, FWIW.

See internal CEKit channel - I've cc'd you showing a backtrace.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/cekit/cekit/pull/866?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit) Report
Patch coverage: **`100.00%`** and project coverage change: **`+1.93%`** :tada:
> Comparison is base [(`ef30b58`)](https://app.codecov.io/gh/cekit/cekit/commit/ef30b58092562f484c240bba602a8ea5ea769e89?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit) 88.31% compared to head [(`3e5ae53`)](https://app.codecov.io/gh/cekit/cekit/pull/866?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit) 90.24%.

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff             @@
##           develop     #866      +/-   ##
===========================================
+ Coverage    88.31%   90.24%   +1.93%     
===========================================
  Files           41       41              
  Lines         3209     3210       +1     
===========================================
+ Hits          2834     2897      +63     
+ Misses         375      313      -62     
```


| [Files Changed](https://app.codecov.io/gh/cekit/cekit/pull/866?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit) | Coverage Δ | |
|---|---|---|
| [cekit/builders/osbs.py](https://app.codecov.io/gh/cekit/cekit/pull/866?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit#diff-Y2VraXQvYnVpbGRlcnMvb3Nicy5weQ==) | `83.61% <100.00%> (ø)` | |

... and [6 files with indirect coverage changes](https://app.codecov.io/gh/cekit/cekit/pull/866/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit)


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/cekit/cekit/pull/866?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cekit).


Patch:
diff --git a/.github/workflows/cekit.yml b/.github/workflows/cekit.yml
index 68c4ccc..c337fdd 100644
--- a/.github/workflows/cekit.yml
+++ b/.github/workflows/cekit.yml
@@ -55,6 +55,10 @@ jobs:
       if: startsWith(matrix.os,'macos')
       run: |
         pip install "tox<4.0.0"
+        # Update qemu for https://github.com/containers/podman/issues/19708 / https://github.com/Homebrew/homebrew-core/issues/140244
+        brew update
+        brew upgrade qemu
+
         brew install podman
         podman machine init
         podman machine start
diff --git a/cekit/builders/osbs.py b/cekit/builders/osbs.py
index 4b42669..6426757 100644
--- a/cekit/builders/osbs.py
+++ b/cekit/builders/osbs.py
@@ -295,7 +295,7 @@ class OSBSBuilder(Builder):
             # Parse the dist-git repository url
             url = urlparse(url)
             # Construct the url again, with a hash and removed username and password, if any
-            src = "git://{}{}#{}".format(url.hostname, url.path, commit)
+            src = "https://{}/git{}#{}".format(url.hostname, url.path, commit)
 
             target = self.generator.image.get("osbs", {}).get("koji_target")
 


Test patch:
diff --git a/tests/images/multi-stage/modules/build/module.yaml b/tests/images/multi-stage/modules/build/module.yaml
index cb09fd6..621ef07 100644
--- a/tests/images/multi-stage/modules/build/module.yaml
+++ b/tests/images/multi-stage/modules/build/module.yaml
@@ -3,8 +3,8 @@ version: 1.0
 
 artifacts:
   - name: ant.tar.gz
-    url: https://downloads.apache.org/ant/binaries/apache-ant-1.10.12-bin.zip
-    sha512: 7e6fbcc3563df4bd87c883ad86a161a71da2774e0ed71a1b3aad82cbff1a7656ed9a0acb5ce40652129376dfd79f1ef74ec3369c1067d412a63062fea62ceccd
+    url: https://downloads.apache.org/ant/binaries/apache-ant-1.10.13-bin.zip
+    sha512: 347e964db73d1f8e9fe110f135625920e09c8c9997e9950c405cfeec60b70750044a91ef0535d76d6f8e023de0788f2619be76fd91b7a80be9a6b569a16cc3e8
 
 execute:
     - script: build.sh
diff --git a/tests/test_builder.py b/tests/test_builder.py
index 8a3a070..c7dacdc 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -243,7 +243,7 @@ def test_osbs_builder_run_brew_stage(mocker):
                     "--python",
                     "buildContainer",
                     "--kwargs",
-                    "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
+                    "{'src': 'https://something.redhat.com/git/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
                 ],
                 stderr=-1,
                 stdout=-1,
@@ -302,7 +302,7 @@ def test_osbs_builder_run_brew(mocker):
                     "--python",
                     "buildContainer",
                     "--kwargs",
-                    "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
+                    "{'src': 'https://something.redhat.com/git/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
                 ],
                 stderr=-1,
                 stdout=-1,
@@ -361,7 +361,7 @@ def test_osbs_builder_run_koji(mocker):
                     "--python",
                     "buildContainer",
                     "--kwargs",
-                    "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
+                    "{'src': 'https://something.redhat.com/git/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
                 ],
                 stderr=-1,
                 stdout=-1,
@@ -433,7 +433,7 @@ def test_osbs_builder_run_brew_user(mocker):
             "--python",
             "buildContainer",
             "--kwargs",
-            "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
+            "{'src': 'https://something.redhat.com/git/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
         ],
         stderr=-1,
         stdout=-1,
@@ -474,7 +474,7 @@ def test_osbs_builder_run_brew_target_defined_in_descriptor(mocker):
             "--python",
             "buildContainer",
             "--kwargs",
-            "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-target', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
+            "{'src': 'https://something.redhat.com/git/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-target', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}",
         ],
         stderr=-1,
         stdout=-1,
diff --git a/tests/test_integ_builder_osbs.py b/tests/test_integ_builder_osbs.py
index 1d5e50d..87bb3cb 100644
--- a/tests/test_integ_builder_osbs.py
+++ b/tests/test_integ_builder_osbs.py
@@ -1142,7 +1142,7 @@ def test_osbs_builder_with_koji_target_based_on_branch(tmpdir, mocker, caplog):
     run_osbs(descriptor, str(tmpdir), mocker)
 
     assert (
-        "About to execute 'brew call --python buildContainer --kwargs {'src': 'git://somehost.com/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb', 'target': 'branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'branch', 'yum_repourls': []}}'."
+        "About to execute 'brew call --python buildContainer --kwargs {'src': 'https://somehost.com/git/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb', 'target': 'branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'branch', 'yum_repourls': []}}'."
         in caplog.text
     )
 
@@ -1162,7 +1162,7 @@ def test_osbs_builder_with_koji_target_in_descriptor(tmpdir, mocker, caplog):
     run_osbs(descriptor, str(tmpdir), mocker)
 
     assert (
-        "About to execute 'brew call --python buildContainer --kwargs {'src': 'git://somehost.com/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb', 'target': 'some-target', 'opts': {'scratch': True, 'git_branch': 'branch', 'yum_repourls': []}}'."
+        "About to execute 'brew call --python buildContainer --kwargs {'src': 'https://somehost.com/git/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb', 'target': 'some-target', 'opts': {'scratch': True, 'git_branch': 'branch', 'yum_repourls': []}}'."
         in caplog.text
     )
 
@@ -2652,7 +2652,7 @@ def test_osbs_builder_kick_build_with_tag_1(tmpdir, mocker, caplog):
     )
     assert "Image was built successfully in OSBS!" in caplog.text
     assert (
-        "Tagging git repository (git://somehost.com/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb) with FOOBAR-1 from build 123456"
+        "Tagging git repository (https://somehost.com/git/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb) with FOOBAR-1 from build 123456"
         in caplog.text
     )
     assert (
@@ -2723,7 +2723,7 @@ def test_osbs_builder_kick_build_with_tag_2(tmpdir, mocker, caplog):
     )
     assert "Image was built successfully in OSBS!" in caplog.text
     assert (
-        "Tagging git repository (git://somehost.com/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb) with test-image-1.0-1 from build 123456"
+        "Tagging git repository (https://somehost.com/git/containers/somerepo#3b9283cb26b35511517ff5c0c3e11f490cba8feb) with test-image-1.0-1 from build 123456"
         in caplog.text
     )
     assert (
diff --git a/tests/test_unit_descriptor.py b/tests/test_unit_descriptor.py
index db0405d..a25fa59 100644
--- a/tests/test_unit_descriptor.py
+++ b/tests/test_unit_descriptor.py
@@ -193,7 +193,7 @@ def test_image():
     )
 
     assert image["name"] == "test/foo"
-    assert type(image["labels"][0]) == Label
+    assert isinstance(image["labels"][0], Label)
     assert image["labels"][0]["name"] == "test"
     assert image["envs"][0]["required"] is False
 
@@ -256,7 +256,7 @@ def test_image_artifacts(caplog):
     )
 
     assert image["name"] == "test/foo"
-    assert type(image["labels"][0]) == Label
+    assert isinstance(image["labels"][0], Label)
     assert image["labels"][0]["name"] == "test"
     assert (
         'No value found for \'name\' in \'{"dest": "/tmp/artifacts/", "md5": "080075877a66adf52b7f6d0013fa9730", "url": "https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz"}\' artifact; using auto-generated value of \'apache-tomcat-8.5.24.tar.gz\''
@@ -436,5 +436,5 @@ def test_image_follow_tag():
     )
 
     assert image["name"] == "test/foo"
-    assert type(image["labels"][0]) == Label
+    assert isinstance(image["labels"][0], Label)
     assert image["labels"][0]["name"] == "test"