From cd959909787d76393bb4b4d50c401f955373b4ae Mon Sep 17 00:00:00 2001 From: Peppi-Lotta Date: Tue, 26 Mar 2024 15:07:50 +0200 Subject: [PATCH] Add dev-env-integration test to prow Signed-off-by: Peppi-Lotta --- .../jobs/dev_env_integration_tests.pipeline | 26 +-- .../dev_env_integration_tests.sh | 3 + prow/manifests/overlays/metal3/config.yaml | 165 ++++++++++++++++++ 3 files changed, 182 insertions(+), 12 deletions(-) diff --git a/jenkins/jobs/dev_env_integration_tests.pipeline b/jenkins/jobs/dev_env_integration_tests.pipeline index 7b05283b..6c9dbaf9 100644 --- a/jenkins/jobs/dev_env_integration_tests.pipeline +++ b/jenkins/jobs/dev_env_integration_tests.pipeline @@ -8,14 +8,17 @@ def CLEAN_TIMEOUT = 600 def TIMEOUT = 7200 script { - if ("${PROJECT_REPO_ORG}" == "metal3-io" && "${PROJECT_REPO_NAME}" == "project-infra") { - echo "Checkout ${ghprbAuthorRepoGitUrl} branch ${ghprbActualCommit}" - ci_git_branch="${ghprbActualCommit}" - ci_git_url = "${ghprbAuthorRepoGitUrl}" + if ("${env.REPO_OWNER}" == "metal3-io" && "${env.REPO_NAME}" == "project-infra") { + echo "Checkout https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git branch ${env.PULL_PULL_SHA}" + ci_git_branch = (env.PULL_PULL_SHA) ?: "main" + ci_git_url = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git" + ci_git_base = (env.PULL_BASE_REF) ?: "main" + // Fetch the base branch and the ci_git_branch when running on project-infra PR + refspec = '+refs/heads/' + ci_git_base + ':refs/remotes/origin/' + ci_git_base + ' ' + ci_git_branch } else { - echo "Checkout ${ghprbAuthorRepoGitUrl} main" ci_git_branch = "main" ci_git_url = "https://github.com/metal3-io/project-infra.git" + refspec = '+refs/heads/*:refs/remotes/origin/*' } agent_label="metal3ci-medium-${IMAGE_OS}" } @@ -24,13 +27,11 @@ pipeline { agent { label agent_label } environment { METAL3_CI_USER="metal3ci" - REPO_ORG = "${PROJECT_REPO_ORG}" - REPO_NAME = "${PROJECT_REPO_NAME}" - UPDATED_REPO = "${ghprbAuthorRepoGitUrl}" - REPO_BRANCH = "${ghprbTargetBranch}" - UPDATED_BRANCH = "${ghprbActualCommit}" + REPO_ORG = "${env.REPO_OWNER}" + REPO_NAME = "${env.REPO_NAME}" + REPO_BRANCH = "${env.PULL_BASE_REF}" BUILD_TAG = "${env.BUILD_TAG}" - PR_ID = "${ghprbPullId}" + PR_ID = "${env.PULL_NUMBER}" IMAGE_OS = "${IMAGE_OS}" CAPI_VERSION = "${CAPI_VERSION}" CAPM3_VERSION = "${CAPM3_VERSION}" @@ -69,7 +70,8 @@ pipeline { submoduleCfg: [], userRemoteConfigs: [ [credentialsId: ci_git_credential_id, - url: ci_git_url + url: ci_git_url, + refspec: refspec ] ] ]) diff --git a/jenkins/scripts/dynamic_worker_workflow/dev_env_integration_tests.sh b/jenkins/scripts/dynamic_worker_workflow/dev_env_integration_tests.sh index 67ea5923..a9202dbe 100755 --- a/jenkins/scripts/dynamic_worker_workflow/dev_env_integration_tests.sh +++ b/jenkins/scripts/dynamic_worker_workflow/dev_env_integration_tests.sh @@ -12,6 +12,9 @@ CI_DIR="$(dirname "$(readlink -f "${0}")")" export IMAGE_OS="${IMAGE_OS:-ubuntu}" export REPO_ORG="${REPO_ORG:-metal3-io}" export REPO_NAME="${REPO_NAME:-metal3-dev-env}" +export REPO_BRANCH="${REPO_BRANCH:-main}" +export PR_ID="${PR_ID:-}" +export PULL_PULL_SHA="${PULL_PULL_SHA:-}" export METAL3REPO="${METAL3REPO:-https://github.com/metal3-io/metal3-dev-env.git}" export METAL3BRANCH="${METAL3BRANCH:-main}" export CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH:-main}" diff --git a/prow/manifests/overlays/metal3/config.yaml b/prow/manifests/overlays/metal3/config.yaml index ed8e44f8..30cbaed1 100644 --- a/prow/manifests/overlays/metal3/config.yaml +++ b/prow/manifests/overlays/metal3/config.yaml @@ -1001,6 +1001,39 @@ presubmits: agent: jenkins always_run: false optional: true + # name: dev-env-integration-test-{image_os}-{capm3_target_branch} + - name: dev-env-integration-test-centos-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-4 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-4 + agent: jenkins + always_run: false + optional: true metal3-io/cluster-api-provider-metal3: - name: gomod branches: @@ -1625,6 +1658,39 @@ presubmits: agent: jenkins always_run: false optional: true + # name: dev-env-integration-test-{image_os}-{capm3_target_branch} + - name: dev-env-integration-test-centos-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-4 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-4 + agent: jenkins + always_run: false + optional: true metal3-io/community: - name: markdownlint run_if_changed: '(\.md|markdownlint\.sh)$' @@ -1915,6 +1981,39 @@ presubmits: agent: jenkins always_run: false optional: true + # name: dev-env-integration-test-{image_os}-{capm3_target_branch} + - name: dev-env-integration-test-centos-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-4 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-4 + agent: jenkins + always_run: false + optional: true metal3-io/project-infra: - name: check-prow-config skip_if_only_changed: '(((^|/)OWNERS)|(\.md))$' @@ -2192,6 +2291,39 @@ presubmits: agent: jenkins always_run: false optional: true + # name: dev-env-integration-test-{image_os}-{capm3_target_branch} + - name: dev-env-integration-test-centos-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-4 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-4 + agent: jenkins + always_run: false + optional: true metal3-io/metal3-docs: - name: markdownlint run_if_changed: '(\.md|markdownlint\.sh)$' @@ -2808,6 +2940,39 @@ presubmits: agent: jenkins always_run: false optional: true + # name: dev-env-integration-test-{image_os}-{capm3_target_branch} + - name: dev-env-integration-test-centos-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-centos-release-1-4 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-main + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-6 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-5 + agent: jenkins + always_run: false + optional: true + - name: dev-env-integration-test-ubuntu-release-1-4 + agent: jenkins + always_run: false + optional: true metal3-io/ironic-ipa-downloader: - name: shellcheck run_if_changed: '((\.sh)|^Makefile)$'