From ef50ca2a58c45158ad69f5e1e893aea4766464f4 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Thu, 18 May 2023 13:51:49 -0400 Subject: [PATCH] jjb/lava: Parameterize repo URL and branch for test scripts This permets us to launch a build with a different repo URL and/or branch. Without this change, any changes we want to test must be pushed on to the lttng-ci master branch before the run. Pass repo URL and branch through to the clone in the setup job as well. Change-Id: Ie9d45b2285e8e484dd23727278bb87e9c3ddfae2 --- jobs/system-tests.yaml | 32 +++++++++++++++++-- lava/system-tests/destructive-tests.yml | 2 +- lava/system-tests/kernel-tests.yml | 2 +- lava/system-tests/perf-tests.yml | 2 +- lava/system-tests/setup.yml | 2 +- .../generate-properties-master.sh | 2 ++ scripts/system-tests/lava2-submit.py | 5 +++ scripts/system-tests/run-baremetal-tests.sh | 4 ++- scripts/system-tests/run-kvm-tests.sh | 4 ++- scripts/system-tests/template_lava_job.jinja2 | 21 +++++++++--- 10 files changed, 63 insertions(+), 13 deletions(-) diff --git a/jobs/system-tests.yaml b/jobs/system-tests.yaml index 57cba7f..32298e5 100644 --- a/jobs/system-tests.yaml +++ b/jobs/system-tests.yaml @@ -39,6 +39,14 @@ name: 'ROOTFS_URL' default: 'https://obj.internal.efficios.com/lava/rootfs/rootfs_amd64_xenial_2018-12-05.tar.gz' description: 'The URL at which the system root FS can be downloaded' + - string: + name: 'LTTNG_CI_REPO' + default: 'https://github.com/lttng/lttng-ci.git' + description: 'LTTng-ci git repo to checkout the CI scripts' + - string: + name: 'LTTNG_CI_BRANCH' + default: 'master' + description: 'The branch of the CI repository to clone for job scripts' - publisher: name: 'system_tests_email_ext_default' @@ -98,11 +106,15 @@ properties-content: | BUILD_DEVICE=kvm LTTNG_VERSION={lttngversion} + LTTNG_CI_REPO=${{LTTNG_CI_REPO}} + LTTNG_CI_BRANCH=${{LTTNG_CI_BRANCH}} scm: - git: - url: https://github.com/lttng/lttng-ci + url: "${{LTTNG_CI_REPO}}" basedir: src/lttng-ci/ + branches: + - "${{LTTNG_CI_BRANCH}}" builders: - shell: !include-raw-escape: scripts/system-tests/generate-properties-master.sh @@ -172,11 +184,15 @@ properties-content: | BUILD_DEVICE=baremetal LTTNG_VERSION={lttngversion} + LTTNG_CI_REPO=${{LTTNG_CI_REPO}} + LTTNG_CI_BRANCH=${{LTTNG_CI_BRANCH}} scm: - git: - url: https://github.com/lttng/lttng-ci + url: "${{LTTNG_CI_REPO}}" basedir: src/lttng-ci/ + branches: + - "${{LTTNG_CI_BRANCH}}" builders: - shell: !include-raw-escape: scripts/system-tests/generate-properties-master.sh @@ -239,6 +255,14 @@ - string: name: 'S3_STORAGE_LTTNG_MODULES' description: 'Path to store the LTTng Modules' + - string: + name: 'LTTNG_CI_REPO' + default: 'https://github.com/lttng/lttng-ci.git' + description: 'LTTng-ci git repo to checkout the CI scripts' + - string: + name: 'LTTNG_CI_BRANCH' + default: 'master' + description: 'The branch of the CI repository to clone for job scripts' properties: - build-discarder: @@ -255,8 +279,10 @@ scm: - git: - url: https://github.com/lttng/lttng-ci + url: "${{LTTNG_CI_REPO}}" basedir: src/lttng-ci/ + branches: + - "${{LTTNG_CI_BRANCH}}" builders: - shell: !include-raw-escape: scripts/system-tests/checkout-modules.sh diff --git a/lava/system-tests/destructive-tests.yml b/lava/system-tests/destructive-tests.yml index f8a325a..b1b4f27 100644 --- a/lava/system-tests/destructive-tests.yml +++ b/lava/system-tests/destructive-tests.yml @@ -8,7 +8,7 @@ params: run: steps: - apt install -y curl - - git clone https://github.com/lttng/lttng-ci ci + - git clone "${CI_REPO}" --branch="${CI_BRANCH}" ci - export TMPDIR="/tmp" - systemctl stop systemd-timesyncd.service - mkdir -p coredump diff --git a/lava/system-tests/kernel-tests.yml b/lava/system-tests/kernel-tests.yml index 071cb81..f51c969 100644 --- a/lava/system-tests/kernel-tests.yml +++ b/lava/system-tests/kernel-tests.yml @@ -8,7 +8,7 @@ params: run: steps: - apt install -y curl - - git clone https://github.com/lttng/lttng-ci ci + - git clone "${CI_REPO}" --branch="${CI_BRANCH}" ci - export TMPDIR="/tmp" - mkdir -p coredump - echo "$(pwd)/coredump/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern diff --git a/lava/system-tests/perf-tests.yml b/lava/system-tests/perf-tests.yml index 026ccaf..0355d82 100644 --- a/lava/system-tests/perf-tests.yml +++ b/lava/system-tests/perf-tests.yml @@ -8,7 +8,7 @@ params: run: steps: - apt install -y libpfm4-dev curl - - git clone https://github.com/lttng/lttng-ci ci + - git clone "${CI_REPO}" --branch="${CI_BRANCH}" ci - export TMPDIR="/tmp" - mkdir -p coredump - echo "$(pwd)/coredump/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern diff --git a/lava/system-tests/setup.yml b/lava/system-tests/setup.yml index f835548..597d856 100644 --- a/lava/system-tests/setup.yml +++ b/lava/system-tests/setup.yml @@ -21,7 +21,7 @@ run: - pip3 install 'pip==20.3' - hash -r - pip3 install vlttng - - git clone https://github.com/lttng/lttng-ci ci + - git clone "${CI_REPO}" --branch="${CI_BRANCH}" ci - mkdir -p /root/.ssh - chmod 700 /root/.ssh - cp lava/system-tests/authorized_keys /root/.ssh/authorized_keys diff --git a/scripts/system-tests/generate-properties-master.sh b/scripts/system-tests/generate-properties-master.sh index 758a488..ea70b3c 100644 --- a/scripts/system-tests/generate-properties-master.sh +++ b/scripts/system-tests/generate-properties-master.sh @@ -31,6 +31,8 @@ signature_v2 = False" > "$WORKSPACE/s3cfg" LTTNG_CI_PATH="$WORKSPACE/src/lttng-ci" echo "LTTNG_CI_PATH=$LTTNG_CI_PATH" >> properties.txt +echo "LTTNG_CI_REPO=$LTTNG_CI_REPO" >> properties.txt +echo "LTTNG_CI_BRANCH=$LTTNG_CI_BRANCH" >> properties.txt KERNEL_COMMIT_ID=$KERNEL_TAG_ID echo "KERNEL_COMMIT_ID=$KERNEL_COMMIT_ID" >> properties.txt diff --git a/scripts/system-tests/lava2-submit.py b/scripts/system-tests/lava2-submit.py index 232be5d..fd573af 100644 --- a/scripts/system-tests/lava2-submit.py +++ b/scripts/system-tests/lava2-submit.py @@ -199,6 +199,8 @@ def main(): '-r', '--rootfs-url', required=False, default="https://obj.internal.efficios.com/lava/rootfs/rootfs_amd64_xenial_2018-12-05.tar.gz" ) + parser.add_argument('--ci-repo', required=False, default='https://github.com/lttng/lttng-ci.git') + parser.add_argument('--ci-branch', required=False, default='master') args = parser.parse_args() if args.type not in TestType.values: @@ -265,6 +267,9 @@ def main(): context['kprobe_round_nb'] = 10 + context['ci_repo'] = args.ci_repo + context['ci_branch'] = args.ci_branch + render = jinja_template.render(context) print('Job to be submitted:') diff --git a/scripts/system-tests/run-baremetal-tests.sh b/scripts/system-tests/run-baremetal-tests.sh index 32ead9a..b1819c4 100644 --- a/scripts/system-tests/run-baremetal-tests.sh +++ b/scripts/system-tests/run-baremetal-tests.sh @@ -36,7 +36,9 @@ python -u "$LTTNG_CI_PATH"/scripts/system-tests/lava2-submit.py \ -tc "$LTTNG_TOOLS_COMMIT_ID" \ -uc "$LTTNG_UST_COMMIT_ID" \ -id "$BUILD_TAG" \ - -r "$ROOTFS_URL" + -r "$ROOTFS_URL" \ + --ci-repo "$LTTNG_CI_REPO" \ + --ci-branch "$LTTNG_CI_BRANCH" set +eu deactivate diff --git a/scripts/system-tests/run-kvm-tests.sh b/scripts/system-tests/run-kvm-tests.sh index 7c36757..e6ceac3 100644 --- a/scripts/system-tests/run-kvm-tests.sh +++ b/scripts/system-tests/run-kvm-tests.sh @@ -35,7 +35,9 @@ python -u "$LTTNG_CI_PATH"/scripts/system-tests/lava2-submit.py \ -tc "$LTTNG_TOOLS_COMMIT_ID" \ -uc "$LTTNG_UST_COMMIT_ID" \ -id "$BUILD_TAG" \ - -r "$ROOTFS_URL" + -r "$ROOTFS_URL" \ + --ci-repo "$LTTNG_CI_REPO" \ + --ci-branch "$LTTNG_CI_BRANCH" set +eu deactivate diff --git a/scripts/system-tests/template_lava_job.jinja2 b/scripts/system-tests/template_lava_job.jinja2 index b608006..59fc91f 100644 --- a/scripts/system-tests/template_lava_job.jinja2 +++ b/scripts/system-tests/template_lava_job.jinja2 @@ -60,10 +60,14 @@ actions: - test: definitions: # Base setup # - - repository: https://github.com/lttng/lttng-ci.git + - repository: {{ ci_repo }} from: git + branch: {{ ci_branch }} path: lava/system-tests/setup.yml name: x86-env-setup + params: + CI_REPO: {{ ci_repo }} + CI_BRANCH: {{ ci_branch }} # Base vlttng setup # - repository: metadata: @@ -90,26 +94,35 @@ actions: name: vlttng-env-setup-inline path: inline/vlttng-env-setup {% if test_type == TestType.baremetal_tests %} - - repository: https://github.com/lttng/lttng-ci.git + - repository: {{ ci_repo }} from: git + branch: {{ ci_branch }} path: lava/system-tests/perf-tests.yml name: perf-tests params: LTTNG_VERSION_STRING: {{ lttng_version_string }} JENKINS_BUILD_ID: {{ jenkins_build_id }} + CI_REPO: {{ ci_repo }} + CI_BRANCH: {{ ci_branch }} {% elif test_type == TestType.kvm_tests %} - - repository: https://github.com/lttng/lttng-ci.git + - repository: {{ ci_repo }} from: git + branch: {{ ci_branch }} path: lava/system-tests/kernel-tests.yml name: kernel-tests params: LTTNG_VERSION_STRING: {{ lttng_version_string }} JENKINS_BUILD_ID: {{ jenkins_build_id }} - - repository: https://github.com/lttng/lttng-ci.git + CI_REPO: {{ ci_repo }} + CI_BRANCH: {{ ci_branch }} + - repository: {{ ci_repo }} from: git + branch: {{ ci_branch }} path: lava/system-tests/destructive-tests.yml name: destructive-tests params: LTTNG_VERSION_STRING: {{ lttng_version_string }} JENKINS_BUILD_ID: {{ jenkins_build_id }} + CI_REPO: {{ ci_repo }} + CI_BRANCH: {{ ci_branch }} {% endif %} -- 2.34.1