Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab_shared_files
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
gitlab_shared_files
Commits
dd9f5ecc
Commit
dd9f5ecc
authored
6 months ago
by
Grégoire Kubler
Browse files
Options
Downloads
Patches
Plain Diff
feat: homoegeineized the API call to retrieve branches
parent
d2fec098
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab/ci/download/select_jobs.gitlab-ci.yml
+4
-3
4 additions, 3 deletions
.gitlab/ci/download/select_jobs.gitlab-ci.yml
with
4 additions
and
3 deletions
.gitlab/ci/download/select_jobs.gitlab-ci.yml
+
4
−
3
View file @
dd9f5ecc
...
...
@@ -55,14 +55,13 @@
echo "*************************************************************************"
echo "*************************************************************************"
echo "**"
echo "**
CHOOSING WHICH BRANCH TO PULL"
echo "** CHOOSING WHICH BRANCH
/ RELEASE / REF
TO PULL"
echo "**"
echo "*************************************************************************"
echo "*************************************************************************"
DEFAULT_BRANCH="dev" # default branch to pull
BRANCH_TO_PULL=$DEFAULT_BRANCH # default branch to pull
echo "Default branch to pull : $BRANCH_TO_PULL"
echo "Retrieving branches of $DEP_NAME \"$DEP_API_URL/repository/branches\""
echo "Choosing a branch / tag to pull dependending if we are in a Non draft merge request or not."
echo "CI_COMMIT_TAG = $CI_COMMIT_TAG"
echo "CI_MERGE_REQUEST_ID = $CI_MERGE_REQUEST_ID"
...
...
@@ -71,6 +70,7 @@
################################
# CASE NON DRAFT MERGE REQUEST
if [[ ! -z "$CI_MERGE_REQUEST_ID" && "$CI_MERGE_REQUEST_TITLE" != *'Draft'* ]]; then # case we are in a merge request
echo "Retrieving branches of $DEP_NAME \"$DEP_API_URL/repository/branches?per_page=100\""
DEP_BRANCHES=$(curl -s "$DEP_API_URL/repository/branches?per_page=100")
# 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\"."
...
...
@@ -115,7 +115,8 @@
# CASE CASUAL COMMIT or Draft MR PIPELINE
else
# checking if a branch with same name exists in $DEP_NAME, otherwise, pulling from DEV
DEP_BRANCHES=$(curl -s "$DEP_API_URL/repository/branches")
echo "Retrieving branches of $DEP_NAME \"$DEP_API_URL/repository/branches?per_page=100\""
DEP_BRANCHES=$(curl -s "$DEP_API_URL/repository/branches?per_page=100")
echo "Looking for branch $CI_COMMIT_BRANCH in repo $DEP_NAME"
FILTERED_BRANCHES=$(jq --arg branch "$CI_COMMIT_REF_NAME" 'map(select( .name == $branch ))' <<<"$DEP_BRANCHES")
if [[ $(jq length <<<$FILTERED_BRANCHES) -gt 0 ]]; then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment