Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp #462

Merged
merged 141 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
09882fe
Remove Prometheus usage
dividehex May 10, 2023
2e0a4af
Remove Credstash
dividehex May 10, 2023
1905f2c
Update requirements.txt
dividehex May 10, 2023
7cefb29
Update gitignore
dividehex May 10, 2023
98796b8
Remove unused files
dividehex May 10, 2023
5b9e3ba
Relocate old ansible files
dividehex May 10, 2023
30ea743
Remove aws logging
dividehex May 12, 2023
a3a0380
Redo Dockerfile
dividehex May 12, 2023
6015e2e
Load config from environment variables
dividehex May 12, 2023
2110722
Github Actions to deploy
dividehex May 12, 2023
ea54520
Rename github action workflow
dividehex May 12, 2023
be3351c
Trigger action in this dev branch
dividehex May 12, 2023
f76e143
Docker auth in GHA
dividehex May 12, 2023
bd235df
GHA build and push docker
dividehex May 12, 2023
dea6a3a
Update certifi and dataclasses pip packages
dividehex May 12, 2023
cb39abb
GHA clouddeploy templates
dividehex May 12, 2023
b033b33
Allow unauthenticated logout route
dividehex May 29, 2023
4520883
Revert "Allow unauthenticated logout route"
dividehex May 29, 2023
580180d
Major package dependancy updates
dividehex May 29, 2023
e246c3f
Fix requirements.txt
dividehex May 29, 2023
2161337
Clean up requirements.txt and pin updated packages
dividehex May 29, 2023
65073d9
More package dependency changes
dividehex May 29, 2023
9f70a94
Add missing cssmin package
dividehex May 29, 2023
dbc3859
Clean up dockerfile and add missing python deps
dividehex May 30, 2023
15a37b4
Use nodejs sass instead of ruby sass
dividehex May 30, 2023
682335d
Add missing jsmin dep
dividehex May 30, 2023
dad66b4
Return apps.yml to a skel file
dividehex May 30, 2023
0c911bd
Add deployment to GHA
dividehex May 30, 2023
cf76ddc
Change clouddeploy templates
dividehex May 30, 2023
78f18b4
Fix path to skaffold file
dividehex May 30, 2023
1cab1a1
Fix cloud deploy image name
dividehex May 30, 2023
b1c7289
Include staging envs with skaffold
dividehex May 30, 2023
fa8ea8d
Add envs for prod deployment
dividehex May 30, 2023
2f6535e
Remove and untrack .vscode settings
dividehex May 30, 2023
4a8e3d6
Set unique service accounts for cloud run
dividehex May 30, 2023
92c495d
Put service account in the correct place
dividehex May 30, 2023
5a3dbc0
Add usages lists for clouddeploy
dividehex May 31, 2023
d03adfa
Remove RENDER from usages
dividehex May 31, 2023
a2f0a09
Revert "Remove RENDER from usages"
dividehex May 31, 2023
6533065
Enable GHA slack notifications
dividehex Jun 1, 2023
17ad2cc
Enhance slack notifaction payload
dividehex Jun 1, 2023
0af6f5a
Fix payload path
dividehex Jun 1, 2023
0776b73
Fix gha context refs
dividehex Jun 1, 2023
72bab0e
Temp gha context debug output
dividehex Jun 1, 2023
f0a69ac
Temp jobs context debug output
dividehex Jun 1, 2023
ae5ea02
remove debug
dividehex Jun 1, 2023
49d49fc
Test gha slack notification
dividehex Jun 1, 2023
8362600
Workaround missing context
dividehex Jun 1, 2023
eaa22da
Test status updates to slack
dividehex Jun 1, 2023
b14b11a
Remove dup step ids
dividehex Jun 1, 2023
ea5443e
Test GHA slack notification
dividehex Jun 1, 2023
b7feb9d
Fix json payload
dividehex Jun 1, 2023
8578a37
Test slack notification
dividehex Jun 1, 2023
c3a0301
Move status payload to separate file
dividehex Jun 1, 2023
5618089
Add failure action
dividehex Jun 2, 2023
f58485d
Clean up gha
dividehex Jun 2, 2023
8021218
Add buildname to status payloads
dividehex Jun 2, 2023
18321a5
Adjust status payload formatting
dividehex Jun 2, 2023
a714363
Adjust status payload formatting
dividehex Jun 2, 2023
ba95071
fix action link in payload
dividehex Jun 2, 2023
11ec6ba
fix action link in payload
dividehex Jun 2, 2023
30d8f79
Use OAuth token with gha slack app
dividehex Jun 2, 2023
cffa370
Fix slack id in gha step
dividehex Jun 2, 2023
df81376
Fix slack id in gha step
dividehex Jun 2, 2023
af0953e
Rework gha slack notifications
dividehex Jun 2, 2023
6df8d7c
Rework gha slack notifications
dividehex Jun 2, 2023
a38b384
Put channel ids back in and remove multiple channels
dividehex Jun 7, 2023
d088913
remove swp file and add manual trigger for gha
dividehex Jun 7, 2023
a2ca133
Test color of block kit
dividehex Jun 7, 2023
e627c31
Test slack attachment
dividehex Jun 7, 2023
c776e17
Test updating main slack msg
dividehex Jun 7, 2023
a110aa7
Rework slack noitfiations
dividehex Jun 8, 2023
0e50c3c
Fix env vars in GHA slack notif
dividehex Jun 8, 2023
23671df
add slack context in gha
dividehex Jun 8, 2023
852be22
Fix quotes
dividehex Jun 8, 2023
58edc52
Fix emojis
dividehex Jun 8, 2023
f9c5820
Changes emoji
dividehex Jun 8, 2023
78be3d6
More emoji tweaking
dividehex Jun 8, 2023
201aeed
Add final step to deploy gha to view pipeline
dividehex Jun 8, 2023
3197ee7
Fix markdown
dividehex Jun 8, 2023
b514f72
Remove extra section
dividehex Jun 8, 2023
c108aac
Add dev to deploy pipeline
dividehex Jun 9, 2023
fe7ba7b
Fix deploy profile names
dividehex Jun 9, 2023
a867464
Change slack channel ID
dividehex Jun 9, 2023
ff0b3d8
Remove unused Person API
dividehex Jun 9, 2023
5bedde3
Include email in OIDC scopes
dividehex Jun 9, 2023
92a8608
Remove AWS code build config
dividehex Jun 10, 2023
62a654c
Add release version to docker image
dividehex Jun 10, 2023
69ab6a6
Fix env var
dividehex Jun 10, 2023
d5822a2
Fixed docker build arg
dividehex Jun 10, 2023
1f49238
chomp newline on build version
dividehex Jun 10, 2023
6d02e95
Major rewrite of gha
dividehex Jun 11, 2023
237116d
Fix run-as in GHA
dividehex Jun 11, 2023
785af07
Fix GHA
dividehex Jun 11, 2023
bbf550b
Fix GHA
dividehex Jun 11, 2023
b77e1fe
Fix GHA
dividehex Jun 11, 2023
9083ffe
Test failure in GHA
dividehex Jun 11, 2023
067836b
Testing gha
dividehex Jun 11, 2023
1ae485b
Fix syntax
dividehex Jun 11, 2023
7fabf2d
Fix syntax
dividehex Jun 11, 2023
eb24bf6
add docker build caching
dividehex Jun 11, 2023
e35690b
fix docker setup action
dividehex Jun 11, 2023
38b7fe0
Fix typo
dividehex Jun 11, 2023
b58b47f
Test gha artifact storage
dividehex Jun 11, 2023
d53cdeb
Fix artifact name
dividehex Jun 11, 2023
3da284d
Remove artifact
dividehex Jun 11, 2023
88a9ed6
Add actual tests to gha
dividehex Jun 11, 2023
24362b2
Pull docker image
dividehex Jun 11, 2023
3b089ed
Include dev requirements in Dockerfile
dividehex Jun 11, 2023
eda9cf4
Apply black linter
dividehex Jun 11, 2023
b48202d
Remove alert tests
dividehex Jun 11, 2023
4be91be
Add tox
dividehex Jun 11, 2023
8ef6526
Remove requirement-dev and apply lint formatter to tests
dividehex Jun 11, 2023
c0adab8
Update gitignore to ignore wheels build dir
dividehex Jun 11, 2023
15f3c54
Black --check only, ignore envfile, GHA validate job
dividehex Jun 11, 2023
ee920b4
fix Typo
dividehex Jun 11, 2023
b393062
Fix yaml
dividehex Jun 11, 2023
2549e2b
Make sure tox is install during GHA
dividehex Jun 11, 2023
72c5cc6
Push tox in the correct GHA job
dividehex Jun 11, 2023
acd215d
Fix slack validation msg
dividehex Jun 11, 2023
a7f8802
Modify service templates
dividehex Jun 11, 2023
c300694
Fix annotations
dividehex Jun 11, 2023
4651cb4
update cloud deploy templates
dividehex Jun 11, 2023
1945e80
Clean up unused files
dividehex Jun 11, 2023
9313e20
Remove deprecated stylelint rules
dividehex Jun 12, 2023
f1985ac
no-descending-specificity stylelint rule
dividehex Jun 12, 2023
94378de
Add eslint and stylelint to tox
dividehex Jun 12, 2023
b36f3e1
Remove travis and pip-selfcheck
dividehex Jun 12, 2023
85a10b5
Reformat base.scss
dividehex Jun 12, 2023
3693e75
Include eslint in tox default
dividehex Jun 12, 2023
f5b19c9
Add jwatkins as contib
dividehex Jun 12, 2023
01d63ec
Do not set cookie with domain
dividehex Jun 12, 2023
9e21f82
Set samesite
dividehex Jun 12, 2023
9af1365
Lint fix
dividehex Jun 12, 2023
bd907c5
Config change
dividehex Jun 13, 2023
629c1e7
Big linting changes
dividehex Jun 13, 2023
5940b78
Add pre-commit config
dividehex Jun 13, 2023
44db40f
Move samesite to lax
dividehex Jun 13, 2023
9c25636
Include fix to truncate app names
dividehex Jun 21, 2023
301003f
Implement server-side sessions with redis
dividehex Jun 25, 2023
791258a
Properly split redis host and port string
dividehex Jun 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 251 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: Build and Deploy SSO Dashboard

