2
votes

I have two job pipeline in our CI process in Gitlab.com CI (with shared runners) and second one hangs up on Checking out c5b6078f as master...

First job "build" completes correctly and pushes valid image to AWS docker registry. Second jobs hangs up before even starting on checking repository.

I have tried both git strategies "fetch" and "clone" with same result.

job log:

  • Running with gitlab-ci-multi-runner 1.5.2 (76fdacd)
  • Using Docker executor with image silintl/ecs-deploy ...
  • Pulling docker image silintl/ecs-deploy ...
  • Running on runner-8a2f473d-project-1459347-concurrent-0 via runner-8a2f473d-machine-1472732000-783cccf8-digital-ocean-4gb...
  • Cloning repository...
  • Cloning into '/builds/zendoro/frontend-catalogue'...
  • Checking out c5b6078f as master...

gitlab-ci.yml:

image: ekino/dind-aws

stages:
  - build
  - deploy-dev
  - deploy-prod

variables:
  CONTAINER_IMAGE: XXXYYYZZZ.dkr.ecr.eu-west-1.amazonaws.com/$CI_PROJECT_NAME:$CI_BUILD_REF
  CONTAINER_TAG: XXXYYYZZZ.dkr.ecr.eu-west-1.amazonaws.com/$CI_PROJECT_NAME:$CI_BUILD_REF_NAME

build:
  stage: build
  services:
    - docker:dind
  script:
    - eval $(aws ecr get-login --region eu-west-1)
    - docker build --pull -t $CONTAINER_IMAGE .
    - docker push $CONTAINER_IMAGE
    - docker tag $CONTAINER_IMAGE $CONTAINER_TAG
    - docker push $CONTAINER_TAG

deployment-dev:
  stage: deploy-dev
  image: silintl/ecs-deploy
  script:
    - ecs-deploy -c default -n $CI_PROJECT_NAME -i $CONTAINER_IMAGE
  environment: Development
  dependencies:
    - build
  only:
    - master

deployment-prod:
  stage: deploy-prod
  image: silintl/ecs-deploy
  script:
    - ecs-deploy -c production -n $CI_PROJECT_NAME -i $CONTAINER_IMAGE
  environment: Production
  dependencies:
    - build
  only:
    - tags

I have also tried another image for deployment "jakubriedl/ecs-deploy" which is basically the same but on Alpine linux and it did not hanged up but ended with ERROR: Build failed: exit code 2

full job log with alpine image:

  • Running with gitlab-ci-multi-runner 1.5.2 (76fdacd)
  • Using Docker executor with image jakubriedl/ecs-deploy ...
  • Pulling docker image jakubriedl/ecs-deploy ...
  • Running on runner-8a2f473d-project-1459347-concurrent-0 via runner-8a2f473d-machine-1472734703-4f8bb312-digital-ocean-4gb...
  • Cloning repository...
  • Cloning into '/builds/zendoro/frontend-catalogue'...
  • Checking out 3647bc37 as master...
  • ERROR: Build failed: exit code 2
2

2 Answers

1
votes

The problem is in some sort of bug in GitLab-CI. Image must not have ENTRYPOINT defined because it fails described way. So creating image without ENTRYPOINT is solution.

Related issue on gitlab https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1507

0
votes

The answer today is more likely to be found in Overriding Entrypoints Doc -- the section labeled "For Docker 17.06+".

GitLab can run images with ENTRYPOINT defined without issue, provided you override it like entrypoint: [""] and then treat it as though you picked the best shell the image is capable of when you write your script sections.