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
ff33227f
Commit
ff33227f
authored
1 year ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
Refactor download_dependency script for better future debugging.
parent
8c93ea4b
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/shared_script.gitlab-ci.yml
+15
-14
15 additions, 14 deletions
.gitlab/ci/shared_script.gitlab-ci.yml
with
15 additions
and
14 deletions
.gitlab/ci/shared_script.gitlab-ci.yml
+
15
−
14
View file @
ff33227f
...
...
@@ -4,25 +4,26 @@
# - DEPENDENCY_NAME: Name of the dependency project
# - DEPENDENCY_JOB: Name of the dependency job from which you want to pull artifacts
script
:
-
DEFAULT_BRANCH="dev"
-
BRANCH_TO_PULL="dev"
# default branch
# Check if a branch with the same name exist on the dependance repository
-
>
if [ "$CI_MERGE_REQUEST_ID" ]; then
if [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME/-/tree/$CI_COMMIT_REF_NAME") -eq 404 ]; then
echo "Pull from ${DEFAULT_BRANCH}"
curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$DEFAULT_BRANCH/download?job=$JOB
"
else
# Pulling from target branch
echo "Pull from ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$
CI_MERGE_REQUEST_TARGET_BRANCH_NAME
/download?job=$JOB"
fi
echo "Merge request pipeline detected"
if [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME") -eq 404 ]; then
echo "Pull from default
"
else
# Pulling from target branch
echo "Pull from ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
BRANCH_TO_PULL=${
CI_MERGE_REQUEST_TARGET_BRANCH_NAME
}
fi
elif [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -eq 404 ]; then
echo "Pull from ${DEFAULT_BRANCH}"
curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$DEFAULT_BRANCH/download?job=$JOB"
echo "Pull from default"
else
# Pulling from branch with same name
echo "Pull from
${CI_COMMIT_REF_NAME}
"
curl --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$CI_COMMIT_REF_NAME/download?job=$JOB"
# Pulling from branch with same name
echo "Pull from
branch name
"
BRANCH_TO_PULL=${CI_COMMIT_REF_NAME}
fi
-
echo "curling from https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-
curl -f --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-
unzip -o build_artifacts.zip -d .
-
rm -rf build_cpp
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