on:
workflow_dispatch:
push:
branches:
- 'revamp'

permissions:
contents: 'read'
id-token: 'write'

env:
APP: sso-dashboard
GAR_LOCATION: us-east1
PROJECT_ID: iam-auth0
REGION: us-east1
CHANNEL_IDS: C05AMLCL4JX
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN}}

jobs:
init:
name: Init
runs-on: ubuntu-latest
outputs:
release_name: ${{ steps.release_name.outputs.release_name }}
docker_tag: ${{ steps.docker_tag.outputs.docker_tag }}
slack_ts: ${{ steps.slack_ts.outputs.slack_ts }}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: 'Create release name'
id: release_name
run: echo "RELEASE_NAME=${{ env.APP }}-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT"

- name: 'Create docker tag'
id: docker_tag
run: echo "DOCKER_TAG=${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:${{ github.sha }}" >> "$GITHUB_OUTPUT"

- name: Send initial slack notification
uses: slackapi/[email protected]
id: slack
with:
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: dbab09
STATUS_TITLE: Starting Deployment Pipeline
STATUS_VALUE: ':link-run: *Running*'

- name: Output slack ts
id: slack_ts
run: echo "SLACK_TS=${{ steps.slack.outputs.ts }}" >> "$GITHUB_OUTPUT"

