This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/external-mr: add checkout external MR option
This patch adds the possibility to run `deployment-pipeline` checking out an external public repository. Signed-off-by: Leandro Belli <leandro.belli@arm.com> Change-Id: I9ce6d3ec62588c693fd011e7846702193e8472fd
- Loading branch information
1 parent
dfd8410
commit 8cd7120
Showing
3 changed files
with
115 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Arm SCP/MCP Software | ||
# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
|
||
|
||
.pull-mr: | ||
image: ${CI_REGISTRY_IMAGE}/ci-base:latest | ||
variables: | ||
GIT_STRATEGY: clone | ||
GIT_CHECKOUT: "false" | ||
script: | ||
- | | ||
MR_INFO=$(curl --fail \ | ||
"${PUBLIC_REPO_API_URL}/merge_requests/${FETCH_PUBLIC_MR_NUMBER}") | ||
SCP_REFSPEC=$(printf "%s" "$MR_INFO" | jq -r .source_branch) | ||
git fetch $PUBLIC_REPO_URL $SCP_REFSPEC | ||
echo "Fetched commit:" | ||
git rev-list --format=%B --max-count=1 FETCH_HEAD | ||
git checkout FETCH_HEAD | ||
git submodule update --init --recursive --depth 1 | ||
git fetch origin main | ||
CI_MERGE_REQUEST_DIFF_BASE_SHA=$(git merge-base FETCH_HEAD origin/main) | ||
# Save ENV variables | ||
mkdir -p .env | ||
echo "CI_MERGE_REQUEST_DIFF_BASE_SHA=$CI_MERGE_REQUEST_DIFF_BASE_SHA" \ | ||
>> .env/workspace.env | ||
artifacts: | ||
reports: | ||
dotenv: .env/workspace.env | ||
paths: | ||
- . # Save workspace | ||
rules: | ||
- if: $FETCH_PUBLIC_MR == "true" | ||
|
||
.git-strategy-on-mr: | ||
rules: | ||
- if: $FETCH_PUBLIC_MR == "true" | ||
variables: | ||
GIT_STRATEGY: none | ||
- if: $FETCH_PUBLIC_MR == "false" | ||
variables: | ||
GIT_STRATEGY: fetch |