Commit c32f1f75 authored by odatskov's avatar odatskov
Browse files

Moving towards docker container to test and deploy

parent 23c96c32
Pipeline #505166 failed with stages
in 11 seconds
......@@ -2,7 +2,7 @@
stages:
- test
- build
- deploy
- sync
#############################################
############# Test ##########################
......@@ -10,11 +10,10 @@ stages:
sync_test:
stage: test
tags:
- docker
image: golang:latest
- docker-privileged
image: ${CI_REGISTRY_IMAGE}/sync:${CI_COMMIT_REF_NAME}
script:
- go version
- go get github.com/docker/docker/client
- go test -v
environment:
name: test
......@@ -33,18 +32,10 @@ sync_test:
- apk add git
- docker info
.build:beego:
build:sync:
<<: *build_image
script:
- case "$(git diff HEAD~ --name-only)" in *"Dockerfile.beego"*|*"Dockerfile.beego$"*) echo "Dockerfile.beego changed" ;; *) echo "Dockefile.beego not changed. Skipping build..."; exit 0 ;; esac
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE/web-go:$CI_COMMIT_REF_NAME" -f Dockerfile.beego .
- docker push "$CI_REGISTRY_IMAGE/web-go:$CI_COMMIT_REF_NAME"
- docker build --pull -t "$CI_REGISTRY_IMAGE/sync:$CI_COMMIT_REF_NAME" -f Dockerfile .
- docker push "$CI_REGISTRY_IMAGE/sync:$CI_COMMIT_REF_NAME"
build:deploy:
<<: *build_image
script:
- case "$(git diff HEAD~ --name-only)" in *"Dockerfile.kube"*|*"Dockerfile.kube$"*) echo "Dockerfile.kube changed" ;; *) echo "Dockefile.kube not changed. Skipping build..."; exit 0 ;; esac
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE/kubectl:$CI_COMMIT_REF_NAME" -f Dockerfile.kube .
- docker push "$CI_REGISTRY_IMAGE/kubectl:$CI_COMMIT_REF_NAME"
FROM docker:latest
RUN apk update && apk add go git libc-dev
WORKDIR /home
# Install sync go dependencies
RUN go get -d -v github.com/docker/docker/client && go install -v github.com/docker/docker/client
COPY sync.go sync_test.go /home/
COPY files /home/files
# Builder image for fetching and unpacking binaries
FROM alpine:3.8 as build
ENV KUBE_LATEST="v1.10.7"
ENV HELM_LATEST="v2.10.0"
WORKDIR /
RUN apk add --update --no-cache ca-certificates && apk add --update -t deps curl tar \
&& curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST}/bin/linux/amd64/kubectl -o /tmp/kubectl \
&& chmod +x /tmp/kubectl \
&& curl -L https://storage.googleapis.com/kubernetes-helm/helm-${HELM_LATEST}-linux-amd64.tar.gz | tar zxv -C /tmp
# Minimum image meant for execution
FROM alpine:3.8
RUN apk add --update --no-cache ca-certificates bash
COPY --from=build /tmp/linux-amd64/helm /bin/helm
COPY --from=build /tmp/kubectl /bin/kubectl
FROM golang:1.10
RUN apt-get update
name: sync
description: synchronisation of Docker images in CVMFS
apiVersion: v1
appVersion: "1.0"
version: 0.1.0
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-cvmfs-cms
serviceAccount:
name: gitlab-sa
namespace: gitlab-ns
image:
repository: gitlab-registry.cern.ch/unpacked
name: sync
tag: master
secret: gitlab-sa-token-lgz86
pullPolicy: Always
restartPolicy: Never
Markdown is supported
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