-
Notifications
You must be signed in to change notification settings - Fork 0
Add PPI Validation to UI Workflow #4
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6e3a352
Add PPI Validation Functionality to UI
Yuyuutsu 7409d1d
update survey-assist-pii to use ssh
Yuyuutsu ee73255
update ci workflow for private repos to install sruvey-assist-pii
Yuyuutsu 7bff8c8
revert github workflow changes
Yuyuutsu e29c8c5
fix checkbox for continue in review response html bug
Yuyuutsu 664e406
update survey-assist-pii package installation
Yuyuutsu a73d768
re-commit with precommit changes
Yuyuutsu 6f42f52
update review_response.htm checkbox to error correctly
Yuyuutsu 09af783
Add json build funcitonality for PII Reports
Yuyuutsu 6d15674
feat: adding cloud build pipelines for sandbox, dev and preprod promo…
rupertons 5adb6b2
feat: add deploy step to promote pipeline
rupertons fa46f40
chore: linting fix
rupertons d4498f1
Remove unncescary upload.html and revert backto rendering to upload_t…
Yuyuutsu ba65109
Add Monkey Patch to tests requiring Mock PII and add new tests
Yuyuutsu ac72167
Add new line to end of cancel.html
Yuyuutsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,41 @@ | ||
| steps: | ||
| - name: gcr.io/$PROJECT_ID/testrunner | ||
| args: | ||
| - '-c' | ||
| - | | ||
| set -e | ||
| echo === Check Tooling Versions === | ||
| gcloud --version | ||
| make --version | ||
| pip --version | ||
| python --version | ||
| poetry --version | ||
|
|
||
| echo === Install dependencies for tests === | ||
| poetry install | ||
|
|
||
| echo === Running unit tests === | ||
| poetry run poetry run pytest -q --maxfail=1 --disable-warnings --cov=src/$(PKG) --cov-report term-missing --cov-fail-under=80 | tee coverage-report.txt | ||
| if grep -q "FAIL Required test coverage" coverage-report.txt; then | ||
| echo "ERROR: Target coverage was not reached, stopping pipeline." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo === Looking up config from parameter store === | ||
| dev_config=$(gcloud parametermanager parameters versions describe $_ENV_NAME --parameter=infra-test-config --location=global --project $PROJECT_ID --format=json | python3 -c "import sys, json; print(json.load(sys.stdin)['payload']['data'])" | base64 --decode) | ||
| THEMES_UI_IMAGE=$(echo $dev_config | python3 -c "import sys, json; print(json.load(sys.stdin)['cr-themes-ui-image'])") | ||
| TARGET_PROJECT_ID=$(echo $dev_config | python3 -c "import sys, json; print(json.load(sys.stdin)['project-id'])") | ||
|
|
||
| echo === Build Docker image, tag and push to GAR === | ||
| docker build -t $$THEMES_UI_IMAGE:$SHORT_SHA -t $$THEMES_UI_IMAGE:latest . | ||
| docker push $$THEMES_UI_IMAGE:latest | ||
| docker push $$THEMES_UI_IMAGE:$SHORT_SHA | ||
|
|
||
| echo === Deploy themes UI === | ||
| gcloud run deploy themes-ui --image=$$THEMES_UI_IMAGE:$SHORT_SHA --region $LOCATION --project $$TARGET_PROJECT_ID | ||
|
|
||
| id: Run unit tests, build, tag and deploy themes cloud run job | ||
| entrypoint: bash | ||
| timeout: 1800s | ||
| options: | ||
| logging: CLOUD_LOGGING_ONLY | ||
This file contains hidden or 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,29 @@ | ||
| steps: | ||
| - name: gcr.io/$PROJECT_ID/testrunner | ||
| args: | ||
| - '-c' | ||
| - | | ||
| set -e | ||
| echo === Looking up config from parameter store === | ||
| dev_config=$(gcloud parametermanager parameters versions describe dev --parameter=infra-test-config --location=global --project $PROJECT_ID --format=json | python3 -c "import sys, json; print(json.load(sys.stdin)['payload']['data'])" | base64 --decode) | ||
| THEMES_UI_IMAGE_DEV=$(echo $dev_config | python3 -c "import sys, json; print(json.load(sys.stdin)['cr-themes-ui-image'])") | ||
|
|
||
| preprod_config=$(gcloud parametermanager parameters versions describe preprod --parameter=infra-test-config --location=global --project $PROJECT_ID --format=json | python3 -c "import sys, json; print(json.load(sys.stdin)['payload']['data'])" | base64 --decode) | ||
| THEMES_UI_IMAGE_RELEASES=$(echo $preprod_config | python3 -c "import sys, json; print(json.load(sys.stdin)['cr-themes-ui-image'])") | ||
| TARGET_PROJECT_ID=$(echo $preprod_config | python3 -c "import sys, json; print(json.load(sys.stdin)['project-id'])") | ||
|
|
||
| echo === Pulling image dev image with tag $SHORT_SHA === | ||
| docker pull $$THEMES_UI_IMAGE_DEV:$SHORT_SHA | ||
|
|
||
| echo === Build Docker image, tag and push to GAR === | ||
| docker tag $$THEMES_UI_IMAGE_DEV:$SHORT_SHA $$THEMES_UI_IMAGE_RELEASES:$TAG_NAME | ||
| docker push $$THEMES_UI_IMAGE_RELEASES:$TAG_NAME | ||
|
|
||
| echo === Deploy themes UI === | ||
| gcloud run deploy themes-ui --image=$$THEMES_UI_IMAGE_RELEASES:$TAG_NAME --region $LOCATION --project $$TARGET_PROJECT_ID | ||
|
|
||
| id: Tag and push release image | ||
| entrypoint: bash | ||
| timeout: 2000s | ||
| options: | ||
| logging: CLOUD_LOGGING_ONLY |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script is only intended for use in the Sandbox environment. | ||
| # | ||
| # Please set the environment variable CICD_PROJECT_ID i.e. export CICD_PROJECT_ID= | ||
|
|
||
| if [[ ! -v CICD_PROJECT_ID ]]; then | ||
| echo "Please set the environment variable CICD_PROJECT_ID i.e. export CICD_PROJECT_ID=" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ENV_NAME=sandbox # Sandbox use only | ||
|
|
||
| GIT_SHA=$(git rev-parse --short HEAD) | ||
| sandbox_config=$(gcloud parametermanager parameters versions describe $ENV_NAME --parameter=infra-test-config --location=global --project $CICD_PROJECT_ID --format=json | python3 -c "import sys, json; print(json.load(sys.stdin)['payload']['data'])" | base64 --decode) | ||
| PROJECT_ID=$(echo $sandbox_config | python3 -c "import sys, json; print(json.load(sys.stdin)['project-id'])") | ||
| CICD_SA=$(echo $sandbox_config | python3 -c "import sys, json; print(json.load(sys.stdin)['cicd-sa-email'])") | ||
| REGION=$(echo $sandbox_config | python3 -c "import sys, json; print(json.load(sys.stdin)['region'])") | ||
| CB_BUCKET=gs://${PROJECT_ID}_cloudbuild/soc-api | ||
|
|
||
| gcloud beta builds submit . --config=cicd/cloudbuild_dev_and_sandbox.yaml \ | ||
| --project $CICD_PROJECT_ID \ | ||
| --service-account projects/$CICD_PROJECT_ID/serviceAccounts/$CICD_SA \ | ||
| --gcs-source-staging-dir $CB_BUCKET \ | ||
| --substitutions=SHORT_SHA=$GIT_SHA,_ENV_NAME=$ENV_NAME \ | ||
| --region $REGION |
This file contains hidden or 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,44 @@ | ||
| {% extends "core.html" %} | ||
| {% from "components/button/_macro.njk" import onsButton %} | ||
|
|
||
| {% set containerClasses = "ons-container--full-width" %} | ||
| {% set page_title = "Upload cancelled" %} | ||
|
|
||
| {% block pageContent %} | ||
| <div class="ons-page__container ons-container ons-u-pt-m ons-u-pb-l"> | ||
| <main id="main-content" class="ons-grid ons-grid--column@xxs@s"> | ||
| <div class="ons-grid__col ons-col-12 ons-col@l-8"> | ||
|
|
||
| <h1 class="ons-u-fs-l ons-u-mb-m"> | ||
| Upload cancelled | ||
| </h1> | ||
|
|
||
| <p class="ons-u-mb-m"> | ||
| Cancelled due to potential sensitive information disclosure. | ||
| </p> | ||
|
|
||
| {% if pii_report_location %} | ||
| <p class="ons-u-mb-s"> | ||
| PII report is downloaded here: | ||
| </p> | ||
|
|
||
| <p class="ons-u-mb-l"> | ||
| <code>{{ pii_report_location }}</code> | ||
| </p> | ||
| {% else %} | ||
| <p class="ons-u-mb-l"> | ||
| No PII report location is available. | ||
| </p> | ||
| {% endif %} | ||
|
|
||
| <div class="ons-btn-group"> | ||
| {{ onsButton({ | ||
| "text": "Return home", | ||
| "url": url_for('ui.index') | ||
| }) }} | ||
| </div> | ||
|
|
||
| </div> | ||
| </main> | ||
| </div> | ||
| {% endblock %} |
This file contains hidden or 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,81 @@ | ||
| {% extends "core.html" %} | ||
| {% from "components/button/_macro.njk" import onsButton %} | ||
| {% from "components/checkboxes/_macro.njk" import onsCheckboxes %} | ||
|
|
||
| {% set containerClasses = "ons-container--full-width" %} | ||
| {% set page_title = "Review responses" %} | ||
|
|
||
| {% block pageContent %} | ||
| <div class="ons-page__container ons-container ons-u-pt-m ons-u-pb-l"> | ||
| <main id="main-content" class="ons-grid ons-grid--column@xxs@s"> | ||
| <div class="ons-grid__col ons-col-12 ons-col@l-8"> | ||
| <h2 class="ons-u-mb-m"> | ||
| The following rows may disclose information | ||
| </h2> | ||
|
|
||
| {% if flagged_rows %} | ||
| <div class="ons-table__container ons-u-mb-m"> | ||
| <table class="ons-table"> | ||
| <thead class="ons-table__head"> | ||
| <tr class="ons-table__row"> | ||
| <th class="ons-table__header" scope="col">Row</th> | ||
| <th class="ons-table__header" scope="col">Response</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody class="ons-table__body"> | ||
| {% for row in flagged_rows %} | ||
| <tr class="ons-table__row"> | ||
| <td class="ons-table__cell">{{ row.row_number }}</td> | ||
| <td class="ons-table__cell">{{ row.response_text }}</td> | ||
| </tr> | ||
| {% endfor %} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| {% else %} | ||
| <p class="ons-u-mb-m">No potentially disclosive rows were found.</p> | ||
| {% endif %} | ||
|
|
||
| <form method="post" action="{{ url_for('ui.review_responses') }}"> | ||
| <div class="ons-u-mb-l"> | ||
| {{ | ||
| onsCheckboxes({ | ||
| "id": "ignore-disclosure-warning", | ||
| "legend": "Disclosure acknowledgement", | ||
| "legendClasses": "ons-u-vh", | ||
| "error": { | ||
| "text": errors[0] | ||
| } if errors else None, | ||
| "checkboxes": [ | ||
| { | ||
| "id": "ignore-warning", | ||
| "name": "ignore_disclosure_warning", | ||
| "label": { | ||
| "text": "These are ok to ignore" | ||
| }, | ||
| "value": "true" | ||
| } | ||
| ] | ||
| }) | ||
| }} | ||
| </div> | ||
|
|
||
| <div class="ons-btn-group"> | ||
| {{ onsButton({ | ||
| "text": "Cancel", | ||
| "url": url_for('ui.cancel'), | ||
| "variants": "secondary" | ||
| }) }} | ||
|
|
||
| {{ onsButton({ | ||
| "text": "Continue", | ||
| "type": "submit", | ||
| "id": "continue-button" | ||
| }) }} | ||
| </div> | ||
| </form> | ||
|
|
||
| </div> | ||
| </main> | ||
| </div> | ||
| {% endblock %} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.