Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test_ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alejandro Lopez Gestoso
test_ci
Commits
0a6bc412
Commit
0a6bc412
authored
2 years ago
by
Alejandro Lopez Gestoso
Browse files
Options
Downloads
Patches
Plain Diff
Ci definitions + ci package
parent
6d34639d
No related branches found
No related tags found
No related merge requests found
Pipeline
#13273
failed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+202
-5
202 additions, 5 deletions
.gitlab-ci.yml
with
202 additions
and
5 deletions
.gitlab-ci.yml
+
202
−
5
View file @
0a6bc412
image
:
docker.io/labrobotica/labrobotica:latest
variables
:
GIT_SUBMODULE_STRATEGY
:
recursive
FROM_RDEPENDS_CI
:
"
false"
TAG_VERSION
:
$CI_COMMIT_TAG
PACKAGE_NAME
:
"
package"
stages
:
-
rdepends
-
build
-
update_package
-
update_reverse_dependencies
test_dep
:
stage
:
rdepends
##### definitions #####
.build_package
:
&build_package
script
:
#- git submodule sync --recursive
#- git submodule update --init --recursive
-
apt update || apt -y install ca-certificates && apt update
##Install dependencies
#- apt -y install iri-dep1-dev iri-dep2-dev
# Read dependencies from CMakeLists.txt
-
DEP=( $(grep -P '[^#]\s+SET\(CPACK_DEBIAN_PACKAGE_DEPENDS\s+"' CMakeLists.txt) )
-
declare -a DEP
-
apt update || apt -y install ca-certificates && apt update
-
|+
for ((i=1;i<${#DEP[@]};i+=3))
do
...
...
@@ -18,4 +31,188 @@
else
apt -y install ${DEP[${i}]};
fi
done
\ No newline at end of file
done
-
mkdir -pv build
-
cd build
-
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCPACK_PACKAGE_VERSION=$TAG_VERSION ..
-
make package -j $(nproc)
artifacts
:
paths
:
-
build/*.deb
expire_in
:
2 weeks
.update_repo
:
&update_repo
script
:
-
cd build
-
"
scp
-i
/root/.ssh/iriLabKeyNopwd
-r
*$PACKAGE_NAME*.deb
irilabo@labrepo.iri.upc.edu:packages/"
-
"
ssh
irilabo@labrepo.iri.upc.edu
-i
/root/.ssh/iriLabKeyNopwd
-tt
/home/irilabo/repo_scripts/update_repo.sh
$PACKAGE_NAME
$(lsb_release
-cs)"
.cleanup
:
&cleanup
# delete .rdepends_ci/rdepends_ci.yml, merge to master and delete branch
-
git config user.email labrobotica@iri.upc.edu
-
git config user.name labrobotica
-
git branch -D update_rdepends || echo "Update_depends branch already deleted"
-
git push origin --delete update_rdepends || echo "Update_depends branch already deleted"
.build_package_tag
:
&build_package_tag
rules
:
-
if
:
$FROM_RDEPENDS_CI == "false" && $CI_COMMIT_TAG =~ /\d+\.[^a-zA-Z_\s]*\d+/ && $GITLAB_USER_NAME != "rdepends_token"
<<
:
*build_package
.update_repo_tag
:
&update_repo_tag
rules
:
-
if
:
$FROM_RDEPENDS_CI == "false" && $CI_COMMIT_TAG =~ /\d+\.[^a-zA-Z_\s]*\d+/ && $GITLAB_USER_NAME != "rdepends_token"
<<
:
*update_repo
.modify_rdepends_ci
:
&modify_rdepends_ci
rules
:
-
if
:
$FROM_RDEPENDS_CI == "false" && $CI_COMMIT_TAG =~ /\d+\.[^a-zA-Z_\s]*\d+/ && $GITLAB_USER_NAME != "rdepends_token"
script
:
# Modify child pipeline
-
apt update || apt -y install ca-certificates && apt update
-
"
scp
-i
/root/.ssh/iriLabKeyNopwd
irilabo@labrepo.iri.upc.edu:repo_scripts/reverse_dependency.sh
."
-
./reverse_dependency.sh $PACKAGE_NAME
# get path
-
PROJ=( $(apt-cache show iri-$PACKAGE_NAME-dev | grep Homepage) )
-
declare -a PROJ
-
if [ ${#PROJ[@]} -eq 2 ]
-
then
-
PROJECT_STRING=${PROJ[1]#https://gitlab.iri.upc.edu/}
-
else
-
echo "No homepage found for iri-$PACKAGE_NAME-dev"
-
exit
1
-
fi
# git configuration & push
-
git config user.email labrobotica@iri.upc.edu
-
git config user.name labrobotica
-
if git checkout -b update_rdepends ; then
-
echo "Branch update_rdepends ok."
-
else
-
git branch -D update_rdepends
-
git checkout -b update_rdepends
-
echo "Re-created branch update_rdepends ok."
-
fi
-
git add .rdepends_ci/rdepends_ci.yml
-
git commit -m "Updated rdepends_ci.yml"
-
git remote set-url --push origin https://rdepends_token:$ACCESS_TOKEN@gitlab.iri.upc.edu/${PROJECT_STRING}.git || echo "Origin already exists"
-
git remote show origin
-
git push --set-upstream origin update_rdepends
.cleanup_branch_on_failure2
:
&cleanup_branch_on_failure2
rules
:
-
if
:
$FROM_RDEPENDS_CI == "false" && $CI_COMMIT_TAG =~ /\d+\.[^a-zA-Z_\s]*\d+/ && $GITLAB_USER_NAME != "rdepends_token"
when
:
on_failure
script
:
-
*cleanup
needs
:
[
modify-rdepends-ci
]
.trigger_rdepends_ci
:
&trigger_rdepends_ci
rules
:
-
if
:
$CI_COMMIT_BRANCH == "update_rdepends"
trigger
:
include
:
.rdepends_ci/rdepends_ci.yml
strategy
:
depend
.cleanup_branch
:
&cleanup_branch
rules
:
-
if
:
$CI_COMMIT_BRANCH == "update_rdepends"
script
:
-
*cleanup
needs
:
[
trigger-rdepends-ci
]
.cleanup_branch_on_failure
:
&cleanup_branch_on_failure
rules
:
-
if
:
$CI_COMMIT_BRANCH == "update_rdepends"
when
:
on_failure
script
:
-
*cleanup
needs
:
[
trigger-rdepends-ci
]
.generate_new_tag
:
&generate_new_tag
rules
:
-
if
:
$FROM_RDEPENDS_CI == "true"
script
:
# get path
-
PROJ=( $(apt-cache show iri-$PACKAGE_NAME-dev | grep Homepage) )
-
declare -a PROJ
-
if [ ${#PROJ[@]} -eq 2 ]
-
then
-
PROJECT_STRING=${PROJ[1]#https://gitlab.iri.upc.edu/}
-
else
-
echo "No homepage found for iri-$PACKAGE_NAME-dev"
-
exit
1
-
fi
# git configuration & tag
-
git config user.email labrobotica@iri.upc.edu
-
git config user.name labrobotica
-
git tag -a $TAG_VERSION -m "New tag by reverse dependency pipeline"
-
git remote set-url --push origin https://rdepends_token:$ACCESS_TOKEN@gitlab.iri.upc.edu/${PROJECT_STRING}.git || echo "Origin already exists"
-
git remote show origin
-
git push origin $TAG_VERSION
.build_package_rdep
:
&build_package_rdep
rules
:
-
if
:
$FROM_RDEPENDS_CI == "true"
needs
:
[
generate-new-tag
]
<<
:
*build_package
.update_repo_rdep
:
&update_repo_rdep
rules
:
-
if
:
$FROM_RDEPENDS_CI == "true"
needs
:
[
build-package-rdep
]
<<
:
*update_repo
###################
build-package-tag
:
stage
:
build
<<
:
*build_package
update-repo-tag
:
stage
:
update_package
<<
:
*update_repo_tag
modify-rdepends-ci
:
stage
:
update_reverse_dependencies
<<
:
*modify_rdepends_ci
cleanup-branch-on-failure2
:
stage
:
update_reverse_dependencies
<<
:
*cleanup_branch_on_failure2
trigger-rdepends-ci
:
stage
:
update_reverse_dependencies
<<
:
*trigger_rdepends_ci
cleanup-branch
:
stage
:
update_reverse_dependencies
<<
:
*cleanup_branch
cleanup-branch-on-failure
:
stage
:
update_reverse_dependencies
<<
:
*cleanup_branch_on_failure
generate-new-tag
:
stage
:
update_reverse_dependencies
<<
:
*generate_new_tag
build-package-rdep
:
stage
:
update_reverse_dependencies
<<
:
*build_package_rdep
update-repo-rdep
:
stage
:
update_reverse_dependencies
<<
:
*update_repo_rdep
\ No newline at end of file
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