Skip to content

Commit

Permalink
Fetch changes from pr-id when triggering from prow
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammed Boukhalfa <mohammed.boukhalfa@est.tech>
  • Loading branch information
mboukhalfa committed Mar 7, 2024
1 parent 0e8d93b commit b2b98d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jenkins/jobs/prow_integration_tests.pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ KUBECTL_SHA256=(env.KUBECTL_SHA256)

script {
UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
ci_git_url = "https://github.com/metal3-io/project-infra.git"
ci_git_url = "https://github.com/Nordix/metal3-project-infra.git"

if ("${PROJECT_REPO_ORG}" == "metal3-io" && "${PROJECT_REPO_NAME}" == "project-infra") {
ci_git_branch = (env.PULL_PULL_SHA) ?: (env.ghprbActualCommit) ?: "main"
ci_git_branch = (env.PULL_PULL_SHA) ?: (env.ghprbActualCommit) ?: "fetch-changes-from-pr-id/mboukhalfa"
} else {
ci_git_branch = "main"
ci_git_branch = "fetch-changes-from-pr-id/mboukhalfa"
}
echo "Checkout ${ci_git_url} branch ${ci_git_branch}"

Expand Down
2 changes: 2 additions & 0 deletions jenkins/scripts/files/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ if [[ "${UPDATED_REPO}" != *"${REPO_ORG}/${REPO_NAME}"* ]] ||
git config user.name "Test"
git remote add test "${UPDATED_REPO}"
git fetch test
# if triggered from prow we cannot get the ghprbAuthorRepoGitUrl then we pull the PR
git fetch origin "pull/${PR_ID:-0}/head:${UPDATED_BRANCH}-branch" || true
# Merging the PR with the target branch
git merge "${UPDATED_BRANCH}" || exit
fi
Expand Down
2 changes: 2 additions & 0 deletions jenkins/scripts/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ REPO_ORG="${REPO_ORG:-metal3-io}"
REPO_NAME="${REPO_NAME:-metal3-dev-env}"
UPDATED_REPO="${UPDATED_REPO:-https://github.com/${REPO_ORG}/${REPO_NAME}.git}"
UPDATED_BRANCH="${UPDATED_BRANCH:-main}"
PR_ID="${PR_ID:-0}"
CAPI_VERSION="${CAPI_VERSION:-v1beta1}"
CAPM3_VERSION="${CAPM3_VERSION:-v1beta1}"
CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH:-main}"
Expand Down Expand Up @@ -140,6 +141,7 @@ REPO_NAME="${REPO_NAME}"
REPO_BRANCH="${REPO_BRANCH}"
UPDATED_REPO="${UPDATED_REPO}"
UPDATED_BRANCH="${UPDATED_BRANCH}"
PR_ID="${PR_ID}"
CAPI_VERSION="${CAPI_VERSION}"
CAPM3_VERSION="${CAPM3_VERSION}"
CAPM3RELEASEBRANCH="${CAPM3RELEASEBRANCH}"
Expand Down

0 comments on commit b2b98d9

Please sign in to comment.