Skip to content

Commit

Permalink
Merge pull request #7 from pwei1018/main
Browse files Browse the repository at this point in the history
Helm Chart setup -  bcregistry-api
  • Loading branch information
pwei1018 authored May 18, 2021
2 parents 9d0550d + 2ba2c84 commit ffe765a
Show file tree
Hide file tree
Showing 31 changed files with 1,304 additions and 164 deletions.
3 changes: 3 additions & 0 deletions .github/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
helm-extra-args: --timeout 600s
# check-version-increment: true
debug: true
12 changes: 12 additions & 0 deletions .github/helm-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail

HELM_DOCS_VERSION="1.5.0"

# install helm-docs
curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz
tar -xf /tmp/helm-docs.tar.gz helm-docs

# validate docs
./helm-docs
git diff --exit-code
15 changes: 15 additions & 0 deletions .github/kubeval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/master -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
KUBEVAL_VERSION="0.16.0"
SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/"

# install kubeval
curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz
tar -xf /tmp/kubeval.tar.gz kubeval

# validate charts
for CHART_DIR in ${CHART_DIRS}; do
helm template --values "${CHART_DIR}"/ci/ci-values.yaml "${CHART_DIR}" | ./kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
done
45 changes: 45 additions & 0 deletions .github/workflows/charts-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint and Test Charts

on:
pull_request:
paths:
- "charts/**"

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install
32 changes: 32 additions & 0 deletions .github/workflows/charts-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release Charts

on:
push:
branches:
- main
paths:
- "charts/**"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
26 changes: 26 additions & 0 deletions .github/workflows/downpage-off.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Turn off downpage

on:
workflow_dispatch:
inputs:
environement:
description: "Environment (dev/test/prod)"
required: true
default: "dev"

jobs:
downpage-off:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set env by input
run: |
echo "TAG_NAME=${{ github.event.inputs.environement }}" >> $GITHUB_ENV
- name: Login Openshift and turn off downpage
run: |
oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}}
oc patch route bc-registry-search-prod -p '{"spec": {"to": {"name": "search-web-prod"}, "port": {"targetPort": "search-web-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-namerequest-prod -p '{"spec": {"to": {"name": "namerequest-prod"}, "port": {"targetPort": "namerequest-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-business-prod -p '{"spec": {"to": {"name": "business-filings-prod"}, "port": {"targetPort": "business-filings-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-auth-prod -p '{"spec": {"to": {"name": "auth-web-prod"}, "port": {"targetPort": "auth-web-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
31 changes: 31 additions & 0 deletions .github/workflows/downpage-on.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Turn on downpage

on:
schedule:
- cron: "40 11 25 04 *"
workflow_dispatch:
inputs:
environement:
description: "Environment (prod/test/prod)"
required: true
default: "prod"
jobs:
downpage-on:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set env by input
run: |
echo "TAG_NAME=${{ github.event.inputs.environement }}" >> $GITHUB_ENV
- name: Set env
if: env.TAG_NAME == ''
run: |
echo "TAG_NAME=prod" >> $GITHUB_ENV
- name: Login Openshift and Turn on downpage
run: |
oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}}
oc patch route bc-registry-search-prod -p '{"spec": {"to": {"name": "downpage-prod"}, "port": {"targetPort": "downpage-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-namerequest-prod -p '{"spec": {"to": {"name": "downpage-prod"}, "port": {"targetPort": "downpage-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-business-prod -p '{"spec": {"to": {"name": "downpage-prod"}, "port": {"targetPort": "downpage-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
oc patch route bc-registry-auth-prod -p '{"spec": {"to": {"name": "downpage-prod"}, "port": {"targetPort": "downpage-prod-tcp"}}}' -n ${{secrets.OPENSHIFT4_NAMESPACE_FRONTEND}}-prod
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[![img](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)

---
description: BC Registries and Online Services SRE team's application
ignore: true
BC Registries and Online Services SRE team's application
---

## About
Expand Down
Loading

0 comments on commit ffe765a

Please sign in to comment.