Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge digitallumberjack/master modifications #33

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

digitalLumberjack
Copy link
Collaborator

@digitalLumberjack digitalLumberjack commented Jan 29, 2017

Changes :

  • Runner upgraded to 1.10.4
  • Docker support (socket mode and dind mode)
  • Docker private registry support :
    • Allows to use private images for jobs
  • Added RUNNER_DOCKER_ADDITIONAL_VOLUME support to share volumes between host and build containers
  • Added RUNNER_OUTPUT_LIMIT support to override the logs output limit.

@digitalLumberjack digitalLumberjack mentioned this pull request Jan 29, 2017
@sameersbn
Copy link
Owner

Can you resolve the conflicts please?

@digitalLumberjack
Copy link
Collaborator Author

Should be ok. Sorry for the bad commit message i tried the online editor and i could not choose the message. I can amend if you need.

Dockerfile Outdated
@@ -1,17 +1,33 @@
FROM sameersbn/ubuntu:14.04.20170110
FROM ubuntu:xenial
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you revert this?

Dockerfile Outdated
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
vim.tiny wget sudo net-tools ca-certificates unzip git openssh-client curl libapparmor1

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by reverting to sameersbn/ubuntu:14.04.20170110 these lines will not be required

Dockerfile Outdated
@@ -21,6 +37,8 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E1DD270288B4E60
COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh

RUN rm -rf /var/lib/apt/lists/*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this line needed? I think it can be removed

@sameersbn
Copy link
Owner

@digitalLumberjack Lets resolve the issues in the PR before we hit the merge button.
p.s. i've added you as a collaborator to the project.

@sameersbn
Copy link
Owner

also i will give it a test before we merge this one. thanks for the contrib

@inongogo
Copy link

This is fantastic! I am eagerly looking forward to testing this! Thanks for all your work!

@paolomainardi
Copy link

Please merge it, this is a fantastic work!

@digitalLumberjack
Copy link
Collaborator Author

@sameersbn This should be ok now.
I bumped to 1.10.4 by the way.

@davidwindell
Copy link

LGTM? 👍

@fwoelffel
Copy link

Can this be merged?

Copy link

@Maescool Maescool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running this version in production, upgraded from the current master without any hiccup, also tried the new features, works as advertised.

@digitalLumberjack
Copy link
Collaborator Author

I bumped to runner v1.11.2, @sameersbn as soon as you give your go we can merge this. Tell me if any modification is needed.

@cpoetter
Copy link

cpoetter commented Apr 24, 2017

@digitalLumberjack @sameersbn Really awesome work you two! My Synology can't wait for this update :) Please press the merge button :D

@BirgerK
Copy link

BirgerK commented Jun 2, 2017

Merging this update would be awesome! :)

@davidwindell
Copy link

@digitalLumberjack could the entrypoint detect a change to the RUNNER_DOCKER_IMAGE and update the config?

@davidwindell
Copy link

For those waiting for this to be merged, we've just switched all our builds over to digitallumberjack/docker-gitlab-ci-multi-runner:v9.3.0 and it's working grand. Great to finally be on the docker executor! :) Thanks @digitalLumberjack 👍

entrypoint.sh Outdated
else
sudo -HEu ${GITLAB_CI_MULTI_RUNNER_USER} \
gitlab-ci-multi-runner register --config ${GITLAB_CI_MULTI_RUNNER_DATA_DIR}/config.toml
fi
if [[ -n ${RUNNER_CONCURRENT} ]];then
sed -i "s/concurrent = .*/concurent = ${RUNNER_CONCURRENT}/" ${GITLAB_CI_MULTI_RUNNER_DATA_DIR}/config.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@digitalLumberjack spelling mistake here, should be concurrent

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I fixed that.

digitallumberjack/docker-gitlab-ci-multi-runner:v9.3.0-1 include this fix.

@Maescool
Copy link

I see @sameersbn has made @digitalLumberjack Collaborator, so you could merge this?

@davidwindell
Copy link

@digitalLumberjack could you bump to v9.5?

@QuickJack
Copy link

According to https://about.gitlab.com/2017/08/22/gitlab-9-5-released/ the old runner will stop working at September 22nd, 2017.

Please note, that this also affects the usability of docker-gitlab.

@GarbageYard
Copy link

@digitalLumberjack: I am getting following error while using the image you've shared:

./configure_proxy_artifactory.sh: line 13: docker: command not found

GitLab CI runner script:

