Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
templates
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tecnalia_robotics-public
templates
Merge requests
!70
Resolve "Update deprecated deploy job"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Update deprecated deploy job"
38-update-deprecated-deploy-job
into
master
Overview
70
Commits
43
Pipelines
38
Changes
1
Merged
Iñigo Moreno i Caireta
requested to merge
38-update-deprecated-deploy-job
into
master
3 years ago
Overview
18
Commits
43
Pipelines
38
Changes
1
Closes
#38 (closed)
Edited
3 years ago
by
Iñigo Moreno i Caireta
0
0
Merge request reports
Viewing commit
be562e8d
Prev
Next
Show latest version
1 file
+
7
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
be562e8d
Add echos to show image name and tag
· be562e8d
Iñigo Moreno i Caireta
authored
3 years ago
ci-templates/industrial-ci-templates.yml
+
45
−
18
View file @ d1022adf
Edit in single-file editor
Open in Web IDE
Show full file
@@ -14,24 +14,51 @@
CMAKE_ARGS
:
-DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context
.
industrial_ci_
deploy
:
extends
:
.industrial_ci
.
d
deploy
:
stage
:
deploy
variables
:
AFTER_SCRIPT
:
"
wget
-q
-O
-
https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/pre-deploy-cleanup.bash
|
bash"
DOCKER_COMMIT
:
industrial_ci_image
DOCKER_PUSH_REGISTRY
:
${ARTIFACT_DOCKER_URL}
DOCKER_PUSH_NAME
:
${CI_PROJECT_PATH}
DOCKER_PUSH_TAG
:
${CI_COMMIT_REF_SLUG}
DDEPLOY_YAML
:
ddeploy.yaml
before_script
:
-
apk add --update python3 git py3-pip git-lfs
# forward the SSH authentication into the Docker executor
-
"
which
ssh-agent
||
(
apk
update
&&
apk
add
openssh-client
)"
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh
-
echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
-
chmod 700 ~/.ssh
# setup LFS authentication
-
git lfs install
-
git config --global credential.helper store
-
echo https://$ARTIFACT_CI_USER:$ARTIFACT_CI_TOKEN@artifact.tecnalia.com > ~/.git-credentials
# install ddeploy
-
pip install git+ssh://git@git.code.tecnalia.com/tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy.git@v0.1.0
-
docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
script
:
-
.ci_config/gitlab.sh
-
cd $(mktemp -d)
-
wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/-/archive/master/gitlab_templates-master.zip
-
unzip gitlab_templates-master.zip && cd gitlab_templates-master/deploy
-
cd base
-
chmod a+x ros_entrypoint.bash
-
docker build -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} .
-
docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
-
cd ..
-
cd dev
-
docker build --build-arg APPLICATION_IMAGE=${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev .
-
docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev
-
cd ..
# Run ddeploy
-
ddeploy --yaml ${DDEPLOY_YAML}
# Get ID of image created by ddeploy
-
'
DOCKER_ID=$(docker
images
--format="{{.ID}}"
|
head
-1)'
# Tag and push with the branch or tag name.
-
echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}"
-
docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}
-
docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}
# Tag and push with commit sha
-
echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}"
-
docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}
-
docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}
# Tag and push with latest only if it's on the default branch
-
>
if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then
echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest"
docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest &&
docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest;
fi
rules
:
-
if
:
$DEPLOY
-
if
:
$CI_COMMIT_TAG
when
:
always
-
when
:
manual
allow_failure
:
true
Loading