[libvirt-ci PATCH 0/4] check-dco: Support namespaces other than libvirt

See patch 4/4. Andrea Bolognani (4): containers: New top-level directory check-dco: Fix script name in top comment check-dco: Change remote name check-dco: Support namespaces other than libvirt .gitlab-ci.yml | 2 +- {check-dco => containers/check-dco}/Dockerfile | 0 {check-dco => containers/check-dco}/check-dco.py | 16 ++++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) rename {check-dco => containers/check-dco}/Dockerfile (100%) rename {check-dco => containers/check-dco}/check-dco.py (84%) -- 2.25.4

Let's keep the repository structure tidy. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .gitlab-ci.yml | 2 +- {check-dco => containers/check-dco}/Dockerfile | 0 {check-dco => containers/check-dco}/check-dco.py | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {check-dco => containers/check-dco}/Dockerfile (100%) rename {check-dco => containers/check-dco}/check-dco.py (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7735bb3..6de69d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ stages: - docker info - docker login registry.gitlab.com -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} script: - - docker build --tag ${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG} ${NAME} + - docker build --tag ${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG} containers/${NAME} - docker push ${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG} after_script: - docker logout diff --git a/check-dco/Dockerfile b/containers/check-dco/Dockerfile similarity index 100% rename from check-dco/Dockerfile rename to containers/check-dco/Dockerfile diff --git a/check-dco/check-dco.py b/containers/check-dco/check-dco.py similarity index 100% rename from check-dco/check-dco.py rename to containers/check-dco/check-dco.py -- 2.25.4

It refers to an old name for the script. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- containers/check-dco/check-dco.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/check-dco/check-dco.py b/containers/check-dco/check-dco.py index f8204ca..643e7f3 100755 --- a/containers/check-dco/check-dco.py +++ b/containers/check-dco/check-dco.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# ci-job.py: validate all commits are signed off +# check-dco.py: validate all commits are signed off # # Copyright (C) 2020 Red Hat, Inc. # -- 2.25.4

Make it match the name of the script. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- containers/check-dco/check-dco.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/containers/check-dco/check-dco.py b/containers/check-dco/check-dco.py index 643e7f3..79cfadc 100755 --- a/containers/check-dco/check-dco.py +++ b/containers/check-dco/check-dco.py @@ -27,17 +27,17 @@ cwd = os.getcwd() reponame = os.path.basename(cwd) repourl = "https://gitlab.com/libvirt/%s.git" % reponame -subprocess.check_call(["git", "remote", "add", "dcocheck", repourl]) -subprocess.check_call(["git", "fetch", "dcocheck", "master"], +subprocess.check_call(["git", "remote", "add", "check-dco", repourl]) +subprocess.check_call(["git", "fetch", "check-dco", "master"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) -ancestor = subprocess.check_output(["git", "merge-base", "dcocheck/master", "HEAD"], +ancestor = subprocess.check_output(["git", "merge-base", "check-dco/master", "HEAD"], universal_newlines=True) ancestor = ancestor.strip() -subprocess.check_call(["git", "remote", "rm", "dcocheck"]) +subprocess.check_call(["git", "remote", "rm", "check-dco"]) errors = False -- 2.25.4

This will allow us to reuse the same container image to perform DCO checking for libosinfo repositories. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- containers/check-dco/check-dco.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/containers/check-dco/check-dco.py b/containers/check-dco/check-dco.py index 79cfadc..339fb57 100755 --- a/containers/check-dco/check-dco.py +++ b/containers/check-dco/check-dco.py @@ -23,9 +23,13 @@ import os.path import sys import subprocess +namespace = "libvirt" +if len(sys.argv) >= 2: + namespace = sys.argv[1] + cwd = os.getcwd() reponame = os.path.basename(cwd) -repourl = "https://gitlab.com/libvirt/%s.git" % reponame +repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame) subprocess.check_call(["git", "remote", "add", "check-dco", repourl]) subprocess.check_call(["git", "fetch", "check-dco", "master"], -- 2.25.4

On Thu, Apr 30, 2020 at 09:28:08PM +0200, Andrea Bolognani wrote:
See patch 4/4.
Andrea Bolognani (4): containers: New top-level directory check-dco: Fix script name in top comment check-dco: Change remote name check-dco: Support namespaces other than libvirt
.gitlab-ci.yml | 2 +- {check-dco => containers/check-dco}/Dockerfile | 0 {check-dco => containers/check-dco}/check-dco.py | 16 ++++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) rename {check-dco => containers/check-dco}/Dockerfile (100%) rename {check-dco => containers/check-dco}/check-dco.py (84%)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé