-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mongoose
committed
Aug 13, 2024
0 parents
commit cfb703a
Showing
18 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
version: 2.1 | ||
|
||
references: | ||
- &OTP26 mongooseim/cimg-erlang:26.1.2 | ||
- &HELM_VERSION v3.10.1 | ||
- &KIND_VERSION v0.20.0 | ||
- &K8S_VERSION v1.27.3 | ||
|
||
orbs: | ||
helm: circleci/[email protected] | ||
|
||
jobs: | ||
helm-lint: | ||
docker: | ||
- image: cimg/go:1.15.6 | ||
steps: | ||
- checkout | ||
- helm/install-helm-client: | ||
version: *HELM_VERSION | ||
- run: | ||
name: Lint charts | ||
command: helm lint MongooseIM/ MongoosePush/ | ||
packages-deploy: | ||
docker: | ||
- image: cimg/go:1.15.6 | ||
steps: | ||
- checkout | ||
- add_ssh_keys | ||
- helm/install-helm-client: | ||
version: *HELM_VERSION | ||
- run: | ||
name: Configure Git | ||
command: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Mongoose" | ||
- run: | ||
name: Generate packages and orphan commit | ||
command: | | ||
git fetch origin packages && \ | ||
helm package MongooseIM/ MongoosePush/ && \ | ||
git checkout origin/packages -- index.yaml '*.tgz' && \ | ||
git checkout --orphan tmp && \ | ||
git rm --cached . -r && \ | ||
helm repo index ./ --url https://esl.github.io/MongooseHelm/ | ||
git add *.tgz index.yaml .circleci/config.yml && \ | ||
git commit -m "Mongoose Charts" | ||
- run: | ||
name: Update the `packages` branch to point to this commit and push it | ||
command: | | ||
git checkout packages -f && \ | ||
git reset tmp --hard && \ | ||
git branch -D tmp && \ | ||
git push origin packages --force | ||
k8s-with-kind: | ||
parameters: | ||
database: | ||
type: string | ||
executor: otp_26 | ||
environment: | ||
KIND_VERSION: *KIND_VERSION | ||
K8S_VERSION: *K8S_VERSION | ||
DB: << parameters.database >> | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Install KinD | ||
command: | | ||
curl -Lo kind https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-linux-amd64 | ||
chmod +x kind | ||
sudo mv kind /usr/local/bin/ | ||
- run: | ||
name: Install Rebar3 | ||
command: | | ||
curl -Lo rebar3 https://s3.amazonaws.com/rebar3/rebar3 | ||
chmod +x rebar3 | ||
sudo mv rebar3 /usr/local/bin/ | ||
- run: | ||
name: Create Kubernetes Cluster | ||
command: | | ||
kind create cluster --loglevel debug | ||
- run: | ||
name: Install kubectl | ||
command: | | ||
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$K8S_VERSION/bin/linux/amd64/kubectl | ||
chmod +x kubectl | ||
sudo mv kubectl /usr/local/bin/ | ||
- run: | ||
name: Port forwarding to the remote Docker | ||
command: | | ||
APISERVER_PORT=$(kubectl config view -o jsonpath='{.clusters[].cluster.server}' | cut -d: -f 3 -) && \ | ||
ssh -f -N -L 127.0.0.1:$APISERVER_PORT:127.0.0.1:$APISERVER_PORT remote-docker | ||
- run: | ||
name: Run Tests | ||
command: | | ||
kubectl cluster-info --context kind-kind | ||
kubectl get pods --all-namespaces | ||
- helm/install-helm-client: | ||
version: *HELM_VERSION | ||
- run: | ||
name: Run common tests | ||
command: | | ||
rebar3 ct | ||
executors: | ||
otp_26: | ||
docker: | ||
- image: *OTP26 | ||
resource_class: medium+ | ||
|
||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- helm-lint: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
ignore: packages | ||
- k8s-with-kind: | ||
matrix: | ||
parameters: | ||
database: [mariadb, pgsql, mysql] | ||
- packages-deploy: | ||
requires: | ||
- helm-lint | ||
filters: | ||
branches: | ||
only: master |
Oops, something went wrong.