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

WIP: GitLab Ci for coredns #1

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
94 changes: 94 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
stages:
- build
- package
- release

variables:
DASHBOARD_STABLE_REF_NAME: "ci-v008"
DASHBOARD_MASTER_REF_NAME: "ci-master"
DASHBOARD_HEAD_REF_NAME: "$DASHBOARD_MASTER_REF_NAME"

before_script:
- export CI_COMMIT_SHA_SHORT=$(echo ${CI_COMMIT_SHA} | cut -c -8)
- echo "Starting job ${CI_JOB_NAME}"
- rm -f update_dashboard
- wget -nv http://gitlab.dev.cncf.ci/cncf/cross-cloud/raw/ci-stable-v0.1.0/update_dashboard || apk update && apk add bash curl && curl -o update_dashboard http://gitlab.dev.cncf.ci/cncf/cross-cloud/raw/ci-stable-v0.1.0/update_dashboard
- cat update_dashboard
- chmod +x update_dashboard
- bash ./update_dashboard

after_script:
- echo "Ending job ${CI_JOB_NAME}"
- rm -f update_dashboard
- wget -nv http://gitlab.dev.cncf.ci/cncf/cross-cloud/raw/ci-stable-v0.1.0/update_dashboard || apk update && apk add bash curl && curl -o update_dashboard http://gitlab.dev.cncf.ci/cncf/cross-cloud/raw/ci-stable-v0.1.0/update_dashboard
- chmod +x update_dashboard
- bash ./update_dashboard

compile:
image: golang:1.8.1
stage: build
script:
- echo $GOPATH
- ln -s /builds /go/src/github.com
- cd /go/src/github.com/coredns/coredns
- go get github.com/mholt/caddy
- make -j $(getconf _NPROCESSORS_ONLN)
-f Makefile.release build-linux
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
untracked: true
expire_in: 4 weeks
paths:
- build/

.tar:
stage: package
image: golang:1.8.1
script:
- make -f Makefile.release tar
dependencies:
- compile
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
untracked: true
expire_in: 4 weeks
paths:
- release/

container:
stage: package
#image: docker:17.05.0
script:
- IMAGE_TAG=${CI_COMMIT_REF_NAME}.${CI_COMMIT_SHA_SHORT}.${CI_JOB_ID}
- cp build/Linux/coredns .
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
- echo export COREDNS_IMAGE=$CI_REGISTRY_IMAGE | tee release.env
- echo export COREDNS_TAG=$IMAGE_TAG | tee -a release.env
- cat release.env
dependencies:
- compile
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
expire_in: 4 weeks
paths:
- release.env

release:
stage: release
image: golang:1.8.1
script:
- cat release.env
- curl -X POST
-F token=$CI_JOB_TOKEN
-F ref=ci-master-v0.1.0
https://gitlab.cncf.ci/api/v4/projects/2/trigger/pipeline
- echo FIXME -- vars not support with CI_JOB_TOKEN yet -F "variables[COREDNS_BRANCH]=${CI_COMMIT_REF_NAME}"
dependencies:
- container
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
expire_in: 4 weeks
paths:
- release.env
21 changes: 21 additions & 0 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:alpine
MAINTAINER "Denver Williams <denver@ii.coop>"
ENV KUBECTL_VERSION=v1.5.2
ENV ARC=amd64

# Install Deps
RUN apk update
RUN apk add --update git bash util-linux wget tar curl build-base
RUN go get -u github.com/coredns/coredns/test

#Install Kubectl
RUN wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/$ARC/kubectl && \
chmod +x /usr/local/bin/kubectl

#Copy Files

COPY files/ /coredns/e2e/

WORKDIR /go/src/github.com/coredns/coredns/test

CMD ["/bin/bash"]
198 changes: 198 additions & 0 deletions e2e/files/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
apiVersion: v1
kind: Namespace
metadata:
name: test-1
---
apiVersion: v1
kind: Namespace
metadata:
name: test-2
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: de-1-a
namespace: test-1
spec:
replicas: 1
template:
metadata:
labels:
app: app-1-a
spec:
containers:
- name: app-1-a-c
image: gcr.io/google_containers/pause-amd64:3.0
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: de-1-b
namespace: test-1
spec:
replicas: 1
template:
metadata:
labels:
app: app-1-b
spec:
containers:
- name: app-1-b-c
image: gcr.io/google_containers/pause-amd64:3.0
ports:
- containerPort: 80
name: http
protocol: TCP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: de-c
namespace: test-1
spec:
replicas: 1
template:
metadata:
labels:
app: app-c
spec:
containers:
- name: app-c-c
image: gcr.io/google_containers/pause-amd64:3.0
ports:
- containerPort: 1234
name: c-port
protocol: UDP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: de-c
namespace: test-2
spec:
replicas: 1
template:
metadata:
labels:
app: app-c
spec:
containers:
- name: app-c-c
image: gcr.io/google_containers/pause-amd64:3.0
ports:
- containerPort: 1234
name: c-port
protocol: UDP
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: de-d1
namespace: test-1
spec:
replicas: 2
template:
metadata:
labels:
app: app-d
spec:
containers:
- name: app-d-c
image: gcr.io/google_containers/pause-amd64:3.0
ports:
- containerPort: 1234
name: c-port
protocol: UDP
---
apiVersion: v1
kind: Service
metadata:
name: svc-1-a
namespace: test-1
spec:
selector:
app: app-1-a
clusterIP: 10.0.0.100
ports:
- name: http
port: 80
protocol: TCP
- name: https
port: 443
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: svc-1-b
namespace: test-1
spec:
selector:
app: app-1-b
clusterIP: 10.0.0.110
ports:
- name: http
port: 80
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: svc-c
namespace: test-1
spec:
selector:
app: app-c
clusterIP: 10.0.0.115
ports:
- name: c-port
port: 1234
protocol: UDP
---
apiVersion: v1
kind: Service
metadata:
name: svc-c
namespace: test-2
spec:
selector:
app: app-c
clusterIP: 10.0.0.120
ports:
- name: c-port
port: 1234
protocol: UDP
---
apiVersion: v1
kind: Service
metadata:
name: headless-svc
namespace: test-1
spec:
selector:
app: app-d
clusterIP: None
ports:
- name: c-port
port: 1234
protocol: UDP
---
apiVersion: v1
kind: Service
metadata:
name: ext-svc
namespace: test-1
spec:
type: ExternalName
externalName: example.net
ports:
- name: c-port
port: 1234
protocol: UDP