From d32d4f7696254bb241cc70d52298de752173bd14 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Aug 29 2025 12:56:11 +0000
Subject: [PATCH 1/4] update Dockerfiles for devcontainer


---

diff --git a/devtools/containers/Dockerfile.centos7 b/devtools/containers/Dockerfile.centos7
index 35ef358..6f9776f 100644
--- a/devtools/containers/Dockerfile.centos7
+++ b/devtools/containers/Dockerfile.centos7
@@ -1,5 +1,9 @@
 FROM quay.io/centos/centos:7
+ARG EXTRA_PKGS
 RUN \
+  sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo && \
+  sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo && \
+  sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo && \
   yum -y update && \
   yum install -y \
     dnf \
@@ -15,7 +19,10 @@ RUN \
   yum install -y \
     python-defusedxml \
     python-pip \
-    python-psycopg2 && \
+    python-psycopg2 \
+    ${EXTRA_PKGS} && \
   yum clean all && \
-  pip install -U 'pip==9.0.1' && \
+  pip install -U 'pip==9.0.3' \
+  --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org \
+  --upgrade && \
   pip install -U tox
diff --git a/devtools/containers/Dockerfile.centos8 b/devtools/containers/Dockerfile.centos8
index 4c43ac7..3ea753f 100644
--- a/devtools/containers/Dockerfile.centos8
+++ b/devtools/containers/Dockerfile.centos8
@@ -1,5 +1,5 @@
 FROM quay.io/centos/centos:stream8
-
+ARG EXTRA_PKGS
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \
@@ -12,5 +12,5 @@ RUN \
   python3-librepo \
   python3-setuptools \
   python3-tox \
-  rpm-build && \
+  ${EXTRA_PKGS} && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.centos9 b/devtools/containers/Dockerfile.centos9
index 7faa988..9f52915 100644
--- a/devtools/containers/Dockerfile.centos9
+++ b/devtools/containers/Dockerfile.centos9
@@ -1,5 +1,5 @@
 FROM quay.io/centos/centos:stream9
-
+ARG EXTRA_PKGS
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \
@@ -12,5 +12,5 @@ RUN \
   python3-librepo \
   python3-setuptools \
   python3-tox \
-  rpm-build && \
+  ${EXTRA_PKGS} && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f39 b/devtools/containers/Dockerfile.f39
index 7ecb136..53d7695 100644
--- a/devtools/containers/Dockerfile.f39
+++ b/devtools/containers/Dockerfile.f39
@@ -1,4 +1,5 @@
 FROM registry.fedoraproject.org/fedora:39
+ARG EXTRA_PKGS
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False \
@@ -10,5 +11,6 @@ RUN \
   python3-librepo \
   python3-setuptools \
   python3-tox \
-  rpm-build && \
+  rpm-build \
+  ${EXTRA_PKGS} && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.rawhide b/devtools/containers/Dockerfile.rawhide
index ee5fa76..61587ff 100644
--- a/devtools/containers/Dockerfile.rawhide
+++ b/devtools/containers/Dockerfile.rawhide
@@ -1,4 +1,5 @@
 FROM registry.fedoraproject.org/fedora:rawhide
+ARG EXTRA_PKGS
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False \
@@ -10,5 +11,6 @@ RUN \
   python3-librepo \
   python3-setuptools \
   python3-tox \
-  rpm-build && \
+  rpm-build \
+  ${EXTRA_PKGS} && \
   dnf clean all
diff --git a/devtools/containers/README.md b/devtools/containers/README.md
index dabb0d0..59c0df4 100644
--- a/devtools/containers/README.md
+++ b/devtools/containers/README.md
@@ -27,10 +27,14 @@ Or CentOS with py3 as an example:
 
 Or CentOS with py2 as an example:
 
-    docker build -t koji_test_centos:7 --no-cache -f Dockerfile.centos8
+    docker build -t koji_test_centos:7 --no-cache -f Dockerfile.centos7
     docker run --rm -v $PWD:/koji --name koji_test koji_test_centos:7 bash -c "cd /koji && tox -e py2"
 
 When running with Podman and SELinux enabled, use the "--security-opt
 label=disable" option:
 
     podman run --rm -v $PWD:/koji --security-opt label=disable --name koji_test koji_test_fedora:39 bash -c "cd /koji && ls -l /koji && tox -e flake8,py3,bandit"
+
+One build argument - `EXTRA_PKGS` is provided to install custom packages while building images (for CentOS* and Fedora 39+), like:
+
+    docker build --build-arg EXTRA_PKGS="git make" -t koji_test_centos:7 --no-cache -f Dockerfile.centos7

From 5dc7283af29d071c1c78e1f42c1378a51fa94d0d Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Aug 29 2025 12:56:11 +0000
Subject: [PATCH 2/4] vscode devcontainers


---

