Skip to content
Browse files

more opts

  • Loading branch information...
1 parent cbb5765 commit 659e04acea0c78571f9a4f01eb0b2622f113ce5c @ethernetdan ethernetdan committed
Showing with 35 additions and 16 deletions.
  1. +2 −2 Makefile
  2. +3 −8 images/gitlabci/Dockerfile
  3. +12 −0 images/gitlabci/README.md
  4. +18 −6 images/gitlabci/entrypoint.sh
View
4 Makefile
@@ -26,7 +26,7 @@ GITLAB_CONTEXT ?= ./build/gitlab
# image data
ORG ?= redspreadapps
-NAME ?= spread-gitlab
+NAME ?= gitlabci
TAG ?= latest
GITLAB_IMAGE_NAME = "$(ORG)/$(NAME):$(TAG)"
@@ -109,4 +109,4 @@ godep:
@echo "Recalculating godeps, removing Godeps and vendor if not canceled in 5 seconds"
@sleep 5
rm -rf Godeps vendor
- GO15VENDOREXPERIMENT="1" godep save -v ./pkg/... ./cli/... ./cmd/...
+ GO15VENDOREXPERIMENT="1" godep save -v ./pkg/... ./cli/... ./cmd/...
View
11 images/gitlabci/Dockerfile
@@ -1,13 +1,8 @@
-FROM gliderlabs/alpine:3.3
-
-RUN apk-install bash
-
-WORKDIR /opt/spread-gitlab
+FROM docker:git
ADD spread-linux-static /usr/local/bin/spread
-ADD entrypoint.sh ./entrypoint.sh
+ADD entrypoint.sh /opt/spread-gitlab/entrypoint.sh
ENV KUBECFG_INSECURE_SKIP_TLS_VERIFY="false"
-ENV DEPLOY_DIR="."
-ENTRYPOINT ["./entrypoint.sh"]
+ENTRYPOINT ["/opt/spread-gitlab/entrypoint.sh"]
View
12 images/gitlabci/README.md
@@ -30,16 +30,28 @@ Disable requirement that connections must pass TLS verification
Path to a cert file for the certificate authority.
+`KUBECFG_CERTIFICATE_AUTHORITY_DATA`
+
+Certificate data
+
### User
`KUBECFG_CLIENT_CERTIFICATE`
Path to a client cert file for TLS
+`KUBECFG_CLIENT_CERTIFICATE_DATA`
+
+TLS client cert data
+
`KUBECFG_CLIENT_KEY`
Path to a client key file for TLS.
+`KUBECFG_CLIENT_KEY_DATA`
+
+Key data
+
`KUBECFG_TOKEN`
Bearer token for cluster auth
View
24 images/gitlabci/entrypoint.sh
@@ -1,9 +1,11 @@
-#!/bin/bash
+#!/bin/sh
-# setup kubectl config
-echo "setting up kubectl config"
-mkdir -p ~/.kube
->~/.kube/config cat <<EOF
+# if config file does not exist produce one with env vars
+if [ ! -f ~/.kube/config ]; then
+ echo "setting up kubectl config"
+ mkdir -p ~/.kube
+
+ >~/.kube/config cat <<EOF
kind: Config
apiVersion: v1
current-context: gitlab
@@ -19,16 +21,26 @@ clusters:
api-version: $KUBECFG_API_VERSION
insecure-skip-tls-verify: $KUBECFG_INSECURE_SKIP_TLS_VERIFY
certificate-authority: $KUBECFG_CERTIFICATE_AUTHORITY
+ certificate-authority-data: $KUBECFG_CERTIFICATE_AUTHORITY_DATA
+
users:
- name: default
user:
client-certificate: $KUBECFG_CLIENT_CERTIFICATE
client-certificate-data: $KUBECFG_CLIENT_CERTIFICATE_DATA
client-key: $KUBECFG_CLIENT_KEY
+ client-key-data: $KUBECFG_CLIENT_KEY_DATA
token: $KUBECFG_TOKEN
username: $KUBECFG_USERNAME
password: $KUBECFG_PASSWORD
EOF
+fi
-spread deploy $DEPLOY_DIR
+if [ ! -z "$DEPLOY_DIR" ]; then
+ echo "using DEPLOY_DIR..."
+ spread deploy $DEPLOY_DIR
+ exit
+fi
+echo "Using project dir..."
+spread deploy $CI_PROJECT_DIR

0 comments on commit 659e04a

Please sign in to comment.
Something went wrong with that request. Please try again.