diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06ad53183d355e0645d99606ef4a7ac03a43ed0c..dbc4394502a0f466783e4fb93d5e3c88fa2fce09 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -279,6 +279,21 @@ gitlab-sidekiq-ce: - gitlab-rails-ce <<: *except-ee +gitlab-monitor: + <<: *job-base + stage: phase-two + script: + - ruby_version=$(get_version gitlab-ruby) + - ruby_container=($(echo -n "$ruby_version$GITLAB_MONITOR_VERSION" | sha1sum)) + - export CONTAINER_VERSION=($(echo -n "$ruby_container$TARGET_VERSION" | sha1sum)) + - build_if_needed --build-arg "GITLAB_MONITOR_VERSION=$GITLAB_MONITOR_VERSION" + --build-arg "FROM_IMAGE=$CI_REGISTRY_IMAGE/gitlab-ruby" + --build-arg "TAG=$ruby_version" + - push_if_master_or_tag + - push_if_master_or_tag $GITLAB_MONITOR_VERSION + dependencies: + - gitlab-ruby + gitlab-mailroom: <<: *job-base stage: phase-two diff --git a/ci_files/variables.yml b/ci_files/variables.yml index 7ed6d75d52a498ce108168310207a17a5a50ead9..1e9861f61ca2eb2f576fa458c9d587f132f6f550 100644 --- a/ci_files/variables.yml +++ b/ci_files/variables.yml @@ -3,6 +3,7 @@ variables: GITLAB_VERSION: "master" GITLAB_REF_SLUG: "master" GITLAB_ASSETS_TAG: "master" + GITLAB_MONITOR_VERSION: "4.0.0" GITLAB_SHELL_VERSION: "master" GITLAB_WORKHORSE_VERSION: "master" GITALY_VERSION: "master" diff --git a/gitlab-monitor/Dockerfile b/gitlab-monitor/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9446500b05d54281d7c33a82d8b7a6ba008aaad9 --- /dev/null +++ b/gitlab-monitor/Dockerfile @@ -0,0 +1,32 @@ +ARG CI_REGISTRY_IMAGE="registry.gitlab.com/gitlab-org/build/cng" +ARG TAG=latest +ARG FROM_IMAGE="$CI_REGISTRY_IMAGE/gitlab-ruby" +ARG GITLAB_MONITOR_VERSION=4.0.0 +FROM ${FROM_IMAGE}:${TAG} + +# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact +ARG GITLAB_USER=git +ARG GITLAB_MONITOR_VERSION + +# create gitlab user +# openssh daemon does not allow locked user to login, change ! to * +RUN adduser --disabled-password --gecos 'GitLab' ${GITLAB_USER} && \ + sed -i "s/${GITLAB_USER}:!/${GITLAB_USER}:*/" /etc/shadow + +# install build deps +RUN buildDeps='build-essential' && \ + apt-get update && \ + apt-get install -y --no-install-recommends $buildDeps libpq-dev && \ + rm -rf /var/lib/apt/lists/* && \ + gem install gitlab-monitor -v ${GITLAB_MONITOR_VERSION} && \ + SUDO_FORCE_REMOVE=yes apt-get purge -y --auto-remove $buildDeps + +ENV CONFIG_TEMPLATE_DIRECTORY=/var/opt/gitlab-monitor/templates +ENV CONFIG_DIRECTORY=/etc/gitlab-monitor +ENV CONFIG_FILENAME=gitlab-monitor.yml + +RUN mkdir -p ${CONFIG_DIRECTORY}; chown -R $GITLAB_USER ${CONFIG_DIRECTORY} + +USER $GITLAB_USER:$GITLAB_USER + +CMD /usr/bin/gitlab-mon web -c ${CONFIG_DIRECTORY}/${CONFIG_FILENAME}