lint:
name: Linting / Unit Testing
needs: init
runs-on: ubuntu-latest
env:
RELEASE_NAME: ${{needs.init.outputs.release_name}}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: Update slack notification
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: dbab09
STATUS_TITLE: Linting/Unittesting
STATUS_VALUE: ':link-run: *Running*'

- name: Install tox
run: pip install tox

- name: Running Tox
run: tox

build:
name: Building
needs: [ init, lint ]
runs-on: ubuntu-latest
env:
RELEASE_NAME: ${{needs.init.outputs.release_name}}
DOCKER_TAG: ${{needs.init.outputs.docker_tag}}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: Update slack notification
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: dbab09
STATUS_TITLE: Building Docker Image
STATUS_VALUE: ':link-run: *Running*'

- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'

- name: 'Docker auth'
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker image with buildx
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args: RELEASE_NAME=${{ env.RELEASE_NAME }}
tags: "${{ env.DOCKER_TAG }}"
cache-from: type=gha
cache-to: type=gha,mode=max

validate:
name: Validating
needs: [ init, lint, build ]
runs-on: ubuntu-latest
env:
RELEASE_NAME: ${{needs.init.outputs.release_name}}
DOCKER_TAG: ${{needs.init.outputs.docker_tag}}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: Update slack notification
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: dbab09
STATUS_TITLE: Validating Image
STATUS_VALUE: ':link-run: *Running*'

- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'

- name: 'Docker auth'
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev

- name: Pull Docker image
run: docker pull "${{ env.DOCKER_TAG }}"

- name: Run validate docker image
uses: addnab/docker-run-action@v3
with:
image: "${{ env.DOCKER_TAG }}"
run: echo "TODO Add docker validation checks"

deploy:
name: Sending to Cloud Deploy
needs: [ init, lint, build, validate ]
runs-on: ubuntu-latest
env:
RELEASE_NAME: ${{needs.init.outputs.release_name}}
DOCKER_TAG: ${{needs.init.outputs.docker_tag}}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: Update slack notification
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: dbab09
STATUS_TITLE: Sending to Cloud Deploy
STATUS_VALUE: ':link-run: *Running*'

- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'

- name: 'Render cloud deploy config manifests from templates'
run: for template in $(ls clouddeploy/*.template.yaml); do envsubst < ${template} > ${template%%.*}.yaml ; done

- name: 'Create Cloud Deploy release'
uses: 'google-github-actions/create-cloud-deploy-release@v0'
with:
delivery_pipeline: '${{ env.APP }}'
name: '${{ env.RELEASE_NAME }}'
region: '${{ env.REGION }}'
description: '${{ env.GITHUB_COMMIT_MSG }}'
skaffold_file: 'clouddeploy/skaffold.yaml'
images: 'app=${{ env.DOCKER_TAG }}'

final:
name: Finalize Notifications
needs: [ init, lint, build, validate, deploy ]
runs-on: ubuntu-latest
if: always()
env:
RELEASE_NAME: ${{needs.init.outputs.release_name}}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'

- name: Update slack deployment complete
if: needs.deploy.result == 'success'
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: 28a745
STATUS_TITLE: Building and Deploy
STATUS_VALUE: ':link-zelda: *Completed*'

- name: Update slack deployment ready for promotion
if: needs.deploy.result == 'success'
uses: slackapi/[email protected]
with:
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-deploy.json"

- name: Update slack deployment failed
if: needs.lint.result == 'failure' || needs.build.result == 'failure' || needs.validate.result == 'failure' || needs.deploy.result == 'failure'
uses: slackapi/[email protected]
with:
update-ts: ${{ needs.init.outputs.slack_ts }}
channel-id: ${{ env.CHANNEL_IDS }}
payload-file-path: ".github/workflows/payload-slack-content.json"
env:
STATUS_COLOR: d81313
STATUS_TITLE: Building and Deploy
STATUS_VALUE: ':skull_and_crossbones: *Failed*'
63 changes: 63 additions & 0 deletions .github/workflows/payload-slack-content.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"text": "",
"attachments": [
{
"color": "{{ env.STATUS_COLOR }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":link-wut: Github Action Notification :link-wut:\n{{ github.workflow }}",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "plain_text",
"text": "{{ env.RELEASE_NAME }}",
"emoji": true
},
{
"type": "plain_text",
"text": "{{ env.GITHUB_ACTOR }}",
"emoji": true
},
{
"type": "plain_text",
"text": "{{ env.GITHUB_REPOSITORY }}",
"emoji": true
},
{
"type": "plain_text",
"text": "{{ env.GITHUB_REF_NAME }}",
"emoji": true
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<https://github.com/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}|https://github.com/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Action: *{{ env.STATUS_TITLE }}*"
},
{
"type": "mrkdwn",
"text": "Status: {{ env.STATUS_VALUE }}"
}
]
}
]
}
]
}
32 changes: 32 additions & 0 deletions .github/workflows/payload-slack-deploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"text": "",
"attachments": [
{
"color": "28a745",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":rocket: SSO Dashboard is ready for Promotion",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Build: *{{ env.RELEASE_NAME }}*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":link: <https://console.cloud.google.com/deploy/delivery-pipelines/us-east1/sso-dashboard?project=iam-auth0|Click here to view deploy pipeline>"
}
}
]
}
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dashboard/static/css/gen/
dashboard/static/.webassets-cache/
dashboard/static/img/logos/*
virtualenv.egg-info
dashboard.egg-info
bin
man
include
Expand All @@ -24,3 +25,6 @@ pip-selfcheck.json
tests/test_activate_actual.output
bower_components
node_modules
.vscode/*
build/*
envfile
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
Loading