This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/test-room-7/action…
…-update-file-1.8.0
- Loading branch information
Showing
683 changed files
with
229,598 additions
and
184 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 |
---|---|---|
|
@@ -17,10 +17,10 @@ jobs: | |
contents: write | ||
discussions: write | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Backing up Changelog | ||
run: | | ||
mv CHANGELOG.md OLD.CHANGELOG.md | ||
|
@@ -35,13 +35,13 @@ jobs: | |
skip-version-file: 'true' | ||
skip-commit: 'false' | ||
git-push: 'true' | ||
|
||
- name: Merging Changelog | ||
if: ${{ !steps.changelog.outputs.skipped }} | ||
run: | | ||
mv CHANGELOG.md RELEASE.md | ||
cat RELEASE.md OLD.CHANGELOG.md > CHANGELOG.md | ||
- name: Update resources | ||
uses: test-room-7/[email protected] | ||
if: ${{ !steps.changelog.outputs.skipped }} | ||
|
@@ -59,4 +59,21 @@ jobs: | |
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: ${{ steps.changelog.outputs.tag }} | ||
name: ${{ steps.changelog.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} | ||
|
||
# Clean up OpenShift when PR closed, no conditions | ||
cleanup-openshift: | ||
name: Cleanup OpenShift | ||
env: | ||
name: ${{ github.event.repository.name }}-${{ github.event.number }} | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Remove OpenShift artifacts | ||
run: | | ||
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} | ||
oc project ${{ vars.OC_NAMESPACE }} | ||
# If found, then remove | ||
helm status ${{ env.name }} && helm uninstall --no-hooks ${{ env.name }} || \ | ||
echo "Not found: ${{ env.name }}" |
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
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 |
---|---|---|
|
@@ -4,15 +4,22 @@ | |
[](/LICENSE) | ||
[](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md) | ||
|
||
# Vault Approle Token extractor through Vault Broker API | ||
# Vault App role Token extractor through Vault Broker API | ||
|
||
This action acquires an approle token from vault through the Broker API. This allows the team to access and generate tokens through the github action pipeline. | ||
This action acquires an approle token from vault through the Broker API. This allows the team to read secrets through the GitHub action pipeline. | ||
|
||
This is useful in CI/CD pipelines where you need to access a secret, get a vault token or anything vault related. | ||
|
||
This tool is currently based on the existing documentation provided by 1team. | ||
|
||
# Usage | ||
## Prerequisites | ||
1. Discussion with 1team/DBA to start the onboarding process on vault. | ||
2. Project setup is done for 3 envs development, test and production. | ||
3. The provision_role_id is environment specific and should be stored in as secrets in the github repository. | ||
4. The broker_jwt is global and NOT environment specific and should be stored in as secrets in the github repository. | ||
|
||
|
||
## Usage | ||
|
||
```yaml | ||
- uses: bcgov-nr/action-vault-broker-approle@main | ||
|
@@ -97,58 +104,11 @@ jobs: | |
token: ${{ steps.broker.outputs.vault_token }} | ||
exportEnv: 'false' | ||
secrets: | | ||
apps/data/dev/super_secrets username | SECRET_USER; | ||
apps/data/dev/super_secrets password | SECRET_PWD; | ||
apps/data/${environment}/${project_name}/${app_name}/super_secrets username | SECRET_USER; | ||
apps/data/${environment}/${project_name}/${app_name}/super_secrets password | SECRET_PWD; | ||
``` | ||
# Example, Matrix Token Reads | ||
Read from multiple environments. | ||
Create or modify a GitHub workflow, like below. E.g. `./github/workflows/pr-open.yml` | ||
|
||
```yaml | ||
name: Pull Request | ||
on: | ||
pull_request: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
builds: | ||
permissions: | ||
packages: write | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
env: [dev, test] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Broker | ||
id: broker | ||
uses: bcgov-nr/action-vault-broker-approle@main | ||
with: | ||
broker_jwt: ${{ secrets.BROKER_JWT }} | ||
provision_role_id: ${{ secrets.PROVISION_ROLE }} | ||
project_name: super | ||
app_name: app-super | ||
environment: development | ||
- name: Import Secrets | ||
id: secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: https://vault-iit.apps.silver.devops.gov.bc.ca | ||
token: ${{ steps.broker.outputs.vault_token }} | ||
exportEnv: 'false' | ||
secrets: | | ||
apps/data/${{ matrix.env }}/super_secrets username | SECRET_USER; | ||
apps/data/${{ matrix.env }}/super_secrets password | SECRET_PWD; | ||
``` | ||
# Output | ||
|
@@ -158,4 +118,4 @@ See examples above. | |
|
||
<!-- # Acknowledgements | ||
|
||
This Action is provided courtesty of the Forestry Suite of Applications, part of the Government of British Columbia. --> | ||
This Action is provided courtesy of the FDS Team and Architecture Team, part of the Government of British Columbia. --> |
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
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,17 @@ | ||
apiVersion: v2 | ||
name: action-vault-broker-approle | ||
description: A Helm chart for Kubernetes deployment. | ||
icon: https://www.nicepng.com/png/detail/521-5211827_bc-icon-british-columbia-government-logo.png | ||
|
||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.0.1" |
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,48 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "name.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "labels" -}} | ||
helm.sh/chart: {{ include "name.chart" . }} | ||
{{ include "selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "fullname" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
|
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,8 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }} | ||
labels: {{- include "selectorLabels" . | nindent 4 }} | ||
data: | ||
test: {{ .Values.global.secrets.test | b64enc | quote }} |
Oops, something went wrong.