Commit 977d0c8f authored by Carsten Schlote's avatar Carsten Schlote
Browse files

Initial Commit

[skip ci]
parent 1bd03d95
Pipeline #554 skipped
MANIFEST
ntp.conf
*~
image: docker:19.03.1
# Pipeline to build a dlang build image
# define the env variable visible in stages.
# - CI_* - used directly below
# - CI_IMAGE_* - used in ./scripts/*
variables:
# When using dind service we need to instruct docker, to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
#
# Note that if you're using the Kubernetes executor, the variable should be set to
# tcp://localhost:2375 because of how the Kubernetes executor connects services
# to the job container
# DOCKER_HOST: tcp://localhost:2375
#
# For non-Kubernetes executors, we use tcp://docker:2375
DOCKER_HOST: tcp://docker:2375
# This will instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Docker configs
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: normal
# Test and latest image
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
services:
- docker:19.03.1-dind
stages:
- lint
- build
- test
- release
- deploy
before_script:
- command -v docker && docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY || true
- command -v docker && docker info || true
- echo "These are the ENV vars:"
#- printenv | sort
#-- Lint the scripts and Dockerfile ----------------------------------------
lint-scripts:
tags:
- gitlabdocker
stage: lint
script:
- echo "linting $CI_COMMIT_REF_NAME / $CI_COMMIT_SHA ..."
- docker run --rm -i hadolint/hadolint < Dockerfile
- docker run -v "$PWD:/mnt" koalaman/shellcheck scripts/*.sh
- echo "Finished linting successfully."
#-- Build the image --------------------------------------------------------
build container:
tags:
- gitlabdocker
stage: build
script:
- echo "building $CI_COMMIT_REF_NAME / $CI_COMMIT_SHA ..."
# Collect some data and write to a MANIFEST file
- ./scripts/create-manifest.sh
# Build the Image
- docker pull $CONTAINER_RELEASE_IMAGE || true
- docker build --cache-from $CONTAINER_RELEASE_IMAGE --pull -t $CONTAINER_TEST_IMAGE --build-arg LDC_VERSION .
- docker push $CONTAINER_TEST_IMAGE
#-- Test the image ---------------------------------------------------------
# Test within a docker in docker base image setup. It's the same environment
# we used before to build the image. We basicall download and run some
# container from a 'docker' container image.
.test dind: # commented out stage to save time, kept for reference
tags:
- gitlabdocker
stage: test
script:
- echo "testing $CI_COMMIT_REF_NAME / $CI_COMMIT_SHA ..."
- docker pull $CONTAINER_TEST_IMAGE
- docker run $CONTAINER_TEST_IMAGE image-info.sh
# Here we run the container created above directly. We can directly execute
test container:
image: $CONTAINER_TEST_IMAGE
tags:
- gitlabdocker
stage: test
script:
- echo "testing $CI_COMMIT_REF_NAME / $CI_COMMIT_SHA ..."
- echo "This container contains:" ; cd / && ls -al
- image-info.sh
#-- Release the image ------------------------------------------------------
release image:
tags:
- gitlabdocker
stage: release
script:
- echo "releasing $CI_COMMIT_REF_NAME / $CI_COMMIT_SHA ..."
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
only:
- master
deploy image:
tags:
- gitlabdocker
stage: deploy
when: manual
script:
- ./scripts/deploy.sh
only:
- master
# hadolint ignore=DL3007
FROM gitlab.vahanus.com:5050/vahanus/public/container-ubuntu10:latest
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
graphviz openjdk-8-jdk git-core maven \
tomcat8 \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/plantuml/plantuml-server.git \
&& cd plantuml-server \
&& mvn package \
&& cp target/plantuml.war /var/lib/tomcat8/webapps/plantuml.war \
&& chown tomcat8:tomcat8 /var/lib/tomcat8/webapps/plantuml.war \
# && service tomcat8 restart
EXPOSE 8080/tcp
CMD [ "tomcat8", "-p" ]
# scripts
Contains helper scripts to be used by gitlab-ci to build new docker images.
#!/usr/bin/env sh
# shellcheck disable=SC2059
set -ex
DEBIAN_BASE_IMAGE=docker.vahanus.com:5000/debian/ntp:latest
if test -n "$1" ; then DEBIAN_BASE_IMAGE="$1" ; fi
NET_IP4_IP=5.9.92.73
NET_IP6_IP=2a01:4f8:161:716e:dead:beef:0:2
ENABLE_NTP_LOCAL_BROADCAST=0
NET_IP4_SUBNET=5.9.92.72
NET_IP4_NETMASK=255.255.255.248
NET_IP6_SUBNET=2a01:4f8:161:716e:dead:beef::
NET_IP6_NETMASK=ffff:ffff:ffff:ffff:ffff:ffff::
NTP_RESTRICT_SUBNETS=$(cat <<EOF
restrict $NET_IP4_SUBNET mask $NET_IP4_NETMASK nomodify notrap
restrict -6 $NET_IP6_SUBNET mask $NET_IP6_NETMASK nomodify notrap
restrict 192.168.12.0 mask 255.255.255.0 nomodify notrap
restrict -6 fd0a:192:168:12:: mask ffff:ffff:ffff:ffff:: nomodify notrap
EOF
)
NTP_RESTRICT_INTERFACE=$(cat <<EOF
interface listen $NET_IP4_IP
interface listen $NET_IP6_IP
interface listen 192.168.12.10
interface listen fd0a:192:168:12::10
EOF
)
export NTP_RESTRICT_SUBNETS NTP_RESTRICT_INTERFACE
# Setup sources.list for DEB repo and distro
printf "$(cat ntp_conf_template)\n" "$NTP_RESTRICT_SUBNETS" "$NTP_RESTRICT_INTERFACE" > ntp.conf
if test "$ENABLE_NTP_LOCAL_BROADCAST" = "1" ; then
sed -i \
-e "/#broadcast 224.0.1.1/{ s|#||g; }" \
-e "/#broadcast ff05\:\:101/{ s|#||g; }" ntp.conf
fi
# Now build the image
docker image build --pull \
--build-arg DEBIAN_FRONTEND=noninteractive \
--network host -t "$DEBIAN_BASE_IMAGE" .
# Cleanup intermediates right now
docker image prune -f --filter label!=build_source_stage=true
echo "Image '$DEBIAN_BASE_IMAGE': $(docker image ls -q '$DEBIAN_BASE_IMAGE')";
echo "Image successfully created."
#!/usr/bin/env sh
set -e
#-- Prepare MANIFEST ---------------------------------------------------------
echo "Image Info:" > MANIFEST
( cat << EOF
CI_COMMIT_REF_SLUG = $CI_COMMIT_REF_SLUG
CI_COMMIT_SHA = $CI_COMMIT_SHA
CI_COMMIT_TITLE = $CI_COMMIT_TITLE
EOF
) >> MANIFEST
echo "Manifest successfully created."
#!/usr/bin/env sh
echo "Do some deployment here... tbd."
#!/usr/bin/env bash
export CI_COMMIT_REF_SLUG=master
export CI_REGISTRY_IMAGE=gitlab.vahanus.net:5050/vahanus/public/container-plantum
export CONTAINER_TEST_IMAGE="$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
export CONTAINER_RELEASE_IMAGE="$CI_REGISTRY_IMAGE:latest"
#!/usr/bin/env sh
cat /MANIFEST
gcc --version | head -n 1
dmd --version
ldc2 --version | head -n 3
-----BEGIN CERTIFICATE-----
MIIFoTCCA4mgAwIBAgIQKwZe1/4ODLFHcbyXsR7EjTANBgkqhkiG9w0BAQsFADBi
MRMwEQYKCZImiZPyLGQBGRYDbmV0MRcwFQYKCZImiZPyLGQBGRYHdmFoYW51czEW
MBQGCgmSJomT8ixkARkWBmZvcmVzdDEaMBgGA1UEAxMRVkFoYW51cyBBdXRob3Jp
dHkwIBcNMTgxMTA0MjEyMTExWhgPMjA5MzExMDQyMTMxMDZaMGIxEzARBgoJkiaJ
k/IsZAEZFgNuZXQxFzAVBgoJkiaJk/IsZAEZFgd2YWhhbnVzMRYwFAYKCZImiZPy
LGQBGRYGZm9yZXN0MRowGAYDVQQDExFWQWhhbnVzIEF1dGhvcml0eTCCAiIwDQYJ
KoZIhvcNAQEBBQADggIPADCCAgoCggIBAK67GTGKSy8vN3xgS07wx8IHOjU6ohLC
jnuyoZXg8obFSu5M2nLELnyYOATpJ5vHdAeHqBKzUxULtSMkCCDFn+k58bsizY5X
g5MrQQHcq0tMyfcPN4ljnr8hYfjxZHpITMWaY/JLq2awg5+Wf8zl5jDekOQ0Ze3Y
SKlTPg5cN94y7D7oYdzrpQnv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xwCluxv0WR0Wahtrp
z4fb9cHrnngu7MI83GfUuSQ++A557cNYmMNSPuFfBXrjzBcygx01KyyVGYVGuUaQ
CaAk4WDQFkPU/TK8nqXc9mrkTv2eiIZsmKxmWSfuweZRCLt82wjqoDo8dTfGAA5t
Uss+VRk1f/lvDWfTwCMIM37u2XrDl93hLGTV8R/3PM+2g2hJa4JIqiTBfY/ZViU6
30NPR9oCcz0qpz5gEFoalOY3NwtpHG2+y94SGH9O2TcoEueU7h8FoMDILok74f7V
Y1WbiOc=
-----END CERTIFICATE-----
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment