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

feat : test pull artifacts from edres-core

parent e7c8ab02
No related branches found
No related tags found
1 merge request!47Draft: TEST_CI_FORK_DO_NOT_MERGE
......@@ -35,16 +35,22 @@ build:ubuntu_cpp:
- apt-get install -y jq
# Check group namespace is valid, if not DEPENDENCY_ID=6437 (aidge group ID)
- >
if [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}") -eq 404 ]; then
echo "Using aidge group id by default"
DEPENDENCY_ID=$(curl "https://gitlab.eclipse.org/api/v4/groups/6437/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id')
else
# nominal case : we are in the official project
if [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}") != 404 ]; then
DEPENDENCY_ID=$(curl "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id')
echo "curling from \"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"
else # case for fork
echo "Retrieving build_artifacts from hrouis' forked project."
USER_ID=17216
DEPENDENCY_ID=$(curl 'https://gitlab.eclipse.org/api/v4/users/$USER_ID/projects?search=aidge_core' | jq -r '.[0].id')
# retrieve latest pipeline of given branch, independant from its success or failure
PIPELINE_ID=$(curl 'https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/pipelines?ref=${BRANCH_TO_PULL}&order_by=updated_at&sort=desc' | jq -r '.[0].id')
JOB_ID=$(curl "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/pipelines/$PIPELINE_ID/jobs" | jq 'map(select(.name == ${DEPENDENCY_JOB})) | .[0].id')
echo "curling from \"https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts\""
curl --location "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts" --output build_artifacts.zip
fi
- echo "Project ID for ${DEPENDENCY_NAME} is ${DEPENDENCY_ID}"
- echo "curling from 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"
- set +x
- unzip -q -o build_artifacts.zip -d .
- rm -rf build_cpp
......
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