1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Commit Graph

21 Commits

Author SHA1 Message Date
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