Граф коммитов

41 Коммитов

Автор SHA1 Сообщение Дата
Peter Bengtsson bc27e0d8c8
fix Fastly purge key for API from indexing (#33327) 2022-12-07 18:33:00 +00:00
Peter Bengtsson ff12bf6131
stagger the default surrogate-key by language (#33202) 2022-12-06 20:26:06 +00:00
Mike Surowiec 624581e527
Remove most of Heroku references (#25208)
* remove most of heroku references

* remove more stuff

* update codeowners
2022-02-10 17:36:07 -06:00
James M. Greene be4249b57c
Remove the concept of "undeployment" as a part of the PR deployment lifecycle (#23731)
* Update remove-stale-staging-resources workflow to completely replace undeploy workflow
* Delete the staging-undeploy-pr workflow file
* Delete all undeployment scripts and logic
* Remove all references to the automated-block-deploy label used for undeployment
* Simplify staging cross-workflow concurrency needs
2022-01-06 16:27:48 +00:00
Mike Surowiec cfbc6f694f
remove await-sleep, less reliant on external pkgs (#24033) 2022-01-04 21:06:04 +00:00
Peter Bengtsson f68eb74d90
Make a dedicated, fast, workflow just for docs-internal only (#23289)
* Make a dedicated, fast, workflow just for docs-internal only

Part of #1297

* make staging-build-pr only for github/docs

* prune later

* make it louder and clearer about disabling workflows

* does it merge?

* typo

* rename ref

* rename

* early access should be good to go

* far from perfect

* start with that

* gzip

* rearrange

* html_url

* correction of actions/checkout sha

* correction of actions/setup-node sha

* quote

* ooops

* actually deploy

* move @octokit/rest to dependencies

* await-sleep hack

* reinstall npm

* typo

* CONTEXT_NAME

* deployments:write permission

* pull-requests:read permission

* actions:read and statuses:write permissions

* private repo mention exception

* it's called github.run_id

* Apply suggestions from code review

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* make CONTEXT_NAME optional (if it works)

* comment out CONTEXT_NAME

* simplifying

* going to run on on.pull_request instead

* remove comment

* only the 2-phase staging deploy on github/docs

* better if statement on label check

* refactor of staging-deploy script

* switch to npm install to get the deDependencies back

* using --only=dev

* updating comments

* event_name

* not on pushes to main

* add staging-commit-status-success

* testing testing

* fix linting error

* Remove other docs-internal references from staging-deploy-pr.yml

* Cleaning up new staging-commit-status-success script and usage

* Remove unnecessary environment refs

* Remove unnecessary fallback

Since the only event trigger is pull_request now instead of also push

* Remove unnecessary env vars from workflow

* docs-internal or docs but not both

* Don't provide unnecessary environment refs

* remove now moot exception

* setting it to pull_request_target

Co-authored-by: James M. Greene <JamesMGreene@github.com>
2021-12-14 08:57:54 -05:00
Robert Sese f7799cd3dd
Allow 421 on warmup requests (#21973) 2021-10-07 21:44:03 +00:00
James M. Greene bb0455962e
Do not use `build.status` as a looping condition for Heroku deployment (#21909)
* Do not use `build.status` of 'pending' as a looping condition for Heroku deployment
* Don't wait for `appSetup.status` either
* Fix incorrect Octokit method usage in local deploy script
* Bump the number of allowable errors from 5 to 10
* More logging!
* Add an environment variable for easily increasing the number of allowed Heroku failures per phase of polling
2021-10-06 12:57:30 -05:00
James M. Greene 8771695531
Make the HEROKU_PRODUCTION_APP_NAME env var required for prod deployment (#21910) 2021-10-06 11:53:28 -05:00
James M. Greene b4473a9dc6
Delete the 'create-app' module previously used for Docker deployment (#21906) 2021-10-05 18:12:48 -04:00
James M. Greene 9314c0ff94
Remove `gha-` staging app prefix for Actions-based deployments (#21799)
* Make the default app name prefix include the dash

* Remove the default app name prefix
2021-10-05 15:19:47 -05:00
James M. Greene 8d2e1ad577
Enable prod deployment via Actions (Take 2!) (#21852)
* Move concurrency control to top-level in prod deploy workflow

* Add 503 to the list of temporarily acceptable Heroku failure codes

* Add HEROKU_PRODUCTION_APP_NAME back into the prod deploy workflow
2021-10-01 13:37:46 -05:00
James M. Greene 7e954927e2
[DO NOT MERGE] Revert to no longer deploy to production via Actions (#21808)
* Update the production deployment workflow to target the main Heroku app

Without exposing our internal Heroku app name!

* Refactor the staging deployment script a bit to match more closely

* Use the HEROKU_PRODUCTION_APP_NAME Secret in the workflow

* Add a note about the newly required environment variable for production deployment into the local deploy script

* Add critical errors if the HEROKU_PRODUCTION_APP_NAME is missing

* Extract HEROKU_PRODUCTION_APP_NAME from process.env

* Revert the critical parts of PR #21807 to no longer deploy to prod via Actions

* Don't require HEROKU_PRODUCITON_APP_NAME
2021-09-29 15:29:53 -05:00
James M. Greene 90d030a41e
Deploy to the primary production Heroku App via Actions (#21807)
* Update the production deployment workflow to target the main Heroku app

Without exposing our internal Heroku app name!

* Refactor the staging deployment script a bit to match more closely

* Use the HEROKU_PRODUCTION_APP_NAME Secret in the workflow

* Add a note about the newly required environment variable for production deployment into the local deploy script

* Add critical errors if the HEROKU_PRODUCTION_APP_NAME is missing

* Extract HEROKU_PRODUCTION_APP_NAME from process.env
2021-09-29 14:43:29 -05:00
James M. Greene 12134aa84b
Use staging app name module for content changes table generation (#21805)
* Use the 'script/deployment/create-staging-app-name' module when creating the content changes table comments

* Remove the shebang from the non-runnable script helper module
2021-09-29 09:00:19 -07:00
James M. Greene 469e33cbb6
Allow Heroku `500` error codes while polling (#21795)
* Extract allowable Heroku error checks into a reusable function

* Add 500 to the list of allowable Heroku errors while polling
2021-09-28 21:00:03 +00:00
James M. Greene 1d0d782342
Production deploy script (#21768)
* Create a logic branch to deploy to production via a local script

* Ignore forceRebuild default value for production

* Add soft warnings for missing-but-not-critical env vars

* Only include the Preboot delay if the Fastly env vars are present

* Add some warning emojis ⚠️

* More emojis!

* Make FASTLY_* checks all independent

* Add more comments about additional env vars recommended for a local prod deployment
2021-09-27 22:17:21 +00:00
James M. Greene c52671408b
Do not pass `null` config vars to Heroku on AppSetup (#21766) 2021-09-27 15:47:04 -05:00
James M. Greene deab27360c
Announce if Heroku appears to be down (#21762) 2021-09-27 20:17:05 +00:00
James M. Greene 1024ede61d
Explicitly unset the DOCUBOT_REPO_PAT Heroku config var when possible (#21751) 2021-09-27 18:22:02 +00:00
James M. Greene a76f30e5f2
Move delay for Heroku Preboot to before marking deployment successful (#21736)
* Move delay for Heroku Preboot from post-deploy to pre-success

* Shorten arbitrary delay before first Fastly purge
2021-09-24 19:35:13 -05:00
Grace Park 9c9d47f508
Prod deployment workflow (#21223)
* add production deployment

* updating existing build

* remove state

* remove PR_URL and switch to main branch

* break out into build, prepare, and deploy

* update to download-artifact

* update staging to prod

* Actions production deployment redux (#21238)

* Simplify production deployment into a single Actions job

* Force esm to install

* Switch flag ordering to match staging deploy

* Use 'npm install' for the second installation to avoid deleting the prodDeps

* Apply Heroku upload fixes

* Include `.npmrc` file in builds to omit `optionalDeps`

* Remove download-artifact action

Co-authored-by: Grace Park <gracepark@github.com>

* Script updates to prod deployment (#21247)

* updating script to use latest sha

* changing back workflowRunLog

* remove line

* update error wording

* remove comment - using commit sha

* need release.id

* Update script/deployment/deploy-to-production.js

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* remove hydro

* Update script/deployment/deploy-to-production.js

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* Update .github/workflows/prod-build-deploy-pr.yml

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* Update script/deployment/deploy-to-production.js

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* Update script/deployment/deploy-to-production.js

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* Update script/deployment/deploy-to-production.js

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* updating spacing

* add 404/429 responses while polling Heroku API for prod

* removing nested ifs

* adding SOURCE_BLOB_URL

* update for early access

* add install dotenv

* need to add persist-credentials

* Testing GET request

* update request

* Rename workflow file to remove '-pr'

We are now triggering on pushes to 'main' rather than PR merges

* Remove the unnecessary workflow step to create a failure Status

Because the production deploy is done via a single workflow rather than a 2-part workflow chain, this is thankfully unnecessary

* Install all of the npm dependencies

We'll need them!

* Add the '-z' flag to 'tar' to gzip the tarball

* Pass the Heroku upload URL via env vars for security

Prevents potential injection attacks

* Log the deployment ID and log URL as deploy step outputs

* Take notice of Heroku polling resulting in failure statuses

* Add a note to consider waiting for Heroku Preboot

* Add a script and workflow step to purge Fastly

* update response to get sha

* Switch to Octokit functions instead of 'request' method

Co-authored-by: James M. Greene <JamesMGreene@github.com>
2021-09-24 16:09:08 +00:00
James M. Greene e29a965405
Display the reason for Heroku AppSetup failure (#21683) 2021-09-23 10:51:50 -05:00
James M. Greene 0c97550a77
Take notice of Heroku polling resulting in failure statuses (#21680) 2021-09-23 09:55:58 -05:00
Robert Sese f6d85c6d64
Security: remove Docker PR build/deploy workflows (#21599)
* Remove Docker PR build/deploy workflows

* Remove supporting Docker deploy script
2021-09-17 23:17:17 +00:00
James M. Greene 7ae1eea3b5
Undeploy without Environment cleanup (#21530)
* Ensure we handle multiple pages of Deployments
* Do NOT delete the Environment during undeploy
* Do NOT deploy/undeploy PRs on lock/unlock events
2021-09-15 15:11:48 +00:00
Robert Sese 6c37f45d61
Docker image deploy: set config vars (#21365)
* Add Hydro secrets as env vars

* Set app config-vars

* Add config vars previously used via app.json
2021-09-10 21:58:49 +00:00
James M. Greene 992924b1a1
Allow staging warmup requests to respond with 404 (#21423) 2021-09-10 19:00:26 +00:00
James M. Greene b507b67493
Script+workflow to remove stale staging deployment environments (#21399)
* Add a script to remove stale staging deployment environments from GitHub
* Add second job to cleanup GitHub deployment environments
* Specify GITHUB_TOKEN permissions matrix
* Stop marking staging deployments as transient
* Update staging undeployment mechanism to clean-up deployment environments on PR merge
* Define a stale PR as one that was merged or has been closed for more than 2 hours
* Rename workflow file
2021-09-10 14:43:01 +00:00
Rachael Sewell 54cb650ee5
Fix import statement for deploy script (#21404) 2021-09-10 00:31:02 +00:00
Rachael Sewell 55397df156
update status for deploy timeout (#21349) 2021-09-09 23:13:57 +00:00
Robert Sese 2c20d13927
Add PR author as app collaborator (#21353) 2021-09-08 00:53:42 +00:00
Robert Sese cbfba14ac1
Docker image deploy to Heroku (#21248)
* Start parallel Docker image deploy workflows

Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@users.noreply.github.com>

* Add early access content build stage

Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>

* Create Heroku App script and workflow steps

* Tag the image for Heroku

* Push the image and grab the image ID

* Set app name and image id outputs

* Add parallel deploy script for Docker

* Scope workflow run to 'docker-' and release image to Heroku

* Update .github/workflows/staging-build-pr-docker.yml

Co-authored-by: James M. Greene <JamesMGreene@github.com>

* Exclude Docker workflow

* Cleanup Docker deploys

* Use action sha

Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2021-09-03 16:34:48 +00:00
James M. Greene 704f699353
Allow for a few 404/429 responses while polling the Heroku API (#21191) 2021-08-30 14:47:50 +00:00
James M. Greene 08db1c970c
Refactor Staging deployment workflow to support open source PRs (#20459)
* Add a Staging build workflow

* Remove all commented out code from build workflow

It will be handled in https://github.com/github/docs-engineering/issues/726

* Use pinned version of upload-artifact action

* Tweaks to build

* Minor deployment script refactoring

* Update the Staging deployment workflow

* Missed refactoring tweak

* Add relevant comments

* Update Heroku app naming convention for Actions deploy to include 'gha-' prefix

* Update Heroku app ConfigVars and SourceBlob for optional prebuilt app

* Remove obsolete 'dist/' dir from PR build artifact

See https://github.com/github/docs-internal/pull/20405

* Ensure a new enough version of npm is used

* Switch to creating a tarball for upload

* Remove obsolete 'layouts' dir from file list

* Ditch the verbosity for 'tar'... too many files

* Add tarball support to deploy

* Add esm workaround to deploy script

See https://github.com/actions/github-script/issues/168

* Temporarily ignore staging deploy workflow from workflow linter

* Update deployment to use a Heroku Build Source instead of a GitHub Actions Artifact

* Update undeploy workflow to use ESM workaround

See https://github.com/actions/github-script/issues/168

* Add 'esm' package to optionalDependencies to better support workaround

See https://github.com/actions/github-script/issues/168

* Add Slack notifications for workflow failures

* Wrap AppSetup polling in try-catch

* Improve dyno monitoring

* Rename 'script/deploy' to have a .js extension #esm

* Update script references to include the extension

* Use non-deprecated Sources API for Heroku

* Use normal quotes

* Stub in a step to mark deployment inactive after timing out

* Apply suggestions from code review

Co-authored-by: Rachael Sewell <rachmari@github.com>

Co-authored-by: Rachael Sewell <rachmari@github.com>
2021-08-25 20:45:51 +00:00
Kevin Heis b29e37318a
Remove `import x` statements (#20594)
* Clear out most import x

* Update rimraf use

* Move up readme blocks in scripts
2021-07-29 20:28:30 +00:00
Kevin Heis 8a56437c93
Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00
Kevin Heis 42e785b0a8
Migrate CommonJS to ESM (#20301)
* First run of script

* Get the app running --- ish

* Get NextJS working

* Remove `node:`

* Get more tests passing in unit directory

* Update FailBot test to use nock

* Update test.yml

* Update Dockerfile

* tests/content fixes

* Update page.js

* Update build-changelog.js

* updating tests/routing

* Update orphan-tests.js

* updating tests/rendering

* Update .eslintrc.js

* Update .eslintrc.js

* Install jest/globals

* "linting" tests

* staging update to server.mjs

* Change '.github/allowed-actions.js' to a ESM export

* Lint

* Fixes for the main package.json

* Move Jest to be last in the npm test command so we can pass args

* Just use 'npm run lint' in the npm test command

* update algolia label script

* update openapi script

* update require on openapi

* Update enterprise-algolia-label.js

* forgot JSON.parse

* Update lunr-search-index.js

* Always explicitly include process.cwd() for JSON file reads pathed from project root

* update graphql/update-files.js script

* Update other npm scripts using jest to pass ESM NODE_OPTIONS

* Update check-for-enterprise-issues-by-label.js for ESM

* Update create-enterprise-issue.js for ESM

* Import jest global for browser tests

* Convert 'script/deploy' to ESM

Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: James M. Greene <jamesmgreene@github.com>
2021-07-14 13:49:18 -07:00
James M. Greene 50fbcc62d3
Deploy/undeploy PRs to/from staging via an Actions workflow (#19865)
* Add 'script/deploy' to enable manual deploys to Heroku

* Pass API tokens into 'deploy-to-staging' module usage

* Construct Octokit instance to pass in

* Get PR branch name and verify state

* Reorganize

* Rename option to 'octokit'

* Add missing option

* Actually use the convenience methods for convenience

* Simplify top-level script

* Top-level script revisions

* Add parse-pr-url module

* Add create-staging-app-name module

* Remove misplaced comment

* Pass in owner

* Use owner param

* More variables

* Pass owner along more

* Correct prNumber param reference

* Add WIP deploy-to-staging module

* Prevent 'scripts/' and '.github/actions-scripts/' files from being modified in open source repo

* Extract PR author earlier

* Add note about optionally supplying DOCUBOT_REPO_PAT env var

* Override Heroku env var during AppSetup creation instead of later to avoid triggering a second deploy

* Updates to deploy-to-staging module

* Lots of updates

* Add dyno start-up monitoring and warmup requests

* Ignore 'script/deploy' in the repository-references test

* Correct path to Octokit helper

* Temporarily add a 'gha-' prefix to environment names

* Log whole error if terminal. Good for Octokit errors!

* Correct Octokit preview configuration

* Add more logging around Heroku build and release

* Added more timings to log messages

* Monitor dyno states specifically from the dyno list view to avoid 404 oddities when Free dynos are dropped and non-Free dynos are added

* Don't wait for AppSetup status as it includes the Build time

* Updating logging since we don't see DeploymentStatus update messages in the UI =(

* Refactor to extract more properties from the PR object

* Add a workflow to deploy PRs to Staging

* Fix workflow description

* Add skeleton workflow and module for undeploying

* Remove commented out code

* Update undeployment module

* Add '--destroy' flag to 'script/deploy' options

* Add timeout and concurrency key for undeployment

* Add timeout and concurrency key for deployment

* Remove dangling unneeded function declaration

* Add ant-man preview for inactive deployment state setting

* Fix reference to pull request number

* Fix reference to pull request number

* Refactor to extract more properties from the PR object

* Fix reference to pull request number

* Remove workflow

* Add workflow to undeploy closed PRs from staging

* Add repository filters to jobs

* Update to using actions/github-script@4.0.2

* Pass more environment variables that affect deployments

* Add explicit .js extensions to local require in Actions workflow

* Check out the code and install deps first, of course

* Try local requires without the explicit .js extension

* Use our usual version of Octokit instead of the provided 'github' instance to avoid versioning discrepancies

* Explicitly pass in GITHUB_TOKEN to github-script

* Point to the workflow run page as a default log_url

* Exclude staging deployment workflows from the workflow linter until we can get support for the 'concurrency' key (https://github.com/cschleiden/actions-linter/issues/79)

* Remove 'gha-' prefix
2021-06-17 18:02:02 +00:00
James M. Greene db75933733
Undeploy from staging manually using a script (#19875)
* Add skeleton workflow and module for undeploying

* Remove commented out code

* Update undeployment module

* Add '--destroy' flag to 'script/deploy' options

* Add timeout and concurrency key for undeployment

* Remove dangling unneeded function declaration

* Add ant-man preview for inactive deployment state setting

* Fix reference to pull request number

* Refactor to extract more properties from the PR object

* Fix reference to pull request number

* Remove workflow

* Add a README comment about '--destroy' usage

* Fix grammar

* Add missing 'ant-man' preview to createDeploymentStatus calls

* Add missing preview to createDeploymentStatus calls

* Find the latest existing deployment instead of creating a new one

* Remove unused variable

* Deactivate ALL deployments

* Update copy

* Add missing colons
2021-06-15 15:51:25 +00:00
James M. Greene f388a3d550
Deploy to staging manually using a script (#19769)
* Add 'script/deploy' to enable manual deploys to Heroku

* Pass API tokens into 'deploy-to-staging' module usage

* Construct Octokit instance to pass in

* Get PR branch name and verify state

* Reorganize

* Rename option to 'octokit'

* Add missing option

* Actually use the convenience methods for convenience

* Simplify top-level script

* Top-level script revisions

* Add parse-pr-url module

* Add create-staging-app-name module

* Remove misplaced comment

* Pass in owner

* Use owner param

* More variables

* Pass owner along more

* Correct prNumber param reference

* Add WIP deploy-to-staging module

* Prevent 'scripts/' and '.github/actions-scripts/' files from being modified in open source repo

* Extract PR author earlier

* Add note about optionally supplying DOCUBOT_REPO_PAT env var

* Override Heroku env var during AppSetup creation instead of later to avoid triggering a second deploy

* Updates to deploy-to-staging module

* Lots of updates

* Add dyno start-up monitoring and warmup requests

* Ignore 'script/deploy' in the repository-references test

* Correct path to Octokit helper

* Temporarily add a 'gha-' prefix to environment names

* Log whole error if terminal. Good for Octokit errors!

* Correct Octokit preview configuration

* Add more logging around Heroku build and release

* Added more timings to log messages

* Monitor dyno states specifically from the dyno list view to avoid 404 oddities when Free dynos are dropped and non-Free dynos are added

* Don't wait for AppSetup status as it includes the Build time

* Updating logging since we don't see DeploymentStatus update messages in the UI =(

* Remove commented out code

* Refactor to extract more properties from the PR object

* Fix reference to pull request number

* Increase Heroku polling intervals from 2.5 seconds to 5 seconds

* Remove unhelpful createDeploymentStatus API calls

* Workaround Heroku's secondary release upon app creation
2021-06-14 22:32:07 +00:00