From de85c6431df5e77c276be03128a95219526e13c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Fri, 1 Oct 2021 13:13:50 +0200 Subject: [PATCH 01/39] First implementation of ddeploy job --- ci-templates/auto-rules/no-default.yml | 18 ++--- .../auto-rules/with-rosinstall/no-default.yml | 4 ++ ci-templates/industrial-ci-templates.yml | 70 ++++++++++++++----- deploy/base/Dockerfile | 12 ---- deploy/base/ros_entrypoint.bash | 7 -- deploy/dev/Dockerfile | 28 -------- 6 files changed, 64 insertions(+), 75 deletions(-) delete mode 100644 deploy/base/Dockerfile delete mode 100755 deploy/base/ros_entrypoint.bash delete mode 100644 deploy/dev/Dockerfile diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 7db60c8..d485c4b 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -61,25 +61,25 @@ industrial_ci_noetic: industrial_kinetic_deploy: - extends: - - industrial_ci_kinetic - - .industrial_ci_deploy + extends: .ddeploy + variables: + ROS_DISTRO: kinetic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic" - if: $DEPLOY && $BUILD_KINETIC industrial_melodic_deploy: - extends: - - industrial_ci_melodic - - .industrial_ci_deploy + extends: .ddeploy + variables: + ROS_DISTRO: melodic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "melodic" - if: $DEPLOY && $BUILD_MELODIC industrial_noetic_deploy: - extends: - - industrial_ci_noetic - - .industrial_ci_deploy + extends: .ddeploy + variables: + ROS_DISTRO: noetic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "noetic" - if: $DEPLOY && $BUILD_NOETIC diff --git a/ci-templates/auto-rules/with-rosinstall/no-default.yml b/ci-templates/auto-rules/with-rosinstall/no-default.yml index 5ffe30c..6c72a4f 100644 --- a/ci-templates/auto-rules/with-rosinstall/no-default.yml +++ b/ci-templates/auto-rules/with-rosinstall/no-default.yml @@ -4,3 +4,7 @@ include: ci-templates/auto-rules/no-default.yml .industrial_ci: variables: UPSTREAM_WORKSPACE: .rosinstall + +.ddeploy: + variables: + UPSTREAM_WORKSPACE: .rosinstall diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index b1c5d84..06d2257 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -14,24 +14,56 @@ CMAKE_ARGS: -DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context -.industrial_ci_deploy: - extends: .industrial_ci +.ddeploy: + stage: build 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_BASE_REGISTRY: tecnalia-robotics-docker.artifact.tecnalia.com + DOCKER_BASE_USER: ${ARTIFACT_CI_USER} + DOCKER_BASE_TOKEN: ${ARTIFACT_CI_TOKEN} + DOCKER_BASE_NAME: flexbotics-base-devel + DOCKER_BASE_TAG: ${ROS_DISTRO} + DOCKER_PUSH_REGISTRY: tecnalia-robotics-docker.artifact.tecnalia.com + DOCKER_PUSH_USER: ${ARTIFACT_CI_USER} + DOCKER_PUSH_TOKEN: ${ARTIFACT_CI_TOKEN} + DOCKER_PUSH_NAME: ${CI_PROJECT_NAME} + DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} + DDEPLOY_SOURCE: . + DDEPLOY_EXTRA_SOURCE: /tmp/empty.rosinstall + DDEPLOY_BEFORE_SCRIPT: "" + DDEPLOY_AFTER_SCRIPT: "" + DDEPLOY_CMD: "$${SHELL}" + DDEPLOY_EXTRA_ARGS: "" + before_script: + - docker info + - 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 + - oldpath=$(pwd) && cd /tmp && git clone --quiet --depth 1 git@git.code.tecnalia.com:tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy.git && cd ddeploy && pip install -r requirements.txt && pip install . && cd $oldpath + - docker login ${DOCKER_BASE_REGISTRY} -u ${DOCKER_BASE_USER} -p ${DOCKER_BASE_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 .. - rules: - - if: $DEPLOY + - echo "[]" > /tmp/empty.rosinstall + - ddeploy \ + --project-sources ${DDEPLOY_SOURCE} \ + --project-sources ${DDEPLOY_EXTRA_SOURCE} \ + --project-name ${DOCKER_PUSH_NAME} \ + --ros-distro ${ROS_DISTRO} \ + --image-name ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} \ + --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} \ + --before-script ${DDEPLOY_BEFORE_SCRIPT} \ + --after-script ${DDEPLOY_AFTER_SCRIPT} \ + --cmd ${DDEPLOY_CMD} \ + ${DDEPLOY_EXTRA_ARGS} + - docker tag ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest + - docker login ${DOCKER_PUSH_REGISTRY} -u ${DOCKER_PUSH_USER} -p ${DOCKER_PUSH_TOKEN} + - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} + - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest diff --git a/deploy/base/Dockerfile b/deploy/base/Dockerfile deleted file mode 100644 index b5cd8cb..0000000 --- a/deploy/base/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM industrial_ci_image - -RUN rm -rf /root/ici /root/src - -RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \ - ros-kinetic-rosbash \ - && rm -rf /var/lib/apt/lists/* - -COPY ./ros_entrypoint.bash / - -ENTRYPOINT ["/ros_entrypoint.bash"] -CMD ["bash"] diff --git a/deploy/base/ros_entrypoint.bash b/deploy/base/ros_entrypoint.bash deleted file mode 100755 index a203d40..0000000 --- a/deploy/base/ros_entrypoint.bash +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e - -# setup application environment -# shellcheck disable=SC1091 -source "/root/target_ws/install/setup.bash" -exec "$@" diff --git a/deploy/dev/Dockerfile b/deploy/dev/Dockerfile deleted file mode 100644 index 8d1f938..0000000 --- a/deploy/dev/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -ARG APPLICATION_IMAGE -FROM ${APPLICATION_IMAGE} - -RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \ - apt-transport-https \ - curl \ - libasound2 \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \ - && mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \ - && sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' - -RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \ - code \ - && rm -rf /var/lib/apt/lists/* - -RUN echo "alias code='code --user-data-dir /root'" >> /root/.bashrc - -RUN code --user-data-dir /root \ - --install-extension ms-iot.vscode-ros \ - --install-extension joaompinto.asciidoctor-vscode \ - --install-extension ms-python.python \ - --install-extension ms-vscode.cpptools \ - --install-extension ms-azuretools.vscode-docker \ - --install-extension twxs.cmake -- GitLab From 199ed08467596f2b3760ced668fbe38014ee0ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moreno=20i=20Caireta=2C=20I=C3=B1igo?= <inigo.moreno@tecnalia.com> Date: Fri, 1 Oct 2021 13:21:41 +0200 Subject: [PATCH 02/39] Remove docker and shell lint from .gitlab-ci.yml --- .gitlab-ci.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be9910d..4d75175 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,3 @@ -shellcheck: - image: tecnalia-docker-dev.artifact.tecnalia.com/koalaman/shellcheck-alpine - script: shellcheck deploy/base/ros_entrypoint.bash scripts/*sh - tags: - - docker - -# The ignored rules in hadolint checks are -# DL3006 Always tag the version of an image explicitly -# One of the Dockerfiles uses a temporary image which isn't important to tag -# and the other uses a tagged image through an ARG, which apparently is not -# properly recognized. -# DL3008 Pin versions in apt-get install -# A bit overkill -dockerfiles: - image: tecnalia-docker-dev.artifact.tecnalia.com/hadolint/hadolint:latest-debian - script: - - RET=0 - - hadolint --ignore DL3006 --ignore DL3008 --ignore DL3059 deploy/base/Dockerfile || RET=1 - - hadolint --ignore DL3006 --ignore DL3008 --ignore DL3059 deploy/dev/Dockerfile || RET=1 - - exit $RET - tags: - - docker - yamllint: image: tecnalia-docker-dev.artifact.tecnalia.com/sdesbure/yamllint script: yamllint $(find . -name '*.yml' -o -name '*.yaml') -- GitLab From 24ea5b18ec121a09370c9bdbf636d4f7184e412f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Fri, 1 Oct 2021 13:58:40 +0200 Subject: [PATCH 03/39] Test >- in yaml --- ci-templates/industrial-ci-templates.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 06d2257..7ce197e 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -52,7 +52,8 @@ - docker login ${DOCKER_BASE_REGISTRY} -u ${DOCKER_BASE_USER} -p ${DOCKER_BASE_TOKEN} script: - echo "[]" > /tmp/empty.rosinstall - - ddeploy \ + - >- + ddeploy --project-sources ${DDEPLOY_SOURCE} \ --project-sources ${DDEPLOY_EXTRA_SOURCE} \ --project-name ${DOCKER_PUSH_NAME} \ -- GitLab From 2dd09a2475ed98d5ef8c40b304b9b75bd63a9c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Fri, 1 Oct 2021 14:19:27 +0200 Subject: [PATCH 04/39] Test removing \ --- ci-templates/industrial-ci-templates.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 7ce197e..0813cbc 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -54,15 +54,15 @@ - echo "[]" > /tmp/empty.rosinstall - >- ddeploy - --project-sources ${DDEPLOY_SOURCE} \ - --project-sources ${DDEPLOY_EXTRA_SOURCE} \ - --project-name ${DOCKER_PUSH_NAME} \ - --ros-distro ${ROS_DISTRO} \ - --image-name ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} \ - --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} \ - --before-script ${DDEPLOY_BEFORE_SCRIPT} \ - --after-script ${DDEPLOY_AFTER_SCRIPT} \ - --cmd ${DDEPLOY_CMD} \ + --project-sources ${DDEPLOY_SOURCE} + --project-sources ${DDEPLOY_EXTRA_SOURCE} + --project-name ${DOCKER_PUSH_NAME} + --ros-distro ${ROS_DISTRO} + --image-name ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} + --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} + --before-script ${DDEPLOY_BEFORE_SCRIPT} + --after-script ${DDEPLOY_AFTER_SCRIPT} + --cmd ${DDEPLOY_CMD} ${DDEPLOY_EXTRA_ARGS} - docker tag ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker login ${DOCKER_PUSH_REGISTRY} -u ${DOCKER_PUSH_USER} -p ${DOCKER_PUSH_TOKEN} -- GitLab From 185fa913e88de1a733ce101e2b02086d0ff66aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Fri, 1 Oct 2021 14:23:10 +0200 Subject: [PATCH 05/39] Surround scripts with strings --- ci-templates/industrial-ci-templates.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 0813cbc..3e49a5b 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -60,8 +60,8 @@ --ros-distro ${ROS_DISTRO} --image-name ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} - --before-script ${DDEPLOY_BEFORE_SCRIPT} - --after-script ${DDEPLOY_AFTER_SCRIPT} + --before-script "${DDEPLOY_BEFORE_SCRIPT}" + --after-script "${DDEPLOY_AFTER_SCRIPT}" --cmd ${DDEPLOY_CMD} ${DDEPLOY_EXTRA_ARGS} - docker tag ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest -- GitLab From ca196865b35ad1d7fc3f88612f1f41dca9dcd3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moreno=20i=20Caireta=2C=20I=C3=B1igo?= <inigo.moreno@tecnalia.com> Date: Mon, 4 Oct 2021 12:14:02 +0200 Subject: [PATCH 06/39] Restore shellcheck for scripts/*sh --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d75175..063220f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +shellcheck: + image: tecnalia-docker-dev.artifact.tecnalia.com/koalaman/shellcheck-alpine + script: scripts/*sh + tags: + - docker + yamllint: image: tecnalia-docker-dev.artifact.tecnalia.com/sdesbure/yamllint script: yamllint $(find . -name '*.yml' -o -name '*.yaml') -- GitLab From a41e6d1c96e26eba5f6567225a0c84c5388b6ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moreno=20i=20Caireta=2C=20I=C3=B1igo?= <inigo.moreno@tecnalia.com> Date: Mon, 4 Oct 2021 12:37:35 +0200 Subject: [PATCH 07/39] Update ci-templates/industrial-ci-templates.yml --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 3e49a5b..7062d8e 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -48,7 +48,7 @@ - git config --global credential.helper store - echo https://$ARTIFACT_CI_USER:$ARTIFACT_CI_TOKEN@artifact.tecnalia.com > ~/.git-credentials # install ddeploy - - oldpath=$(pwd) && cd /tmp && git clone --quiet --depth 1 git@git.code.tecnalia.com:tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy.git && cd ddeploy && pip install -r requirements.txt && pip install . && cd $oldpath + - pip install git+ssh://git@git.code.tecnalia.com/tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy.git - docker login ${DOCKER_BASE_REGISTRY} -u ${DOCKER_BASE_USER} -p ${DOCKER_BASE_TOKEN} script: - echo "[]" > /tmp/empty.rosinstall -- GitLab From ac4f84f3e36a7989eb04a2f6a1668191583b270d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moreno=20i=20Caireta=2C=20I=C3=B1igo?= <inigo.moreno@tecnalia.com> Date: Mon, 4 Oct 2021 12:42:51 +0200 Subject: [PATCH 08/39] Fix shellscheck --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 063220f..3d2cc4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,10 @@ shellcheck: image: tecnalia-docker-dev.artifact.tecnalia.com/koalaman/shellcheck-alpine - script: scripts/*sh + script: shellcheck scripts/*sh tags: - docker + yamllint: image: tecnalia-docker-dev.artifact.tecnalia.com/sdesbure/yamllint script: yamllint $(find . -name '*.yml' -o -name '*.yaml') -- GitLab From 6418d96efe2f2fd9561d3b1cf7366fcc37a5c0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 5 Oct 2021 14:25:47 +0200 Subject: [PATCH 09/39] Contain ddeploy cmd --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 3e49a5b..5fae22d 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -62,7 +62,7 @@ --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} --before-script "${DDEPLOY_BEFORE_SCRIPT}" --after-script "${DDEPLOY_AFTER_SCRIPT}" - --cmd ${DDEPLOY_CMD} + --cmd "${DDEPLOY_CMD}" ${DDEPLOY_EXTRA_ARGS} - docker tag ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker login ${DOCKER_PUSH_REGISTRY} -u ${DOCKER_PUSH_USER} -p ${DOCKER_PUSH_TOKEN} -- GitLab From 860aefe70dd2d9b8ae9bb9847f53febfb40dd8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 6 Oct 2021 17:01:13 +0200 Subject: [PATCH 10/39] Make .ddeploy work with the yaml only --- ci-templates/industrial-ci-templates.yml | 40 ++++++------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 690d365..5ab5207 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -17,22 +17,9 @@ .ddeploy: stage: build variables: - DOCKER_BASE_REGISTRY: tecnalia-robotics-docker.artifact.tecnalia.com - DOCKER_BASE_USER: ${ARTIFACT_CI_USER} - DOCKER_BASE_TOKEN: ${ARTIFACT_CI_TOKEN} - DOCKER_BASE_NAME: flexbotics-base-devel - DOCKER_BASE_TAG: ${ROS_DISTRO} - DOCKER_PUSH_REGISTRY: tecnalia-robotics-docker.artifact.tecnalia.com - DOCKER_PUSH_USER: ${ARTIFACT_CI_USER} - DOCKER_PUSH_TOKEN: ${ARTIFACT_CI_TOKEN} + DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} DOCKER_PUSH_NAME: ${CI_PROJECT_NAME} DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} - DDEPLOY_SOURCE: . - DDEPLOY_EXTRA_SOURCE: /tmp/empty.rosinstall - DDEPLOY_BEFORE_SCRIPT: "" - DDEPLOY_AFTER_SCRIPT: "" - DDEPLOY_CMD: "$${SHELL}" - DDEPLOY_EXTRA_ARGS: "" before_script: - docker info - apk add --update python3 git py3-pip git-lfs @@ -49,22 +36,15 @@ - 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 - - docker login ${DOCKER_BASE_REGISTRY} -u ${DOCKER_BASE_USER} -p ${DOCKER_BASE_TOKEN} + - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN} script: - - echo "[]" > /tmp/empty.rosinstall - - >- - ddeploy - --project-sources ${DDEPLOY_SOURCE} - --project-sources ${DDEPLOY_EXTRA_SOURCE} - --project-name ${DOCKER_PUSH_NAME} - --ros-distro ${ROS_DISTRO} - --image-name ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} - --base-image ${DOCKER_BASE_REGISTRY}/${DOCKER_BASE_NAME}:${DOCKER_BASE_TAG} - --before-script "${DDEPLOY_BEFORE_SCRIPT}" - --after-script "${DDEPLOY_AFTER_SCRIPT}" - --cmd "${DDEPLOY_CMD}" - ${DDEPLOY_EXTRA_ARGS} - - docker tag ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - - docker login ${DOCKER_PUSH_REGISTRY} -u ${DOCKER_PUSH_USER} -p ${DOCKER_PUSH_TOKEN} + # Run ddeploy + - ddeploy --yaml ${DDEPLOY_YAML} + # Get ID of image created by ddeploy + - DOCKER_ID=$$(docker images --format='{{.ID}}' | head -1) + # Tag and push + - 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 latest + - docker tag $${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest -- GitLab From 693a928f3f5aafe968cba63856147c0ee20bd62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 6 Oct 2021 17:01:54 +0200 Subject: [PATCH 11/39] Move ddeploy to a new deploy stage --- ci-templates/core.yml | 1 + ci-templates/industrial-ci-templates.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-templates/core.yml b/ci-templates/core.yml index 3553a10..8cacbee 100644 --- a/ci-templates/core.yml +++ b/ci-templates/core.yml @@ -16,6 +16,7 @@ services: stages: - build + - deploy before_script: - apk add --update bash coreutils tar wget diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 5ab5207..4657031 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -15,7 +15,7 @@ .ddeploy: - stage: build + stage: deploy variables: DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} DOCKER_PUSH_NAME: ${CI_PROJECT_NAME} -- GitLab From 1d9e49093d48df6a5ecf25daa17122ab3b4abd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 6 Oct 2021 17:03:42 +0200 Subject: [PATCH 12/39] Keep build jobs on tag commits --- ci-templates/auto-rules/no-default.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index d485c4b..9646c7b 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -34,8 +34,6 @@ industrial_ci_kinetic: variables: ROS_DISTRO: kinetic rules: - - if: $DEPLOY - when: never - if: $DEFAULT_DISTRO == "kinetic" - if: $BUILD_KINETIC @@ -44,8 +42,6 @@ industrial_ci_melodic: variables: ROS_DISTRO: melodic rules: - - if: $DEPLOY - when: never - if: $DEFAULT_DISTRO == "melodic" - if: $BUILD_MELODIC @@ -54,8 +50,6 @@ industrial_ci_noetic: variables: ROS_DISTRO: noetic rules: - - if: $DEPLOY - when: never - if: $DEFAULT_DISTRO == "noetic" - if: $BUILD_NOETIC -- GitLab From 0e947ebe4bff036f57558986f645a5f72f0ad841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 6 Oct 2021 17:09:36 +0200 Subject: [PATCH 13/39] Make deploy jobs only when ddeploy.yaml exists --- ci-templates/auto-rules/no-default.yml | 12 ++++++------ ci-templates/industrial-ci-templates.yml | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 9646c7b..1012ebb 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -56,24 +56,24 @@ industrial_ci_noetic: industrial_kinetic_deploy: extends: .ddeploy - variables: - ROS_DISTRO: kinetic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic" + exists: ddeploy.yaml - if: $DEPLOY && $BUILD_KINETIC + exists: ddeploy.yaml industrial_melodic_deploy: extends: .ddeploy - variables: - ROS_DISTRO: melodic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "melodic" + exists: ddeploy.yaml - if: $DEPLOY && $BUILD_MELODIC + exists: ddeploy.yaml industrial_noetic_deploy: extends: .ddeploy - variables: - ROS_DISTRO: noetic rules: - if: $DEPLOY && $DEFAULT_DISTRO == "noetic" + exists: ddeploy.yaml - if: $DEPLOY && $BUILD_NOETIC + exists: ddeploy.yaml diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 4657031..b9c6251 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -20,6 +20,7 @@ DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} DOCKER_PUSH_NAME: ${CI_PROJECT_NAME} DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} + DDEPLOY_YAML: ddeploy.yaml before_script: - docker info - apk add --update python3 git py3-pip git-lfs -- GitLab From 8ff0c598103713b4718f8730f008c934e83edf54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 6 Oct 2021 17:16:19 +0200 Subject: [PATCH 14/39] Change name to project path to avoid conflicts --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index b9c6251..0214c7a 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -18,7 +18,7 @@ stage: deploy variables: DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} - DOCKER_PUSH_NAME: ${CI_PROJECT_NAME} + DOCKER_PUSH_NAME: ${CI_PROJECT_PATH_SLUG} DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} DDEPLOY_YAML: ddeploy.yaml before_script: -- GitLab From 0a3a330a290ea6c063d802349173721fbb1f6cba Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Fri, 15 Oct 2021 12:28:03 +0200 Subject: [PATCH 15/39] Fix exists syntax --- ci-templates/auto-rules/no-default.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 1012ebb..2b9e7e8 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -58,22 +58,28 @@ industrial_kinetic_deploy: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic" - exists: ddeploy.yaml + exists: + - ddeploy.yaml - if: $DEPLOY && $BUILD_KINETIC - exists: ddeploy.yaml + exists: + - ddeploy.yaml industrial_melodic_deploy: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "melodic" - exists: ddeploy.yaml + exists: + - ddeploy.yaml - if: $DEPLOY && $BUILD_MELODIC - exists: ddeploy.yaml + exists: + - ddeploy.yaml industrial_noetic_deploy: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "noetic" - exists: ddeploy.yaml + exists: + - ddeploy.yaml - if: $DEPLOY && $BUILD_NOETIC - exists: ddeploy.yaml + exists: + - ddeploy.yaml -- GitLab From f1f5aae2cfbea43a58c061d5b306567d0fd98d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 19 Oct 2021 11:19:11 +0200 Subject: [PATCH 16/39] Remove unused CI variable on ddeploy template --- ci-templates/auto-rules/with-rosinstall/no-default.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci-templates/auto-rules/with-rosinstall/no-default.yml b/ci-templates/auto-rules/with-rosinstall/no-default.yml index 6c72a4f..5ffe30c 100644 --- a/ci-templates/auto-rules/with-rosinstall/no-default.yml +++ b/ci-templates/auto-rules/with-rosinstall/no-default.yml @@ -4,7 +4,3 @@ include: ci-templates/auto-rules/no-default.yml .industrial_ci: variables: UPSTREAM_WORKSPACE: .rosinstall - -.ddeploy: - variables: - UPSTREAM_WORKSPACE: .rosinstall -- GitLab From d84dd068f133151410e9fa834393a0d3193da4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 19 Oct 2021 11:21:43 +0200 Subject: [PATCH 17/39] Update ddeploy job names --- ci-templates/auto-rules/no-default.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 2b9e7e8..a0d1da0 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -54,7 +54,7 @@ industrial_ci_noetic: - if: $BUILD_NOETIC -industrial_kinetic_deploy: +ddeploy_kinetic: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic" @@ -64,7 +64,7 @@ industrial_kinetic_deploy: exists: - ddeploy.yaml -industrial_melodic_deploy: +ddeploy_melodic: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "melodic" @@ -74,7 +74,7 @@ industrial_melodic_deploy: exists: - ddeploy.yaml -industrial_noetic_deploy: +ddeploy_noetic: extends: .ddeploy rules: - if: $DEPLOY && $DEFAULT_DISTRO == "noetic" -- GitLab From b9f2b05a2955854275100c33b5af99dc2c69366c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 19 Oct 2021 11:25:00 +0200 Subject: [PATCH 18/39] Try to fix bug in ddeploy template --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 0214c7a..b07510e 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -42,7 +42,7 @@ # Run ddeploy - ddeploy --yaml ${DDEPLOY_YAML} # Get ID of image created by ddeploy - - DOCKER_ID=$$(docker images --format='{{.ID}}' | head -1) + - DOCKER_ID=$(docker images --format='{{.ID}}' | head -1) # Tag and push - docker tag $${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} -- GitLab From 8902beeb7d81611caee9a6c416be6b2100b3f6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 19 Oct 2021 11:32:18 +0200 Subject: [PATCH 19/39] Update rules of ddeploy to add manual job --- ci-templates/auto-rules/no-default.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index a0d1da0..8e352a0 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -57,29 +57,32 @@ industrial_ci_noetic: ddeploy_kinetic: extends: .ddeploy rules: - - if: $DEPLOY && $DEFAULT_DISTRO == "kinetic" + - if: $DEPLOY && ($DEFAULT_DISTRO == "kinetic" || $BUILD_KINETIC) exists: - ddeploy.yaml - - if: $DEPLOY && $BUILD_KINETIC + - if: $DEFAULT_DISTRO == "kinetic" || $BUILD_KINETIC exists: - ddeploy.yaml + when: manual ddeploy_melodic: extends: .ddeploy rules: - - if: $DEPLOY && $DEFAULT_DISTRO == "melodic" + - if: $DEPLOY && ($DEFAULT_DISTRO == "melodic" || $BUILD_MELODIC) exists: - ddeploy.yaml - - if: $DEPLOY && $BUILD_MELODIC + - if: $DEFAULT_DISTRO == "melodic" || $BUILD_MELODIC exists: - ddeploy.yaml + when: manual ddeploy_noetic: extends: .ddeploy rules: - - if: $DEPLOY && $DEFAULT_DISTRO == "noetic" + - if: $DEPLOY && ($DEFAULT_DISTRO == "noetic" || $BUILD_NOETIC) exists: - ddeploy.yaml - - if: $DEPLOY && $BUILD_NOETIC + - if: $DEFAULT_DISTRO == "noetic" || $BUILD_NOETIC exists: - ddeploy.yaml + when: manual -- GitLab From 88a4573f543077c66229f7359a9bee19383f3d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 19 Oct 2021 12:19:07 +0200 Subject: [PATCH 20/39] Try fixing ddeploy template bug --- ci-templates/industrial-ci-templates.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index b07510e..688e1a7 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -42,10 +42,10 @@ # Run ddeploy - ddeploy --yaml ${DDEPLOY_YAML} # Get ID of image created by ddeploy - - DOCKER_ID=$(docker images --format='{{.ID}}' | head -1) + - DOCKER_ID=`docker images --format='{{.ID}}' | head -1` # Tag and push - - docker tag $${DOCKER_ID} ${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 latest - - docker tag $${DOCKER_ID} ${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 -- GitLab From ab5b028f9e1a0e55e971e13875476beec32dabb4 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Tue, 19 Oct 2021 14:36:36 +0200 Subject: [PATCH 21/39] Try fixing ddeploy template bug --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 688e1a7..0acda17 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -42,7 +42,7 @@ # Run ddeploy - ddeploy --yaml ${DDEPLOY_YAML} # Get ID of image created by ddeploy - - DOCKER_ID=`docker images --format='{{.ID}}' | head -1` + - 'DOCKER_ID=$(docker images --format="{{.ID}}" | head -1)' # Tag and push - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG} -- GitLab From e6c55564d4fafe2f82502bd124d575c54059e0f7 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Tue, 19 Oct 2021 18:59:30 +0200 Subject: [PATCH 22/39] Try manual job not to block the pipeline --- ci-templates/auto-rules/no-default.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 8e352a0..fd70901 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -64,6 +64,7 @@ ddeploy_kinetic: exists: - ddeploy.yaml when: manual + allow_failure: true ddeploy_melodic: extends: .ddeploy @@ -75,6 +76,7 @@ ddeploy_melodic: exists: - ddeploy.yaml when: manual + allow_failure: true ddeploy_noetic: extends: .ddeploy @@ -86,3 +88,4 @@ ddeploy_noetic: exists: - ddeploy.yaml when: manual + allow_failure: true -- GitLab From d635398423541a1bd0707c60b3e9fb4c3ed3f903 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Wed, 20 Oct 2021 08:58:14 +0200 Subject: [PATCH 23/39] Set deploy job always manual --- ci-templates/industrial-ci-templates.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 0acda17..ac3e7e1 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -49,3 +49,5 @@ # Tag and push latest - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest + when: manual + allow_failure: true -- GitLab From 54f3cbb04da883694d2603b130cec865c1c2dd3b Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Wed, 20 Oct 2021 16:06:37 +0200 Subject: [PATCH 24/39] Fix rules syntax --- ci-templates/industrial-ci-templates.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index ac3e7e1..43fdfe5 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -49,5 +49,6 @@ # Tag and push latest - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - when: manual - allow_failure: true + rules: + - when: manual + allow_failure: true -- GitLab From 503baae7072d130d6a9ef54e5cb5a99e24ed5f72 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Wed, 20 Oct 2021 16:37:24 +0200 Subject: [PATCH 25/39] Cleanup deploy job rules --- ci-templates/auto-rules/no-default.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index fd70901..1dd532b 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -60,9 +60,6 @@ ddeploy_kinetic: - if: $DEPLOY && ($DEFAULT_DISTRO == "kinetic" || $BUILD_KINETIC) exists: - ddeploy.yaml - - if: $DEFAULT_DISTRO == "kinetic" || $BUILD_KINETIC - exists: - - ddeploy.yaml when: manual allow_failure: true @@ -72,9 +69,6 @@ ddeploy_melodic: - if: $DEPLOY && ($DEFAULT_DISTRO == "melodic" || $BUILD_MELODIC) exists: - ddeploy.yaml - - if: $DEFAULT_DISTRO == "melodic" || $BUILD_MELODIC - exists: - - ddeploy.yaml when: manual allow_failure: true @@ -84,8 +78,5 @@ ddeploy_noetic: - if: $DEPLOY && ($DEFAULT_DISTRO == "noetic" || $BUILD_NOETIC) exists: - ddeploy.yaml - - if: $DEFAULT_DISTRO == "noetic" || $BUILD_NOETIC - exists: - - ddeploy.yaml when: manual allow_failure: true -- GitLab From aca9fb039010cb441699f179f0983d2df12137c9 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Thu, 21 Oct 2021 10:20:03 +0200 Subject: [PATCH 26/39] Redefine tag vs commit rules --- ci-templates/industrial-ci-templates.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 43fdfe5..e7dd990 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -50,5 +50,7 @@ - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest rules: + - if: $CI_COMMIT_TAG + when: always - when: manual allow_failure: true -- GitLab From 8727c4fc71c12f9b44c05fcc184546bb0b588daf Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Thu, 21 Oct 2021 10:22:05 +0200 Subject: [PATCH 27/39] Redefine rules for auto-rules case --- ci-templates/auto-rules/no-default.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 1dd532b..7fd7dd6 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -54,28 +54,14 @@ industrial_ci_noetic: - if: $BUILD_NOETIC -ddeploy_kinetic: +ddeploy: extends: .ddeploy rules: - - if: $DEPLOY && ($DEFAULT_DISTRO == "kinetic" || $BUILD_KINETIC) + - if: $DEPLOY && $CI_COMMIT_TAG exists: - ddeploy.yaml - when: manual - allow_failure: true - -ddeploy_melodic: - extends: .ddeploy - rules: - - if: $DEPLOY && ($DEFAULT_DISTRO == "melodic" || $BUILD_MELODIC) - exists: - - ddeploy.yaml - when: manual - allow_failure: true - -ddeploy_noetic: - extends: .ddeploy - rules: - - if: $DEPLOY && ($DEFAULT_DISTRO == "noetic" || $BUILD_NOETIC) + when: always + - if: $DEPLOY exists: - ddeploy.yaml when: manual -- GitLab From 14d76ffaa7a5f0ac2a069da3c89889d90d19b26d Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Thu, 21 Oct 2021 11:06:23 +0200 Subject: [PATCH 28/39] Simplify the workflow rules for auto-rules case --- ci-templates/auto-rules/no-default.yml | 29 +++++--------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 7fd7dd6..8dbd58f 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -2,32 +2,15 @@ include: ci-templates/core.yml workflow: rules: - - if: $CI_COMMIT_BRANCH && $CI_COMMIT_REF_NAME =~ /^kinetic-.*/ + - if: $CI_COMMIT_REF_NAME =~ /^kinetic-.*/ variables: DEFAULT_DISTRO: "kinetic" - - if: $CI_COMMIT_BRANCH && $CI_COMMIT_REF_NAME =~ /^melodic-.*/ + - if: $CI_COMMIT_REF_NAME =~ /^melodic-.*/ variables: DEFAULT_DISTRO: "melodic" - - if: $CI_COMMIT_BRANCH && $CI_COMMIT_REF_NAME =~ /^noetic-.*/ + - if: $CI_COMMIT_REF_NAME =~ /^noetic-.*/ variables: DEFAULT_DISTRO: "noetic" - - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^kinetic-.*/ - variables: - DEFAULT_DISTRO: "kinetic" - DEPLOY: "true" - - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^melodic-.*/ - variables: - DEFAULT_DISTRO: "melodic" - DEPLOY: "true" - - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^noetic-.*/ - variables: - DEFAULT_DISTRO: "noetic" - DEPLOY: "true" - - if: $CI_COMMIT_TAG - variables: - DEPLOY: "true" - - if: $CI_COMMIT_BRANCH - industrial_ci_kinetic: extends: .industrial_ci @@ -53,16 +36,14 @@ industrial_ci_noetic: - if: $DEFAULT_DISTRO == "noetic" - if: $BUILD_NOETIC - ddeploy: extends: .ddeploy rules: - - if: $DEPLOY && $CI_COMMIT_TAG + - if: $CI_COMMIT_TAG exists: - ddeploy.yaml when: always - - if: $DEPLOY - exists: + - exists: - ddeploy.yaml when: manual allow_failure: true -- GitLab From 83c2e653ecd195ae91a763db24271a7a22490d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Mon, 25 Oct 2021 12:29:18 +0200 Subject: [PATCH 29/39] Remove leftover code --- ci-templates/industrial-ci-templates.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 688e1a7..5140839 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -22,7 +22,6 @@ DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} DDEPLOY_YAML: ddeploy.yaml before_script: - - docker info - 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 )" -- GitLab From 8b4d60a61996fb268b2ba3fd85c59ea99dbe1ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Mon, 25 Oct 2021 12:41:44 +0200 Subject: [PATCH 30/39] Refactor tags --- ci-templates/industrial-ci-templates.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 27a601a..fe50361 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -19,7 +19,6 @@ variables: DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} DOCKER_PUSH_NAME: ${CI_PROJECT_PATH_SLUG} - DOCKER_PUSH_TAG: ${CI_COMMIT_REF_SLUG} DDEPLOY_YAML: ddeploy.yaml before_script: - apk add --update python3 git py3-pip git-lfs @@ -42,12 +41,14 @@ - ddeploy --yaml ${DDEPLOY_YAML} # Get ID of image created by ddeploy - 'DOCKER_ID=$(docker images --format="{{.ID}}" | head -1)' - # Tag and push - - 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 latest - - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest - - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest + # Tag and push with the branch or tag name. + - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_REF_SLUG} + - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_REF_SLUG} + # Tag and push with 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 docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi rules: - if: $CI_COMMIT_TAG when: always -- GitLab From 183b5ede314b25c79c0f2d52cc75ac3b86770296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Mon, 25 Oct 2021 12:59:34 +0200 Subject: [PATCH 31/39] Add missing workflow rules --- ci-templates/auto-rules/no-default.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 8dbd58f..011021a 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -11,6 +11,8 @@ workflow: - if: $CI_COMMIT_REF_NAME =~ /^noetic-.*/ variables: DEFAULT_DISTRO: "noetic" + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH industrial_ci_kinetic: extends: .industrial_ci -- GitLab From ecda507ce9c650a27ed6418df694393524ed911f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Mon, 25 Oct 2021 13:29:27 +0200 Subject: [PATCH 32/39] Use non slug version of CI_PROJECT_PATH --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index fe50361..e17d608 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -18,7 +18,7 @@ stage: deploy variables: DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL} - DOCKER_PUSH_NAME: ${CI_PROJECT_PATH_SLUG} + DOCKER_PUSH_NAME: ${CI_PROJECT_PATH} DDEPLOY_YAML: ddeploy.yaml before_script: - apk add --update python3 git py3-pip git-lfs -- GitLab From a79cf7060f8d3f864f9c1d9022f4ba22e42abca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Mon, 25 Oct 2021 14:35:45 +0200 Subject: [PATCH 33/39] Surround vars with strings --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index e17d608..18cf00d 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -48,7 +48,7 @@ - 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 docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi + - if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi rules: - if: $CI_COMMIT_TAG when: always -- GitLab From 3f455ccbb1a3cc8244eb92a5f17770f81b92d84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 26 Oct 2021 11:59:39 +0200 Subject: [PATCH 34/39] Allow editing push tag --- ci-templates/industrial-ci-templates.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 18cf00d..6c4dd8f 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -19,6 +19,7 @@ variables: 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 @@ -42,8 +43,8 @@ # Get ID of image created by ddeploy - 'DOCKER_ID=$(docker images --format="{{.ID}}" | head -1)' # Tag and push with the branch or tag name. - - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_REF_SLUG} - - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_REF_SLUG} + - 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 - docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA} - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA} -- GitLab From be562e8dabc62268da2bcb4fab3f59348de3c7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 26 Oct 2021 12:00:45 +0200 Subject: [PATCH 35/39] Add echos to show image name and tag --- ci-templates/industrial-ci-templates.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 6c4dd8f..88c0270 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -43,13 +43,19 @@ # 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 docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi + - 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: $CI_COMMIT_TAG when: always -- GitLab From 641149b1554084cc01160fb6de2588b2aecdda92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 26 Oct 2021 12:30:37 +0200 Subject: [PATCH 36/39] Use multiline --- ci-templates/industrial-ci-templates.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index 88c0270..fe138fd 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -51,10 +51,11 @@ - 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 \ + - > + 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; \ + docker tag ${DOCKER_ID} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && + docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi rules: - if: $CI_COMMIT_TAG -- GitLab From 620f56e0dc75c2b6fd465288bb8de03db4b6a23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Tue, 26 Oct 2021 13:24:51 +0200 Subject: [PATCH 37/39] Update documentation --- README.adoc | 8 -------- ci-templates/README.adoc | 15 ++++++++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/README.adoc b/README.adoc index eb4ff72..c8d344e 100644 --- a/README.adoc +++ b/README.adoc @@ -9,11 +9,3 @@ include::ci-templates/README.adoc[leveloffset=+1] == Custom `rosdep` definitions Custom `rosdep` definitions for the packages hosted in our internal debian repository are declared in link:rosdistro/rosdep_tecnalia.yaml[]. - -== Deployment image build resources - -Resources required for building the deployment docker images are also hosted in this repository. -This basically boils down to: - -- link:scripts/pre-deploy-cleanup.bash[] is run in the `.industrial_ci_deploy` template before commiting to an image -- link:deploy/Dockerfile[] is used to perform some additional cleanup and install link:deploy/ros_entrypoint.bash[] as entrypoint script on top of the `industrial_ci` image diff --git a/ci-templates/README.adoc b/ci-templates/README.adoc index f99eb2c..8d0e995 100644 --- a/ci-templates/README.adoc +++ b/ci-templates/README.adoc @@ -17,11 +17,14 @@ The Core pipeline, defined in link:ci-templates/core.yml[], has the following st ** If the package has `.rosinstall` dependencies, they can be installed using the variable `UPSTREAM_WORKSPACE` ** Uses `flexbotics-base-devel:${ROS_DISTRO}` as a starting image ** Runs link:scripts/ci_run_entry_points.sh[] in the `AFTER_SETUP_TARGET_WORKSPACE` stage, which in turn finds and runs every `ci_entry_script.bash` script found in the target repo. - * `.industrial_ci_deploy` template, which: - ** Runs `industrial_ci` by extending `.industrial_ci` - ** Runs some cleanup in the `industrial_ci` context (e.g. delete sources) - ** Commits image used by `industrial_ci` - ** Builds deployment image on top of it and push it to our registry +- Stage: `deploy` + * `.ddeploy` template (see https://git.code.tecnalia.com/tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy[the ddeploy repo]), which: + ** Is run automatically for tags, but can also be run manually on normal commits + ** Calls `ddeploy` to generate the docker image + ** Renames the image created by ddeploy with different tags and pushes them to the registry. + *** Tag `${COMMIT_SHA}` (hash of commit) + *** Tag `${CI_COMMIT_REF_SLUG}` (branch or tag name) + *** Tag `latest` only on the default branch - Stage: `.post` * Check `bash`/`sh` script syntax * Check Markdown and AsciiDoc syntax @@ -52,6 +55,8 @@ The auto rules also allow for using variables to explicitely activate each job: include::examples/build_vars.yml[] ``` +If a `ddeploy.yaml` file exists, the auto-rules will add a job extending the `.ddeploy` template defined + == LFS By default, lfs files are not downloaded. If you need to add LFS, include the link:ci-templates/lfs-pull.yml[] along with anything else: ```yml -- GitLab From c116c917ab116a9c3f311f0e8128a6663bc2d52f Mon Sep 17 00:00:00 2001 From: Miguel Prada <miguel.prada@tecnalia.com> Date: Wed, 27 Oct 2021 11:09:30 +0200 Subject: [PATCH 38/39] Trim trailing whitespace --- ci-templates/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/README.adoc b/ci-templates/README.adoc index 8d0e995..5683239 100644 --- a/ci-templates/README.adoc +++ b/ci-templates/README.adoc @@ -55,7 +55,7 @@ The auto rules also allow for using variables to explicitely activate each job: include::examples/build_vars.yml[] ``` -If a `ddeploy.yaml` file exists, the auto-rules will add a job extending the `.ddeploy` template defined +If a `ddeploy.yaml` file exists, the auto-rules will add a job extending the `.ddeploy` template defined == LFS By default, lfs files are not downloaded. If you need to add LFS, include the link:ci-templates/lfs-pull.yml[] along with anything else: -- GitLab From d1022adf72cc4e33099202f6bd3cc7125aaef4ae Mon Sep 17 00:00:00 2001 From: Jon Azpiazu <jon.azpiazu@tecnalia.com> Date: Fri, 29 Oct 2021 11:10:25 +0200 Subject: [PATCH 39/39] Pinning the ddeploy version to be used --- ci-templates/industrial-ci-templates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index fe138fd..4ab2d62 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -35,7 +35,7 @@ - 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 + - 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: # Run ddeploy -- GitLab