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
f64c77f9
Commit
f64c77f9
authored
1 year ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
Add download_dependency_windows script.
parent
9ec85a9b
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
+65
-0
65 additions, 0 deletions
.gitlab/ci/shared_script.gitlab-ci.yml
with
65 additions
and
0 deletions
.gitlab/ci/shared_script.gitlab-ci.yml
+
65
−
0
View file @
f64c77f9
...
@@ -31,3 +31,68 @@
...
@@ -31,3 +31,68 @@
-
curl -f --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-
curl -f --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-
unzip -o build_artifacts.zip -d .
-
unzip -o build_artifacts.zip -d .
-
rm -rf build_cpp
-
rm -rf build_cpp
.download_dependency_windows
:
# Note:
# For this script to work you need to define teh following variables
# - DEPENDENCY_NAME: Name of the dependency project
# - DEPENDENCY_JOB: Name of the dependency job from which you want to pull artifacts
script
:
# Download dependencies
-
$BRANCH_TO_PULL="dev"
# default branch
-
$STATUS_CODE_TARGET
# Check CI_MERGE_REQUEST_TARGET_BRANCH_NAME is available on dependency
-
>
try {
$response = Invoke-RestMethod -Uri "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" -Method Get
$STATUS_CODE_TARGET=$response.StatusCode
} catch {
# Handle specific status codes
if ($_.Exception.Response -ne $null) {
$STATUS_CODE_TARGET = [int]$($_.Exception.Response.StatusCode)
} else {
Write-Host "Error: $($_.Exception.Message)"
}
}
-
$STATUS_CODE_NAME
# Check CI_MERGE_REQUEST_TARGET_BRANCH_NAME is available on dependency
-
>
try {
$response = Invoke-RestMethod -Uri "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME" -Method Get
$STATUS_CODE_NAME=$response.StatusCode
} catch {
# Handle specific status codes
if ($_.Exception.Response -ne $null) {
$STATUS_CODE_NAME = [int]$($_.Exception.Response.StatusCode)
} else {
Write-Host "Error: $($_.Exception.Message)"
}
}
-
$DependencyId=(Invoke-RestMethod -Uri "https://gitlab.eclipse.org/api/v4/groups/$CI_PROJECT_NAMESPACE_ID/projects?search=$DEPENDENCY_NAME" -Method Get)[0].id
-
>
if ($CI_MERGE_REQUEST_ID) {
Write-Host "Merge request pipeline detected"
if ($STATUS_CODE_TARGET -eq 404) {
Write-Host "Pull from default MR"
}
else {
# Pulling from target branch
Write-Host "Pull from $($CI_MERGE_REQUEST_TARGET_BRANCH_NAME)"
$BRANCH_TO_PULL = $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
}
}
elseif ($STATUS_CODE_NAME -eq 404) {
Write-Host "Pull from default"
}
else {
# Pulling from branch with the same name
Write-Host "Pull from branch name"
$BRANCH_TO_PULL = $CI_COMMIT_REF_NAME
}
-
Write-Host "curling from https://gitlab.eclipse.org/api/v4/projects/5139/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-
'
curl
"https://gitlab.eclipse.org/api/v4/projects/$DependencyId/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-o
build_artifacts.zip'
-
Expand-Archive -Path build_artifacts.zip -DestinationPath . -Force
-
Remove-Item .\build_cpp\ -Recurse -ErrorAction Ignore
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