Add CI for local development

We're using concourse because we happen to have a concourse deployment
available. You can look at it here:

https://wings.concourse.ci/teams/k8s-c10s/
This commit is contained in:
Gareth Smith 2017-11-22 12:20:02 +00:00
parent fc5d4050b1
commit 1714b31d49
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,70 @@
jobs:
- name: test-dev-branch
public: true
serial: true
plan:
- get: git-kubectl-dev
trigger: true
- task: run-tests
config:
platform: linux
image_resource:
type: docker-image
source:
repository: golang
tag: 1.9
inputs:
- name: git-kubectl-dev
path: go/src/k8s.io/kubectl
run:
path: /bin/bash
args:
- -c
- |
#!/usr/bin/env bash
set -eux
export GOPATH="${PWD}/go"
export PATH="${PATH}:${GOPATH}/bin"
go get github.com/onsi/ginkgo/ginkgo
cd "${GOPATH}/src/k8s.io/kubectl/pkg/framework/test"
ginkgo -r
- name: push-to-prod-branch
serial: true
plan:
- get: git-kubectl-dev
trigger: true
passed:
- test-dev-branch
- put: git-kubectl-pair2
params:
repository: git-kubectl-dev
force: true
- put: git-kubectl-pair1
params:
repository: git-kubectl-dev
force: true
resources:
- name: git-kubectl-dev
type: git
source:
uri: {{git-dev-url}} # git@github.com:totherme/kubectl
branch: test-framework-dev
private_key: {{git-dev-private-key}}
ignore_paths: [pkg/framework/test/ci]
- name: git-kubectl-pair1
type: git
source:
uri: {{git-pair1-url}} #git@github.com:totherme/kubectl
branch: test-framework
private_key: {{git-pair1-private-key}}
- name: git-kubectl-pair2
type: git
source:
uri: {{git-pair2-url}} #git@github.com:hoegaarden/kubectl
branch: test-framework
private_key: {{git-pair2-private-key}}

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -eu
# Use DEBUG=1 ./set-pipeline.sh to get debug output
[[ -z "${DEBUG:-""}" ]] || set -x
# Use CONCOURSE_TARGET=my-concourse ./set-pipeline.sh to connect to your local concourse
: "${CONCOURSE_TARGET:="wings"}"
# Use PIPELINE_NAME=my-name ./set-pipeline.sh to give your pipeline a different name
: "${PIPELINE_NAME:="kubectl"}"
# Use PAIR1_LASTPASS=my-lastpass-key ./set-pipeline.sh to get your github keys and URL from your lastpass entry
: "${PAIR1_LASTPASS:="oss-k8s-github-gds-keypair"}"
: "${PAIR2_LASTPASS:="oss-k8s-github-hhorl-keypair"}"
github_pair1_key="$(lpass show "${PAIR1_LASTPASS}" --field "Private Key")"
github_pair2_key="$(lpass show "${PAIR2_LASTPASS}" --field "Private Key")"
github_pair1_url="$(lpass show "${PAIR1_LASTPASS}" --notes)"
github_pair2_url="$(lpass show "${PAIR2_LASTPASS}" --notes)"
script_dir="$(cd "$(dirname "$0")" ; pwd)"
# Create/Update the pipline
fly set-pipeline \
--target="${CONCOURSE_TARGET}" \
--pipeline="${PIPELINE_NAME}" \
--config="${script_dir}/pipeline.yml" \
--var=git-dev-url="${github_pair1_url}" \
--var=git-pair1-url="${github_pair1_url}" \
--var=git-pair2-url="${github_pair2_url}" \
--var=git-dev-private-key="${github_pair1_key}" \
--var=git-pair1-private-key="${github_pair1_key}" \
--var=git-pair2-private-key="${github_pair2_key}"
# Make the pipeline publicly available
fly expose-pipeline \
--target="${CONCOURSE_TARGET}" \
--pipeline="${PIPELINE_NAME}"