diff --git a/.devcontainer/on_create.sh b/.devcontainer/on_create.sh
new file mode 100755
index 0000000..62b8e54
--- /dev/null
+++ b/.devcontainer/on_create.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -e
+
+PIP_CMD=${PIP_CMD:=pip3}
+
+echo ". /usr/share/git-core/contrib/completion/git-prompt.sh" >> ~/.bashrc
+echo "export PS1='[\[\e[34m\]\W\[\e[35m\]\$(__git_ps1 \" %s\")\[\e[00m\]]$\[\e[00m\] '" >> ~/.bashrc
+
+$PIP_CMD install -r requirements.txt
diff --git a/.devcontainer/python2/devcontainer.json b/.devcontainer/python2/devcontainer.json
new file mode 100644
index 0000000..82c670d
--- /dev/null
+++ b/.devcontainer/python2/devcontainer.json
@@ -0,0 +1,29 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/python
+{
+	"name": "centos7-python2-devel",
+
+	// "image": "quay.io/centos/centos:7",
+	"build": {
+		"dockerfile": "../../devtools/containers/Dockerfile.centos7",
+		"args": {
+			"EXTRA_PKGS": "git vim make"
+		}
+	},
+
+	"shutdownAction": "stopContainer",
+
+	"postCreateCommand": "PIP_CMD=pip bash .devcontainer/on_create.sh",
+
+	"remoteUser": "root",
+
+	"customizations": {
+		"vscode": {
+			"extensions": [
+				"ms-python.python",
+				"ms-python.vscode-pylance",
+				"ms-python.isort"
+			]
+		}
+	}
+}
diff --git a/.devcontainer/python3/devcontainer.json b/.devcontainer/python3/devcontainer.json
new file mode 100644
index 0000000..81a8b08
--- /dev/null
+++ b/.devcontainer/python3/devcontainer.json
@@ -0,0 +1,28 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/python
+{
+	"name": "fedora-python3-devel",
+	// "image": "quay.io/fedora/fedora:latest",
+	"build": {
+		"dockerfile": "../../devtools/containers/Dockerfile.f39",
+		"args": {
+			"EXTRA_PKGS": "git vim make python3-pip"
+		}
+	},
+
+	"shutdownAction": "stopContainer",
+
+	"postCreateCommand": "PIP_CMD=pip3 bash .devcontainer/on_create.sh",
+
+	"remoteUser": "root",
+
+	"customizations": {
+		"vscode": {
+			"extensions": [
+				"ms-python.python",
+				"ms-python.vscode-pylance",
+				"ms-python.isort"
+			]
+		}
+	}
+}

From 4dbc6f4dfa42c2d00e85305797b19e07cd0c914e Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Aug 29 2025 12:56:11 +0000
Subject: [PATCH 3/4] add bash-completion and docker vscode plugin


---

diff --git a/.devcontainer/python2/devcontainer.json b/.devcontainer/python2/devcontainer.json
index 82c670d..d597b9d 100644
--- a/.devcontainer/python2/devcontainer.json
+++ b/.devcontainer/python2/devcontainer.json
@@ -7,7 +7,7 @@
 	"build": {
 		"dockerfile": "../../devtools/containers/Dockerfile.centos7",
 		"args": {
-			"EXTRA_PKGS": "git vim make"
+			"EXTRA_PKGS": "git vim make bash-completion"
 		}
 	},
 
@@ -22,7 +22,8 @@
 			"extensions": [
 				"ms-python.python",
 				"ms-python.vscode-pylance",
-				"ms-python.isort"
+				"ms-python.isort",
+				"ms-azuretools.vscode-docker"
 			]
 		}
 	}
diff --git a/.devcontainer/python3/devcontainer.json b/.devcontainer/python3/devcontainer.json
index 81a8b08..b8bd14c 100644
--- a/.devcontainer/python3/devcontainer.json
+++ b/.devcontainer/python3/devcontainer.json
@@ -6,7 +6,7 @@
 	"build": {
 		"dockerfile": "../../devtools/containers/Dockerfile.f39",
 		"args": {
-			"EXTRA_PKGS": "git vim make python3-pip"
+			"EXTRA_PKGS": "git vim make bash-completion python3-pip"
 		}
 	},
 
@@ -21,7 +21,8 @@
 			"extensions": [
 				"ms-python.python",
 				"ms-python.vscode-pylance",
-				"ms-python.isort"
+				"ms-python.isort",
+				"ms-azuretools.vscode-docker"
 			]
 		}
 	}

From aef12cb6b274c15840393e3bd6cfdfe8ccff66f7 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Aug 29 2025 13:02:03 +0000
Subject: [PATCH 4/4] devcontainer enhancement


---

diff --git a/.devcontainer/python2/devcontainer.json b/.devcontainer/python2/devcontainer.json
index d597b9d..7438401 100644
--- a/.devcontainer/python2/devcontainer.json
+++ b/.devcontainer/python2/devcontainer.json
@@ -7,9 +7,13 @@
 	"build": {
 		"dockerfile": "../../devtools/containers/Dockerfile.centos7",
 		"args": {
+			// "CA_URL": "https://example.com/cert.pem",
 			"EXTRA_PKGS": "git vim make bash-completion"
 		}
 	},
