2021-09-13 11:37:56 +02:00

143 lines
4.8 KiB
YAML

kube-builder: &install-kube-builder
name: Fetch kube-builder
command: |
os=$(go env GOOS)
arch=$(go env GOARCH)
# Download kubebuilder and extract it to tmp
# Temporary solution, older versions of kubebuilder are nolonger available under old urls.
# Upgrading kubebuilder to latest version is a bigger story and needs more work.
# We will use direct GH release URL for now.
curl -sL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_${os}_${arch}.tar.gz | 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.3.2_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.15
working_directory: /go/src/github.com/ory/hydra-maester
steps:
- checkout
- run:
<<: *install-kube-builder
- run: make
test:
docker:
- image: circleci/golang:1.15
working_directory: /go/src/github.com/ory/hydra-maester
steps:
- checkout
- run:
<<: *install-kube-builder
- 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.15.11.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.15.11.linux-amd64.tar.gz
sudo echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
go version
- run:
<<: *install-kube-builder
- run:
name: Install kustomize
command: |
curl -sL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.1.2/kustomize_v4.1.2_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mv /tmp/kustomize /usr/local/bin/kustomize
kustomize version
- run:
name: Install Kind
command: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/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.15
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.5-node
steps:
- checkout
- run: gem install github_changelog_generator -v 1.14.3
- 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:
- build:
filters:
tags:
only: /.*/
- test-integration:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- release:
requires:
- build
- test
- test-integration
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-changelog:
requires:
- release
filters:
tags:
only: /.*/
branches:
ignore: /.*/