diff --git a/ci-templates/industrial-ci-templates.yml b/ci-templates/industrial-ci-templates.yml index acef8ec4af255986f8e3d52e749fee26a0c0b9b8..0edde69168d3094d9704bc21951eeb90931a82e1 100644 --- a/ci-templates/industrial-ci-templates.yml +++ b/ci-templates/industrial-ci-templates.yml @@ -1,3 +1,6 @@ +variables: + GITLAB_TEMPLATES_BRANCH: master + .industrial_ci: stage: build before_script: @@ -10,7 +13,8 @@ DOCKER_IMAGE: "${ARTIFACT_DOCKER_URL}/flexbotics-base-devel:${ROS_DISTRO}" ADDITIONAL_DEBS: curl PARALLEL_BUILDS: 2 # keep this for now, since there seems to be memory limit issues in the ci VM - AFTER_SETUP_TARGET_WORKSPACE: "rosenv && bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/ci_run_entry_points.sh) $$current_ws" + GITLAB_TEMPLATES_BRANCH: master + AFTER_SETUP_TARGET_WORKSPACE: "rosenv && bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/ci_run_entry_points.sh) $$current_ws" CMAKE_ARGS: -DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context @@ -21,6 +25,7 @@ DOCKER_PUSH_NAME: ${CI_PROJECT_PATH} DOCKER_PUSH_TAG: ${CI_COMMIT_REF_NAME} DDEPLOY_YAML: ddeploy.yaml + GITLAB_TEMPLATES_BRANCH: master before_script: - apk add --update python3 git py3-pip git-lfs bash curl jq # forward the SSH authentication into the Docker executor @@ -40,22 +45,22 @@ script: # Run ddeploy - ddeploy --yaml ${DDEPLOY_YAML} - # Get ID of image created by ddeploy - - 'DOCKER_ID=$(docker images --format="{{.ID}}" | head -1)' - - curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/enforce_labels.bash | bash -s -- ${DOCKER_ID} + # Get the full name of the most recently built image + - 'DDEPLOY_IMAGE_NAME=$(docker images --format="{{.Repository}}:{{.Tag}}" | head -1)' + - curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/enforce_labels.bash | bash -s -- ${DDEPLOY_IMAGE_NAME} # 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 tag ${DDEPLOY_IMAGE_NAME} ${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 tag ${DDEPLOY_IMAGE_NAME} ${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 tag ${DDEPLOY_IMAGE_NAME} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest && docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest; fi rules: diff --git a/ci-templates/syntax-check.yml b/ci-templates/syntax-check.yml index 4ecbab1babd74ebe91e994d87927962bca9986c2..2ebc80038b4e66ffee6238f105a6a91cc53baeb4 100644 --- a/ci-templates/syntax-check.yml +++ b/ci-templates/syntax-check.yml @@ -1,13 +1,15 @@ +variables: + GITLAB_TEMPLATES_BRANCH: master + ########################################################## ## Check formating of C and C++ files using clang-format ########################################################## - clang_format: stage: .post before_script: - apk add --update bash coreutils tar wget - git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci.git .ci_config -b legacy - - wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/clang-format -O .clang-format + - wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/clang-format -O .clang-format script: .ci_config/gitlab.sh variables: ROS_DISTRO: kinetic @@ -80,5 +82,5 @@ adoc_syntax: before_script: - apk add --update curl asciidoctor bash script: - - curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash | bash -s -- . + - curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/asciidoctor_syntax_check.bash | bash -s -- . when: always