2019-08-01 11:21:59 +02:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.12
|
|
|
|
working_directory: /go/src/github.com/ory/hydra-maester
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Enable go1.12 modules
|
|
|
|
command: |
|
|
|
|
echo 'export GO111MODULE=on' >> $BASH_ENV
|
|
|
|
source $BASH_ENV
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Fetch kube-builder
|
|
|
|
command: |
|
|
|
|
os=$(go env GOOS)
|
|
|
|
arch=$(go env GOARCH)
|
|
|
|
|
|
|
|
# download kubebuilder and extract it to tmp
|
|
|
|
curl -sL https://go.kubebuilder.io/dl/2.0.0-alpha.4/${os}/${arch} | tar -xz -C /tmp/
|
|
|
|
|
|
|
|
# move to a long-term location and put it on your path
|
|
|
|
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
|
|
|
|
sudo mv /tmp/kubebuilder_2.0.0-alpha.4_${os}_${arch} /usr/local/kubebuilder
|
|
|
|
export PATH=$PATH:/usr/local/kubebuilder/bin
|
|
|
|
|
|
|
|
- run: make
|
|
|
|
test:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.12
|
|
|
|
environment:
|
|
|
|
- GO111MODULE=on
|
|
|
|
working_directory: /go/src/github.com/ory/hydra-maester
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Fetch kube-builder
|
|
|
|
command: |
|
|
|
|
os=$(go env GOOS)
|
|
|
|
arch=$(go env GOARCH)
|
|
|
|
|
|
|
|
# download kubebuilder and extract it to tmp
|
|
|
|
curl -sL https://go.kubebuilder.io/dl/2.0.0-alpha.4/${os}/${arch} | tar -xz -C /tmp/
|
|
|
|
|
|
|
|
# move to a long-term location and put it on your path
|
|
|
|
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
|
|
|
|
sudo mv /tmp/kubebuilder_2.0.0-alpha.4_${os}_${arch} /usr/local/kubebuilder
|
|
|
|
export PATH=$PATH:/usr/local/kubebuilder/bin
|
|
|
|
- run: make test
|
|
|
|
test-integration:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Update golang
|
|
|
|
command: |
|
|
|
|
sudo rm -rf /usr/local/go/
|
|
|
|
curl -LO https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
|
|
|
|
sudo tar -C /usr/local -xzf go1.12.7.linux-amd64.tar.gz
|
|
|
|
sudo echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
|
|
|
|
go version
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Download kube-builder
|
|
|
|
command: |
|
|
|
|
os=$(go env GOOS)
|
|
|
|
arch=$(go env GOARCH)
|
|
|
|
|
|
|
|
# download kubebuilder and extract it to tmp
|
|
|
|
curl -sL https://go.kubebuilder.io/dl/2.0.0-alpha.4/${os}/${arch} | tar -xz -C /tmp/
|
|
|
|
|
|
|
|
# move to a long-term location and put it on your path
|
|
|
|
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
|
|
|
|
sudo mv /tmp/kubebuilder_2.0.0-alpha.4_${os}_${arch} /usr/local/kubebuilder
|
|
|
|
sudo echo "export PATH=$PATH:/usr/local/kubebuilder/bin" >> $HOME/.profile
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install ginkgo,controller-gen, kustomize
|
|
|
|
command: |
|
|
|
|
go get github.com/onsi/ginkgo/ginkgo
|
|
|
|
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.0-beta.2
|
|
|
|
go install sigs.k8s.io/kustomize/v3/cmd/kustomize
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install Kind
|
|
|
|
command: |
|
|
|
|
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64
|
|
|
|
chmod +x ./kind
|
|
|
|
sudo mv ./kind /usr/local/bin/kind
|
|
|
|
- run:
|
|
|
|
name: Install kubectl
|
|
|
|
command: |
|
|
|
|
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
|
|
|
chmod +x ./kubectl
|
|
|
|
sudo mv ./kubectl /usr/local/bin/kubectl
|
|
|
|
export KUBECONFIG=$(kind get kubeconfig-path)
|
|
|
|
- run:
|
|
|
|
name: Run integration tests
|
|
|
|
command: make test-integration
|
|
|
|
|
|
|
|
release:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.12
|
|
|
|
environment:
|
|
|
|
- GO111MODULE=on
|
|
|
|
working_directory: /go/src/github.com/ory/hydra-maester
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
echo 'export DOCKER_FULL_TAG=$(echo $CIRCLE_TAG | tr '+' '_')' >> $BASH_ENV
|
|
|
|
echo 'export DOCKER_SHORT_TAG=$(echo $CIRCLE_TAG | cut -d '+' -f1)' >> $BASH_ENV
|
|
|
|
./.circleci/release_name.bash
|
|
|
|
source $BASH_ENV
|
|
|
|
- setup_remote_docker
|
|
|
|
- run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
|
|
|
|
- run: curl -sL https://git.io/goreleaser | bash
|
|
|
|
|
|
|
|
release-changelog:
|
|
|
|
docker:
|
|
|
|
- image: circleci/ruby:2.4-node
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: gem install github_changelog_generator
|
|
|
|
- run: sudo npm i -g doctoc
|
|
|
|
- run: github_changelog_generator -u ory -p hydra-maester -o CHANGELOG.md --token $GITHUB_TOKEN
|
|
|
|
- run: doctoc CHANGELOG.md
|
|
|
|
- run: doctoc README.md
|
|
|
|
- run: git config --global user.email "circleci@ory.am"
|
|
|
|
- run: git config --global user.name "ORY Continuous Integration"
|
|
|
|
- run: git add CHANGELOG.md
|
|
|
|
- run: git add README.md
|
|
|
|
- run: |
|
|
|
|
git commit -a -m "docs: Incorporates changes from version $(git describe --tags)" || true
|
|
|
|
- run: git remote rm origin
|
|
|
|
- run: git remote add origin https://arekkas:$GITHUB_TOKEN@github.com/ory/hydra-maester.git
|
|
|
|
- run: git push origin HEAD:master || true
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
"test, build and release":
|
|
|
|
jobs:
|
2019-08-21 12:10:25 +02:00
|
|
|
- build:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- test-integration:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- test:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- release:
|
|
|
|
requires:
|
|
|
|
- test
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
- release-changelog:
|
|
|
|
requires:
|
|
|
|
- release
|
2019-08-01 15:09:44 +02:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2019-08-21 12:10:25 +02:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|