Skip to content
Snippets Groups Projects
Commit 456abf6b authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

chore : formatting

parent df557de2
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
echo "**" echo "**"
echo "** RETRIEVING \$DEP_NAME\'S PROJECT ID" echo "** RETRIEVING \$DEP_NAME'S PROJECT ID"
echo "**" echo "**"
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
DEP_BRANCHES=$(curl -s "$API_URL/projects/$DEP_ID/repository/branches") DEP_BRANCHES=$(curl -s "$API_URL/projects/$DEP_ID/repository/branches")
echo "Choosing a branch to pull dependending if we are in a Non draft merge request or not." echo "Choosing a branch to pull dependending if we are in a Non draft merge request or not."
echo "CI_MERGE_REQUEST_TITLE = $CI_MERGE_REQUEST_TITLE" echo "CI_MERGE_REQUEST_TITLE = $CI_MERGE_REQUEST_TITLE"
if [[ ! -z "$CI_MERGE_REQUEST_ID" && $CI_MERGE_REQUEST_TITLE != *'Draft'* ]]; then # case we are in a merge request if [[ ! -z "$CI_MERGE_REQUEST_ID" && "$CI_MERGE_REQUEST_TITLE" != *'Draft'* ]]; then # case we are in a merge request
set +x set +x
# If the MR is not in draft: pulling from target branch (if exists otherwise dev) # If the MR is not in draft: pulling from target branch (if exists otherwise dev)
echo "NON DRAFT MERGE REQUEST Pipeline detected : Pulling from CI_MERGE_REQUEST_TARGET_BRANCH_NAME \"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME\"." echo "NON DRAFT MERGE REQUEST Pipeline detected : Pulling from CI_MERGE_REQUEST_TARGET_BRANCH_NAME \"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME\"."
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
echo "**" echo "**"
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
echo "****************************************************************************************************************************" echo "****************************************************************************************************************************"
###################################################################################################### ######################################################################################################
# Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL (including MR pipelines) # Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL (including MR pipelines)
# and sort them from newest to oldest # and sort them from newest to oldest
...@@ -120,10 +121,10 @@ ...@@ -120,10 +121,10 @@
fi fi
set -x set -x
PIPELINES=$( PIPELINES=$(
jq \ jq \
-n \ -n \
--argjson pipelines "$PIPELINES" \ --argjson pipelines "$PIPELINES" \
--argjson mr_pipelines "$MR_PIPELINES" \ --argjson mr_pipelines "$MR_PIPELINES" \
--arg project_namespace "$CI_PROJECT_NAMESPACE" \ --arg project_namespace "$CI_PROJECT_NAMESPACE" \
'$pipelines + $mr_pipelines '$pipelines + $mr_pipelines
| map(select(.web_url | test($project_namespace))) | map(select(.web_url | test($project_namespace)))
...@@ -170,13 +171,15 @@ ...@@ -170,13 +171,15 @@
echo "Retrieving only part of the job json for readbility" echo "Retrieving only part of the job json for readbility"
set -x set -x
JOBS="$(jq --arg job_name "$DEPENDENCY_JOB" \ JOBS="$(jq --arg job_name "$DEPENDENCY_JOB" \
--arg branch_name "$BRANCH_TO_PULL" \ --arg branch_name "$BRANCH_TO_PULL" \
--arg repo_name "$DEP_NAME" \ --arg repo_name "$DEP_NAME" \
--arg repo_id "$DEP_ID" \
'[ '[
map(select((.name == $job_name) and (.status == "success"))) | map(select((.name == $job_name) and (.status == "success"))) |
.[] | .[] |
{ {
repo : $repo_name, repo : $repo_name,
repo_id : $repo_id
branch_to_pull : $branch_name, branch_to_pull : $branch_name,
id, status, name, ref, created_at, updated_at, id, status, name, ref, created_at, updated_at,
user : { id : .user.id, username : .user.username }, user : { id : .user.id, username : .user.username },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment