Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
ddda70e0
Commit
ddda70e0
authored
1 year ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
83747322
No related branches found
No related tags found
3 merge requests
!476
spdlog version upgrade
,
!473
Rerefactor
,
!472
Merge ProcessorLandmarkExternal
Pipeline
#17058
canceled
1 year ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.ci_templates/.license_headers.yml
+53
-0
53 additions, 0 deletions
.ci_templates/.license_headers.yml
with
53 additions
and
0 deletions
.ci_templates/.license_headers.yml
0 → 100644
+
53
−
0
View file @
ddda70e0
.license_header_script
:
-
cd $CI_PROJECT_DIR
# create 'ci_deps' folder (if not exists)
-
mkdir -pv ci_deps
# configure git
-
git remote set-url origin "ssh://git@gitlab.iri.upc.edu:2202/${CI_PROJECT_PATH}.git"
-
git pull origin ${CI_COMMIT_REF_NAME}
-
git config --global user.email "${CI_EMAIL}"
-
git config --global user.name "${CI_USERNAME}"
# create temporary branch
-
if [ `git rev-parse --verify ci_license_header 2>/dev/null` ]; then
-
git branch --delete ci_license_header
-
fi
-
export CI_NEW_BRANCH_LICENSE=ci_license_header
-
echo creating new temporary branch... $CI_NEW_BRANCH_LICENSE
-
git checkout -b $CI_NEW_BRANCH_LICENSE
# download license script
-
if [ -f /ci_deps/license_manager.sh ]; then
-
echo "File license_manager.sh already exists."
-
else
-
echo "Downloading file license_manager.sh..."
-
wget -P /ci_deps https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/wolf/-/raw/$WOLF_CORE_BRANCH/wolf_scripts/license_manager.sh
-
fi
# license headers
-
export CURRENT_YEAR=$( date +'%Y' )
-
echo "current year:" ${CURRENT_YEAR}
-
if [ -f license_header_${CURRENT_YEAR}.txt ]; then
# add license headers to new files
-
echo "File license_header_${CURRENT_YEAR}.txt already exists. License headers are assumed to be updated. Adding headers to new files..."
-
source /ci_deps/license_manager.sh --add --path=. --config-path=. --exclude=ci_deps
-
else
# remove license headers of all files
-
source /ci_deps/license_manager.sh --remove --path=. --config-path=. --exclude=ci_deps
# update license header
-
export PREV_YEAR=$(( CURRENT_YEAR-1 ))
-
echo "Creating new file license_header_${CURRENT_YEAR}.txt..."
-
git mv license_header_${PREV_YEAR}.txt license_header_${CURRENT_YEAR}.txt
-
sed -i "s/${PREV_YEAR}/${PREV_YEAR},${CURRENT_YEAR}/g" license_header_${CURRENT_YEAR}.txt
# add new license headers to all files
-
source /ci_deps/license_manager.sh --add --path=. --config-path=. --exclude=ci_deps
-
fi
# push changes (if any)
-
if git commit -a -m "[skip ci] license headers added or modified" ; then
-
git push origin $CI_NEW_BRANCH_LICENSE:${CI_COMMIT_REF_NAME}
-
else
-
echo "No changes, nothing to commit!"
-
fi
\ 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