Jakub Riedl
Jakub Riedl

Reputation: 1086

Gitlab CI: job hangs up on cloning repo

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:

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:

Upvotes: 2

Views: 1809

Answers (2)

nik.shornikov
nik.shornikov

Reputation: 1935

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.

Upvotes: 0

Jakub Riedl
Jakub Riedl

Reputation: 1086

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

Upvotes: 1

Related Questions