* ci: first attempt at adding a gated docker PR Publish (#1038) * ci: first attempt at adding a gated docker PR Publish * See if we can use contexts to inject variables after approval * fix build command * try alternative context * docs: pull request template that spells out PR checklist * change context back to Docker Hub * Switch optional approval to another workflow * Make docker builds faster * Update .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
This commit is contained in:
parent
e62f403fe9
commit
862d426c71
@ -198,7 +198,7 @@ jobs:
|
||||
- run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh
|
||||
- run: ~/repo/.circleci/build-and-publish-docs.sh
|
||||
|
||||
DOCKER_PUBLISH:
|
||||
DOCKER_MASTER_PUBLISH:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -227,6 +227,43 @@ jobs:
|
||||
docker push ohif/$IMAGE_NAME:latest
|
||||
fi
|
||||
|
||||
DOCKER_PR_PUBLISH:
|
||||
<<: *defaults
|
||||
steps:
|
||||
# Enable yarn workspaces
|
||||
- run: yarn config set workspaces-experimental true
|
||||
|
||||
# Checkout code and ALL Git Tags
|
||||
- checkout:
|
||||
post:
|
||||
- git fetch --all
|
||||
|
||||
- restore_cache:
|
||||
name: Restore Yarn and Cypress Package Cache
|
||||
keys:
|
||||
# when lock file changes, use increasingly general patterns to restore cache
|
||||
- yarn-packages-{{ checksum "yarn.lock" }}
|
||||
- yarn-packages-
|
||||
|
||||
- run:
|
||||
name: Install Dependencies
|
||||
command: yarn install --frozen-lockfile
|
||||
|
||||
- setup_remote_docker:
|
||||
docker_layer_caching: false
|
||||
|
||||
- run:
|
||||
name: Build and push Docker image
|
||||
command: |
|
||||
# Remove npm config
|
||||
rm -f ./.npmrc
|
||||
# Set our version number using vars
|
||||
echo $CIRCLE_BUILD_NUM
|
||||
# Build our image, auth, and push
|
||||
docker build --tag ohif/viewer:PR_BUILD-$CIRCLE_BUILD_NUM .
|
||||
echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin
|
||||
docker push ohif/viewer:PR_BUILD-$CIRCLE_BUILD_NUM
|
||||
|
||||
VIEWER_DEMO_BUILD:
|
||||
<<: *defaults
|
||||
steps:
|
||||
@ -331,6 +368,17 @@ workflows:
|
||||
requires:
|
||||
- UNIT_TESTS
|
||||
|
||||
PR_OPTIONAL_DOCKER_PUBLISH:
|
||||
jobs:
|
||||
# https://circleci.com/docs/2.0/workflows/#holding-a-workflow-for-a-manual-approval
|
||||
- AWAIT_APPROVAL:
|
||||
type: approval
|
||||
# Update hub.docker.org
|
||||
- DOCKER_PR_PUBLISH:
|
||||
context: Docker Hub
|
||||
requires:
|
||||
- AWAIT_APPROVAL
|
||||
|
||||
# MERGE TO MASTER
|
||||
RELEASE:
|
||||
jobs:
|
||||
@ -407,6 +455,6 @@ workflows:
|
||||
requires:
|
||||
- VIEWER_DEMO_BUILD
|
||||
# Update hub.docker.org
|
||||
- DOCKER_PUBLISH:
|
||||
- DOCKER_MASTER_PUBLISH:
|
||||
requires:
|
||||
- NPM_PUBLISH
|
||||
|
||||
29
.github/PULL_REQUEST_TEMPLATE/pull_request_template.md
vendored
Normal file
29
.github/PULL_REQUEST_TEMPLATE/pull_request_template.md
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
### Request Checklist
|
||||
|
||||
- [] Brief description of changes
|
||||
- [] Links to any relevant issues
|
||||
- [] Required status checks are passing
|
||||
- [] `@mention` a maintainer to request a review
|
||||
|
||||
#### Special
|
||||
|
||||
> If this PR is not on a branch for this repo, it is "untrusted" and does not
|
||||
> have access to env vars. Reviewers can kick off a trusted docker deploy by:
|
||||
>
|
||||
> 1. Verifying there are no malicious changes to CI build
|
||||
> 2. Using the [git-push-fork-to-upstream-branch][script] script
|
||||
> 3. Executing the manual approval step in the CI workflow
|
||||
|
||||
- [] Request docker publish of PR
|
||||
|
||||
_Want to improve this process? Consider PR'ing the ability for reviewers to add
|
||||
a label to trigger this process._
|
||||
|
||||
<!--
|
||||
Links
|
||||
-->
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[blog]: https://circleci.com/blog/triggering-trusted-ci-jobs-on-untrusted-forks/
|
||||
[script]: https://github.com/jklukas/git-push-fork-to-upstream-branch
|
||||
<!-- prettier-ignore-end -->
|
||||
@ -44,6 +44,7 @@ RUN yarn config set workspaces-experimental true
|
||||
RUN yarn install
|
||||
|
||||
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||
ENV QUICK_BUILD true
|
||||
# ENV GENERATE_SOURCEMAP=false
|
||||
# ENV REACT_APP_CONFIG=config/default.js
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user