+	"containerEnv": {
+		"PIP_INDEX_URL": "https://repository.engineering.redhat.com/nexus/repository/pypi.org/simple/"
+	},
 
 	"shutdownAction": "stopContainer",
 
@@ -23,7 +27,8 @@
 				"ms-python.python",
 				"ms-python.vscode-pylance",
 				"ms-python.isort",
-				"ms-azuretools.vscode-docker"
+				"ms-azuretools.vscode-containers",
+				"donjayamanne.githistory"
 			]
 		}
 	}
diff --git a/.devcontainer/python3/devcontainer.json b/.devcontainer/python3/devcontainer.json
index b8bd14c..8d502e1 100644
--- a/.devcontainer/python3/devcontainer.json
+++ b/.devcontainer/python3/devcontainer.json
@@ -6,23 +6,27 @@
 	"build": {
 		"dockerfile": "../../devtools/containers/Dockerfile.f39",
 		"args": {
+			// "CA_URL": "https://example.com/cert.pem",
 			"EXTRA_PKGS": "git vim make bash-completion python3-pip"
 		}
 	},
+	"containerEnv": {
+		"PIP_INDEX_URL": "https://repository.engineering.redhat.com/nexus/repository/pypi.org/simple/"
+	},
 
 	"shutdownAction": "stopContainer",
 
 	"postCreateCommand": "PIP_CMD=pip3 bash .devcontainer/on_create.sh",
 
 	"remoteUser": "root",
-
 	"customizations": {
 		"vscode": {
 			"extensions": [
 				"ms-python.python",
 				"ms-python.vscode-pylance",
 				"ms-python.isort",
-				"ms-azuretools.vscode-docker"
+				"ms-azuretools.vscode-containers",
+				"donjayamanne.githistory"
 			]
 		}
 	}
diff --git a/devtools/containers/Dockerfile.centos7 b/devtools/containers/Dockerfile.centos7
index 6f9776f..cf76a26 100644
--- a/devtools/containers/Dockerfile.centos7
+++ b/devtools/containers/Dockerfile.centos7
@@ -1,5 +1,12 @@
 FROM quay.io/centos/centos:7
-ARG EXTRA_PKGS
+ARG EXTRA_PKGS \
+    CA_URL
+
+RUN curl \
+    -L $CA_URL \
+    -o /etc/pki/ca-trust/source/anchors/custom_ca.pem \
+    && update-ca-trust extract
+
 RUN \
   sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo && \
   sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo && \
diff --git a/devtools/containers/Dockerfile.centos8 b/devtools/containers/Dockerfile.centos8
index 3ea753f..f31436a 100644
--- a/devtools/containers/Dockerfile.centos8
+++ b/devtools/containers/Dockerfile.centos8
@@ -1,5 +1,12 @@
 FROM quay.io/centos/centos:stream8
-ARG EXTRA_PKGS
+ARG EXTRA_PKGS \
+    CA_URL
+
+RUN curl \
+    -L $CA_URL \
+    -o /etc/pki/ca-trust/source/anchors/custom_ca.pem \
+    && update-ca-trust extract
+
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \
diff --git a/devtools/containers/Dockerfile.centos9 b/devtools/containers/Dockerfile.centos9
index 9f52915..5cc4179 100644
--- a/devtools/containers/Dockerfile.centos9
+++ b/devtools/containers/Dockerfile.centos9
@@ -1,5 +1,12 @@
 FROM quay.io/centos/centos:stream9
-ARG EXTRA_PKGS
+ARG EXTRA_PKGS \
+    CA_URL
+
+RUN curl \
+    -L $CA_URL \
+    -o /etc/pki/ca-trust/source/anchors/custom_ca.pem \
+    && update-ca-trust extract
+
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \
diff --git a/devtools/containers/Dockerfile.f39 b/devtools/containers/Dockerfile.f39
index 53d7695..a90fbaa 100644
--- a/devtools/containers/Dockerfile.f39
+++ b/devtools/containers/Dockerfile.f39
@@ -1,5 +1,12 @@
 FROM registry.fedoraproject.org/fedora:39
-ARG EXTRA_PKGS
+ARG EXTRA_PKGS \
+    CA_URL
+
+RUN curl \
+    -L $CA_URL \
+    -o /etc/pki/ca-trust/source/anchors/custom_ca.pem \
+    && update-ca-trust extract
+
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False \
diff --git a/devtools/containers/Dockerfile.rawhide b/devtools/containers/Dockerfile.rawhide
index 61587ff..37be76c 100644
--- a/devtools/containers/Dockerfile.rawhide
+++ b/devtools/containers/Dockerfile.rawhide
@@ -1,5 +1,13 @@
 FROM registry.fedoraproject.org/fedora:rawhide
-ARG EXTRA_PKGS
+
+ARG EXTRA_PKGS \
+    CA_URL
+
+RUN curl \
+    -L $CA_URL \
+    -o /etc/pki/ca-trust/source/anchors/custom_ca.pem \
+    && update-ca-trust extract
+
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False \

