Skip to content
Snippets Groups Projects

Resolve "Ddeploy job failing when enforcing labels"

1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
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:
Loading