docker run --name gitlab-ci-multi-runner -d --restart=always \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /mnt/data/gitlab/gitlab-runner:/home/gitlab_ci_multi_runner/data \
  --env='CI_SERVER_URL=https://gitlab.dev.abc.net/ci' --env='RUNNER_TOKEN=RijUZPnMjGeNF2JYt' \
  --env='RUNNER_DESCRIPTION=runnerA' --env='RUNNER_EXECUTOR=docker' \
  --env='RUNNER_DOCKER_IMAGE=docker:17.07.0-ce' --env='RUNNER_DOCKER_MODE=socket' \
  --link gitlab.dev.abc.net \
  digitallumberjack/docker-gitlab-ci-multi-runner:v9.3.0-1

.gitlab-ci.yml content:

image: node:6.11

types:
        - build
        - deploy

build_app:
        type: build
        script: "bash chmod +x ./configure_proxy_artifactory.sh"
        script: "bash ./configure_proxy_artifactory.sh"

From within the container, here's my observation:

root@5489eb3ebe42:/home/gitlab_ci_multi_runner# ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jul 21 00:53 /var/run/docker.sock
root@5489eb3ebe42:/home/gitlab_ci_multi_runner# docker ps
bash: docker: command not found

Any idea how i can fix this?

@Maescool
Copy link

@GarbageYard You are using the wrong image for this kind of setup
you need at least the following in your .gitlab-ci.yml

image: docker:latest
services:
  - docker:dind

in the Dockerfile you use to build the image, you should refer to the node image.

@GarbageYard
Copy link

Thanks for the reply @Maescool! Sorry, but i am confused now because if i'm going to use image: docker:latest, then how will i get the node app? Will i be using some package manager inside the .gitlab-ci.yml file to download the node installer?

@Maescool
Copy link

@GarbageYard so, there are a couple of parts.
if you want to build a docker image using gitlab-ci-multi-runner,
in my case I use docker in docker, so that's why I have the services thingie, you might not need it.
you have your .gitlab-ci.yml something like this

image: docker:latest

services:
  - docker:dind

variables:
  GIT_SUBMODULE_STRATEGY: recursive
  CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest

before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

stages:
  - build
  - release

build:
  type: build
  script:
    - docker build --pull -t $CONTAINER_TEST_IMAGE .
    - docker push $CONTAINER_TEST_IMAGE

release-image:
  stage: release
  script:
    - docker pull $CONTAINER_TEST_IMAGE
    - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
    - docker push $CONTAINER_RELEASE_IMAGE
  only:
    - master

(this is basically by default gitlab-ci build file to build docker images)

Then you have your Dockerfile, that looks something like this

FROM node:6.11
COPY . /usr/src/app

The entrypoint stuff etc.. idk with node, and for your project, this is just an example of how I do my image builds.

@GarbageYard
Copy link

Hi @Maescool! I tried using DIND but somehow it's failing to retrieve the image via Artifactory (our private container registry).

Runner log error:
Running with gitlab-ci-multi-runner 9.5.0 (413da38)
  on RunnerA (d8ed43a6)
Using Docker executor with image docker.artifactory.abc.net/docker:17.07 ...
Starting service docker.artifactory.abc.net/docker:17.07-dind ...
Pulling docker image docker.artifactory.abc.net/docker:17.07-dind ...
ERROR: Preparation failed: Error response from daemon: Get https://docker.artifactory.abc.net/v2/: x509: certificate signed by unknown authority

I guess it's because it's unable to login to Artifactory first. I saw this link but it seems it's for images and not for services. I still tried configuring Secret Variable (DOCKER_AUTH_CONFIG) but it's not working.

Content of .gitlab-ci.yml

image: docker.artifactory.abc.net/docker:17.07

variables:
  DOCKER_HOST: tcp://docker:2375

# This before_script block was added later but it seems this block
# isn't executed before the DIND tries fetching image from Artifactory
before_script:
  - docker login -u svc-art-user -p some-pwd docker.artifactory.abc.net
  - docker info

services:
- docker.artifactory.abc.net/docker:17.07-dind

build:
  stage: build
  script:
  - docker build -t my-docker-node-image .

All (GitLab, Runner & DIND) containers are on one host. I am able to docker login docker.artifactory.abc.net -u svc-art-user -p some-pwd successfully. Even without DOCKER_AUTH_CONFIG, my image (shown above i.e., docker.artifactory.abc.net/docker:17.07) was getting fetched without any issue. It seems it's because it was using my host's ~/.docker/config.json. If that's the case, why isn't the service (docker.artifactory.abc.net/docker:17.07-dind) also using the same credentials?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.