From e84f75e8d25d9527beeddda9a939dfc06dcf8943 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:19:11 +0000 Subject: [PATCH 1/7] added step to clear cache before deployment --- .github/workflows/commit.yml | 14 +++ .github/workflows/publish.yml | 28 ++++++ e2e/package.json | 172 ++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 e2e/package.json diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 12ea089d..46101a29 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -72,11 +72,25 @@ jobs: environ: development secrets: inherit + clear-cache-development: + name: Clear Buildpack Cache (development) + runs-on: ubuntu-latest + environment: development + steps: + - name: Clear buildpack cache + run: | + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy + do + app_guid=$(cf app --guid "$app") + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache + done + deploy-development: if: github.ref == 'refs/heads/develop' name: deploy (development) needs: - create-cloudgov-services-development + - clear-cache-development uses: gsa/data.gov/.github/workflows/deploy-template.yml@main with: environ: development diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a4c81322..d9ceb05e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -54,10 +54,37 @@ jobs: environ: prod secrets: inherit + clear-cache-staging: + name: Clear Buildpack Cache (staging) + runs-on: ubuntu-latest + environment: staging + steps: + - name: Clear buildpack cache + run: | + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy + do + app_guid=$(cf app --guid "$app") + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache + done + + clear-cache-prod: + name: Clear Buildpack Cache (prod) + runs-on: ubuntu-latest + environment: prod + steps: + - name: Clear buildpack cache + run: | + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy + do + app_guid=$(cf app --guid "$app") + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache + done + deploy-staging: name: deploy (staging) needs: - create-cloudgov-services-staging + - clear-cache-staging uses: gsa/data.gov/.github/workflows/deploy-template.yml@main with: environ: staging @@ -70,6 +97,7 @@ jobs: needs: - create-cloudgov-services-prod - deploy-staging + - clear-cache-prod uses: gsa/data.gov/.github/workflows/deploy-template.yml@main with: environ: prod diff --git a/e2e/package.json b/e2e/package.json new file mode 100644 index 00000000..38c1bb37 --- /dev/null +++ b/e2e/package.json @@ -0,0 +1,172 @@ +{ + "name": "e2e", + "version": "1.0.0", + "description": "", + "main": "cypress.config.js", + "dependencies": { + "aggregate-error": "^3.1.0", + "ansi-colors": "^4.1.3", + "ansi-escapes": "^4.3.2", + "ansi-regex": "^5.0.1", + "ansi-styles": "^4.3.0", + "arch": "^2.2.0", + "asn1": "^0.2.6", + "assert-plus": "^1.0.0", + "astral-regex": "^2.0.0", + "async": "^3.2.6", + "asynckit": "^0.4.0", + "at-least-node": "^1.0.0", + "aws-sign2": "^0.7.0", + "aws4": "^1.13.2", + "base64-js": "^1.5.1", + "bcrypt-pbkdf": "^1.0.2", + "blob-util": "^2.0.2", + "bluebird": "^3.7.2", + "buffer": "^5.7.1", + "buffer-crc32": "^0.2.13", + "cachedir": "^2.4.0", + "call-bind": "^1.0.7", + "caseless": "^0.12.0", + "chalk": "^4.1.2", + "check-more-types": "^2.24.0", + "ci-info": "^3.9.0", + "clean-stack": "^2.2.0", + "cli-cursor": "^3.1.0", + "cli-table3": "^0.6.5", + "cli-truncate": "^2.1.0", + "color-convert": "^2.0.1", + "color-name": "^1.1.4", + "colorette": "^2.0.20", + "combined-stream": "^1.0.8", + "commander": "^6.2.1", + "common-tags": "^1.8.2", + "core-util-is": "^1.0.2", + "cross-spawn": "^7.0.3", + "cypress": "^13.15.1", + "dashdash": "^1.14.1", + "dayjs": "^1.11.13", + "debug": "^4.3.7", + "define-data-property": "^1.1.4", + "delayed-stream": "^1.0.0", + "ecc-jsbn": "^0.1.2", + "emoji-regex": "^8.0.0", + "end-of-stream": "^1.4.4", + "enquirer": "^2.4.1", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "escape-string-regexp": "^1.0.5", + "eventemitter2": "^6.4.7", + "execa": "^4.1.0", + "executable": "^4.1.1", + "extend": "^3.0.2", + "extract-zip": "^2.0.1", + "extsprintf": "^1.3.0", + "fd-slicer": "^1.1.0", + "figures": "^3.2.0", + "forever-agent": "^0.6.1", + "form-data": "^4.0.1", + "fs-extra": "^9.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "get-stream": "^5.2.0", + "getos": "^3.2.1", + "getpass": "^0.1.7", + "global-dirs": "^3.0.1", + "gopd": "^1.0.1", + "graceful-fs": "^4.2.11", + "has-flag": "^4.0.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "http-signature": "^1.4.0", + "human-signals": "^1.1.1", + "ieee754": "^1.2.1", + "indent-string": "^4.0.0", + "ini": "^2.0.0", + "is-ci": "^3.0.1", + "is-fullwidth-code-point": "^3.0.0", + "is-installed-globally": "^0.4.0", + "is-path-inside": "^3.0.3", + "is-stream": "^2.0.1", + "is-typedarray": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "isexe": "^2.0.0", + "isstream": "^0.1.2", + "jsbn": "^0.1.1", + "json-schema": "^0.4.0", + "json-stringify-safe": "^5.0.1", + "jsonfile": "^6.1.0", + "jsprim": "^2.0.2", + "lazy-ass": "^1.6.0", + "listr2": "^3.14.0", + "lodash": "^4.17.21", + "lodash.once": "^4.1.1", + "log-symbols": "^4.1.0", + "log-update": "^4.0.0", + "merge-stream": "^2.0.0", + "mime-db": "^1.52.0", + "mime-types": "^2.1.35", + "mimic-fn": "^2.1.0", + "minimist": "^1.2.8", + "ms": "^2.1.3", + "npm-run-path": "^4.0.1", + "object-inspect": "^1.13.2", + "once": "^1.4.0", + "onetime": "^5.1.2", + "ospath": "^1.2.2", + "p-map": "^4.0.0", + "path-key": "^3.1.1", + "pend": "^1.2.0", + "performance-now": "^2.1.0", + "pify": "^2.3.0", + "pretty-bytes": "^5.6.0", + "process": "^0.11.10", + "proxy-from-env": "^1.0.0", + "pump": "^3.0.2", + "qs": "^6.13.0", + "request-progress": "^3.0.0", + "restore-cursor": "^3.1.0", + "rfdc": "^1.4.1", + "rxjs": "^7.8.1", + "safe-buffer": "^5.2.1", + "safer-buffer": "^2.1.2", + "semver": "^7.6.3", + "set-function-length": "^1.2.2", + "shebang-command": "^2.0.0", + "shebang-regex": "^3.0.0", + "side-channel": "^1.0.6", + "signal-exit": "^3.0.7", + "slice-ansi": "^3.0.0", + "sshpk": "^1.18.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "strip-final-newline": "^2.0.0", + "supports-color": "^8.1.1", + "throttleit": "^1.0.1", + "through": "^2.3.8", + "tldts": "^6.1.57", + "tldts-core": "^6.1.57", + "tmp": "^0.2.3", + "tough-cookie": "^5.0.0", + "tree-kill": "^1.2.2", + "tslib": "^2.8.0", + "tunnel-agent": "^0.6.0", + "tweetnacl": "^0.14.5", + "type-fest": "^0.21.3", + "universalify": "^2.0.1", + "untildify": "^4.0.0", + "uuid": "^8.3.2", + "verror": "^1.10.0", + "which": "^2.0.2", + "wrap-ansi": "^7.0.0", + "wrappy": "^1.0.2", + "yauzl": "^2.10.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} From 98eb13718e0072b4c6c4729529f1185150aba530 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:20:05 +0000 Subject: [PATCH 2/7] remove temp file --- e2e/package.json | 172 ----------------------------------------------- 1 file changed, 172 deletions(-) delete mode 100644 e2e/package.json diff --git a/e2e/package.json b/e2e/package.json deleted file mode 100644 index 38c1bb37..00000000 --- a/e2e/package.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "name": "e2e", - "version": "1.0.0", - "description": "", - "main": "cypress.config.js", - "dependencies": { - "aggregate-error": "^3.1.0", - "ansi-colors": "^4.1.3", - "ansi-escapes": "^4.3.2", - "ansi-regex": "^5.0.1", - "ansi-styles": "^4.3.0", - "arch": "^2.2.0", - "asn1": "^0.2.6", - "assert-plus": "^1.0.0", - "astral-regex": "^2.0.0", - "async": "^3.2.6", - "asynckit": "^0.4.0", - "at-least-node": "^1.0.0", - "aws-sign2": "^0.7.0", - "aws4": "^1.13.2", - "base64-js": "^1.5.1", - "bcrypt-pbkdf": "^1.0.2", - "blob-util": "^2.0.2", - "bluebird": "^3.7.2", - "buffer": "^5.7.1", - "buffer-crc32": "^0.2.13", - "cachedir": "^2.4.0", - "call-bind": "^1.0.7", - "caseless": "^0.12.0", - "chalk": "^4.1.2", - "check-more-types": "^2.24.0", - "ci-info": "^3.9.0", - "clean-stack": "^2.2.0", - "cli-cursor": "^3.1.0", - "cli-table3": "^0.6.5", - "cli-truncate": "^2.1.0", - "color-convert": "^2.0.1", - "color-name": "^1.1.4", - "colorette": "^2.0.20", - "combined-stream": "^1.0.8", - "commander": "^6.2.1", - "common-tags": "^1.8.2", - "core-util-is": "^1.0.2", - "cross-spawn": "^7.0.3", - "cypress": "^13.15.1", - "dashdash": "^1.14.1", - "dayjs": "^1.11.13", - "debug": "^4.3.7", - "define-data-property": "^1.1.4", - "delayed-stream": "^1.0.0", - "ecc-jsbn": "^0.1.2", - "emoji-regex": "^8.0.0", - "end-of-stream": "^1.4.4", - "enquirer": "^2.4.1", - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "escape-string-regexp": "^1.0.5", - "eventemitter2": "^6.4.7", - "execa": "^4.1.0", - "executable": "^4.1.1", - "extend": "^3.0.2", - "extract-zip": "^2.0.1", - "extsprintf": "^1.3.0", - "fd-slicer": "^1.1.0", - "figures": "^3.2.0", - "forever-agent": "^0.6.1", - "form-data": "^4.0.1", - "fs-extra": "^9.1.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "get-stream": "^5.2.0", - "getos": "^3.2.1", - "getpass": "^0.1.7", - "global-dirs": "^3.0.1", - "gopd": "^1.0.1", - "graceful-fs": "^4.2.11", - "has-flag": "^4.0.0", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", - "hasown": "^2.0.2", - "http-signature": "^1.4.0", - "human-signals": "^1.1.1", - "ieee754": "^1.2.1", - "indent-string": "^4.0.0", - "ini": "^2.0.0", - "is-ci": "^3.0.1", - "is-fullwidth-code-point": "^3.0.0", - "is-installed-globally": "^0.4.0", - "is-path-inside": "^3.0.3", - "is-stream": "^2.0.1", - "is-typedarray": "^1.0.0", - "is-unicode-supported": "^0.1.0", - "isexe": "^2.0.0", - "isstream": "^0.1.2", - "jsbn": "^0.1.1", - "json-schema": "^0.4.0", - "json-stringify-safe": "^5.0.1", - "jsonfile": "^6.1.0", - "jsprim": "^2.0.2", - "lazy-ass": "^1.6.0", - "listr2": "^3.14.0", - "lodash": "^4.17.21", - "lodash.once": "^4.1.1", - "log-symbols": "^4.1.0", - "log-update": "^4.0.0", - "merge-stream": "^2.0.0", - "mime-db": "^1.52.0", - "mime-types": "^2.1.35", - "mimic-fn": "^2.1.0", - "minimist": "^1.2.8", - "ms": "^2.1.3", - "npm-run-path": "^4.0.1", - "object-inspect": "^1.13.2", - "once": "^1.4.0", - "onetime": "^5.1.2", - "ospath": "^1.2.2", - "p-map": "^4.0.0", - "path-key": "^3.1.1", - "pend": "^1.2.0", - "performance-now": "^2.1.0", - "pify": "^2.3.0", - "pretty-bytes": "^5.6.0", - "process": "^0.11.10", - "proxy-from-env": "^1.0.0", - "pump": "^3.0.2", - "qs": "^6.13.0", - "request-progress": "^3.0.0", - "restore-cursor": "^3.1.0", - "rfdc": "^1.4.1", - "rxjs": "^7.8.1", - "safe-buffer": "^5.2.1", - "safer-buffer": "^2.1.2", - "semver": "^7.6.3", - "set-function-length": "^1.2.2", - "shebang-command": "^2.0.0", - "shebang-regex": "^3.0.0", - "side-channel": "^1.0.6", - "signal-exit": "^3.0.7", - "slice-ansi": "^3.0.0", - "sshpk": "^1.18.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "strip-final-newline": "^2.0.0", - "supports-color": "^8.1.1", - "throttleit": "^1.0.1", - "through": "^2.3.8", - "tldts": "^6.1.57", - "tldts-core": "^6.1.57", - "tmp": "^0.2.3", - "tough-cookie": "^5.0.0", - "tree-kill": "^1.2.2", - "tslib": "^2.8.0", - "tunnel-agent": "^0.6.0", - "tweetnacl": "^0.14.5", - "type-fest": "^0.21.3", - "universalify": "^2.0.1", - "untildify": "^4.0.0", - "uuid": "^8.3.2", - "verror": "^1.10.0", - "which": "^2.0.2", - "wrap-ansi": "^7.0.0", - "wrappy": "^1.0.2", - "yauzl": "^2.10.0" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} From 1fd63cc6f184754e8c32ba3a918be0af779981d6 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:42:35 +0000 Subject: [PATCH 3/7] added step for cf command --- .github/workflows/commit.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 46101a29..5f3338d2 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -73,17 +73,24 @@ jobs: secrets: inherit clear-cache-development: - name: Clear Buildpack Cache (development) - runs-on: ubuntu-latest - environment: development - steps: - - name: Clear buildpack cache - run: | - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy - do - app_guid=$(cf app --guid "$app") - cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache - done + name: Clear Buildpack Cache (development) + runs-on: ubuntu-latest + environment: development + steps: + - name: Log in to Cloud Foundry + uses: cloud-gov/cg-cli-tools@main + with: + cf_org: gsa-datagov + cf_space: development + cf_username: ${{ secrets.CF_SERVICE_USER }} + cf_password: ${{ secrets.CF_SERVICE_AUTH }} + - name: Clear buildpack cache + run: | + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy + do + app_guid=$(cf app --guid "$app") + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache + done deploy-development: if: github.ref == 'refs/heads/develop' From 47f0f9d5a93a99518a99a07ab75acad5dff163d6 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:48:11 +0000 Subject: [PATCH 4/7] setup cf env --- .github/workflows/commit.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 5f3338d2..b49f54d1 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -77,20 +77,19 @@ jobs: runs-on: ubuntu-latest environment: development steps: - - name: Log in to Cloud Foundry + - name: Clear buildpack cache uses: cloud-gov/cg-cli-tools@main with: + command: > + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy + do + app_guid=$(cf app --guid "$app") + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache + done cf_org: gsa-datagov cf_space: development cf_username: ${{ secrets.CF_SERVICE_USER }} cf_password: ${{ secrets.CF_SERVICE_AUTH }} - - name: Clear buildpack cache - run: | - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy - do - app_guid=$(cf app --guid "$app") - cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache - done deploy-development: if: github.ref == 'refs/heads/develop' From 8e388cb44da3a40029443cfe82b291eac36a9171 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:52:25 +0000 Subject: [PATCH 5/7] fix error --- .github/workflows/commit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index b49f54d1..5304f4a5 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -81,8 +81,7 @@ jobs: uses: cloud-gov/cg-cli-tools@main with: command: > - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy - do + for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy; do app_guid=$(cf app --guid "$app") cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache done From 431127986619c17b3f5ae66b6d0d7b0e24ca0711 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 13:55:46 +0000 Subject: [PATCH 6/7] fix syntax error --- .github/workflows/commit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 5304f4a5..ce57eb44 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -81,10 +81,10 @@ jobs: uses: cloud-gov/cg-cli-tools@main with: command: > - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy; do - app_guid=$(cf app --guid "$app") - cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache - done + (for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy; do + app_guid=$(cf app --guid "$app"); + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache; + done) cf_org: gsa-datagov cf_space: development cf_username: ${{ secrets.CF_SERVICE_USER }} From 52ed9947cd7d6c4dfcadf60c260ce01319071860 Mon Sep 17 00:00:00 2001 From: Jin-Sun-tts Date: Fri, 1 Nov 2024 14:01:24 +0000 Subject: [PATCH 7/7] add steps for staging and prod --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d9ceb05e..59ed3627 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,12 +60,17 @@ jobs: environment: staging steps: - name: Clear buildpack cache - run: | - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy - do - app_guid=$(cf app --guid "$app") - cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache - done + uses: cloud-gov/cg-cli-tools@main + with: + command: > + (for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy; do + app_guid=$(cf app --guid "$app"); + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache; + done) + cf_org: gsa-datagov + cf_space: staging + cf_username: ${{ secrets.CF_SERVICE_USER }} + cf_password: ${{ secrets.CF_SERVICE_AUTH }} clear-cache-prod: name: Clear Buildpack Cache (prod) @@ -73,12 +78,17 @@ jobs: environment: prod steps: - name: Clear buildpack cache - run: | - for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy - do - app_guid=$(cf app --guid "$app") - cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache - done + uses: cloud-gov/cg-cli-tools@main + with: + command: > + (for app in catalog-web catalog-admin catalog-fetch catalog-gather catalog-proxy; do + app_guid=$(cf app --guid "$app"); + cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache; + done) + cf_org: gsa-datagov + cf_space: prod + cf_username: ${{ secrets.CF_SERVICE_USER }} + cf_password: ${{ secrets.CF_SERVICE_AUTH }} deploy-staging: name: deploy (staging)