Skip to content

Commit 9b5d8ac

Browse files
authored
Merge pull request #547 from reactioncommerce/release-v.2.0.0-rc.12
Release v2.0.0 rc.12
2 parents 4b576aa + 3bf5cb0 commit 9b5d8ac

20 files changed

+2014
-1550
lines changed

.circleci/bin/calibre-deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ URL=$1
66
LOCATION=$2
77

88
# Run One Off Test
9-
./../node_modules/calibre/bin/linux/calibre test create $URL --location=$LOCATION
9+
npx [email protected] test create $URL --location=$LOCATION
1010

1111
# Run Snapshot
1212
# California Snapshot Only (Be more generic as we add more site locations to track)
1313
if [ $LOCATION = "California" ]
1414
then
15-
./../node_modules/calibre/bin/linux/calibre site create-snapshot --site reaction-core-"$(echo $LOCATION | tr '[A-Z]' '[a-z]')"
15+
npx [email protected] site create-snapshot --site reaction-core-"$(echo $LOCATION | tr '[A-Z]' '[a-z]')"
1616
else
1717
echo "No Snapshot Configured for Location"
1818
fi

.circleci/bin/should-run-snyk.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
# Please Use Google Shell Style: https://google.github.io/styleguide/shell.xml
4+
5+
# ---- Start unofficial bash strict mode boilerplate
6+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
7+
set -o errexit # always exit on error
8+
set -o errtrace # trap errors in functions as well
9+
set -o pipefail # don't ignore exit codes when piping output
10+
set -o posix # more strict failures in subshells
11+
# set -x # enable debugging
12+
13+
IFS=$'\n\t'
14+
# ---- End unofficial bash strict mode boilerplate
15+
16+
validate_env() {
17+
declare -a missing
18+
for var in "$@"; do
19+
if [[ -z "${!var}" ]]; then
20+
echo "⚠️ ERROR: Missing required environment variable: ${var}" 1>&2
21+
missing+=("${var}")
22+
fi
23+
done
24+
if [[ -n "${missing[*]}" ]]; then
25+
exit 1
26+
fi
27+
}
28+
29+
main() {
30+
validate_env CIRCLE_COMPARE_URL DOCKER_REPOSITORY
31+
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
32+
echo "NO: Not a PR. Skipping Snyk."
33+
exit
34+
fi
35+
# Determine PR number from pull request link
36+
CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"
37+
PATH="${PATH}:${CIRCLE_WORKING_DIRECTORY}/node_modules/.bin"
38+
if [[ -v CIRCLE_PR_NUMBER ]] && [ -n ${CIRCLE_PR_NUMBER} ]; then
39+
# Get PR from github API
40+
url="https://api.github.com/repos/${DOCKER_REPOSITORY}/pulls/${CIRCLE_PR_NUMBER}"
41+
# Determine target/base branch from API response
42+
TARGET_BRANCH=$(curl --silent --location --fail --show-error "${url}" |
43+
jq -r '.base.ref')
44+
fi
45+
if [[ -z "${TARGET_BRANCH}" || ${TARGET_BRANCH} == "null" ]]; then
46+
echo "NO: Not a PR. Skipping Snyk."
47+
exit
48+
fi
49+
# If target branch does not exist or is master, run snyk tests
50+
if [[ ${TARGET_BRANCH} == "master" ]] || [[ -z "${TARGET_BRANCH/[ ]*\n/}" ]]; then
51+
echo "YES: always run when targeting master"
52+
exit
53+
fi
54+
# If package.json is different from the base branch, run snyk
55+
if git diff "$(basename "${CIRCLE_COMPARE_URL}")" package.json | grep -q diff; then
56+
echo "YES: package.json different. Running Snyk."
57+
exit
58+
fi
59+
echo "NO: package.json identical to target branch. Skipping Snyk."
60+
exit
61+
}
62+
63+
main "$@"

.circleci/config.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ defaults: &defaults
1414
# - DOCKER_REPOSITORY: "202687395681.dkr.ecr.us-west-2.amazonaws.com/reactioncommerce/reaction-next-starterkit"
1515
- DOCKER_NAMESPACE: "reactioncommerce"
1616
- DOCKER_NAME: "reaction-next-starterkit"
17+
- GLOBAL_CACHE_VERSION: “v3”
1718

1819
docker:
1920
- image: circleci/node:8-stretch
@@ -235,11 +236,6 @@ jobs:
235236
<<: *defaults
236237
steps:
237238
- checkout
238-
- run:
239-
name: Install Calibre CLI
240-
command: |
241-
cd ~
242-
sudo npm install calibre
243239
- run:
244240
name: California
245241
command: |
@@ -260,6 +256,7 @@ jobs:
260256
snyk-security:
261257
<<: *defaults
262258
steps:
259+
- checkout
263260
- setup_remote_docker
264261
- attach_workspace:
265262
at: docker-cache
@@ -268,25 +265,30 @@ jobs:
268265
command: |
269266
docker load < docker-cache/docker-image.tar
270267
- run:
271-
name: Snyk
268+
name: Snyk Security
269+
# Snyk doesn't look up the directory tree for node_modules as
270+
# NodeJS does so we have to take some extra measures to test in the
271+
# Docker image. Copy package.json up a directory so that it is a
272+
# sibling to node_modules, then run snyk test.
272273
command: |
273-
# Snyk doesn't look up the directory tree for node_modules as
274-
# NodeJS does so we have to take some extra measures to test in the
275-
# Docker image. Copy package.json up a directory so that it is a
276-
# sibling to node_modules, then run snyk test.
277-
docker run \
278-
--env-file docker-cache/.env \
279-
-e "SNYK_TOKEN=$SNYK_TOKEN" \
280-
--name reactionapp_next_starterkit \
281-
-w /usr/local/src \
282-
"$DOCKER_REPOSITORY:$CIRCLE_SHA1" \
283-
sh -c "cp reaction-app/package.json ./ && cp reaction-app/.snyk ./ && snyk test"
274+
answer=$(./.circleci/bin/should-run-snyk.sh)
275+
if [[ "${answer}" =~ "^YES" ]] ; then
276+
docker run \
277+
--env-file docker-cache/.env \
278+
--env "SNYK_TOKEN" \
279+
--name reactionapp_next_starterkit \
280+
--workdir /usr/local/src \
281+
"$DOCKER_REPOSITORY:$CIRCLE_SHA1" \
282+
sh -c "cp reaction-app/package.json ./ && cp reaction-app/.snyk ./ && snyk test"
283+
else
284+
echo "Skipping snyk: ${answer}"
285+
fi
284286
workflows:
285287
version: 2
286288
build_and_test:
287289
jobs:
288290
- docker-build-nonprod-and-lint:
289-
context: reaction-build-read
291+
context: reaction-build-read
290292
- docker-build:
291293
context: reaction-build-read
292294
- docker-push:
@@ -303,7 +305,7 @@ workflows:
303305
requires:
304306
- docker-build
305307
- test-metrics:
306-
requires:
308+
requires:
307309
- deploy-to-ecs
308310
- snyk-security:
309311
context: reaction-validation
@@ -316,6 +318,5 @@ workflows:
316318
branches:
317319
only: /^develop$/
318320
- e2e-test:
319-
requires:
321+
requires:
320322
- deploy-to-ecs
321-

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
CANONICAL_URL=http://localhost:4000
22
ENABLE_SPA_ROUTING=true
3-
EXTERNAL_GRAPHQL_URL=http://localhost:3000/graphql-alpha
4-
INTERNAL_GRAPHQL_URL=http://reaction.api.reaction.localhost:3000/graphql-alpha
3+
EXTERNAL_GRAPHQL_URL=http://localhost:3000/graphql-beta
4+
INTERNAL_GRAPHQL_URL=http://reaction.api.reaction.localhost:3000/graphql-beta
55
NODE_ENV=development
66
OAUTH2_ADMIN_PORT=4445
77
OAUTH2_AUTH_URL=http://localhost:4444/oauth2/auth
8-
OAUTH2_CLIENT_ID=reaction-next-starterkit
8+
OAUTH2_CLIENT_ID=example-storefront
99
OAUTH2_CLIENT_SECRET=CHANGEME
1010
OAUTH2_HOST=hydra.auth.reaction.localhost
1111
OAUTH2_IDP_HOST_URL=http://reaction.api.reaction.localhost:3000/

.graphqlrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"request": {
3-
"url": "http://localhost:3000/graphql-alpha"
3+
"url": "http://localhost:3000/graphql-beta"
44
}
55
}

.snyk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2-
version: v1.13.3
2+
version: v1.13.4
33
patch: {}
4-
ignore: {}

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
# v2.0.0-rc.12
2+
This is our fourth release candidate for this project. While this project is technically still `pre-release` until we've released the final 2.0.0 version, it's the most stable version of Reaction Commerce, and we recommend starting new projects with it at this point. See https://github.com/reactioncommerce/example-storefront/issues/487#issuecomment-507468894 for more detail on this.
3+
4+
This version should be used with `v2.0.0-rc.12` of https://github.com/reactioncommerce/reaction
5+
6+
## Highlights
7+
We have [renamed](https://github.com/reactioncommerce/example-storefront/pull/544) this project from `reaction-next-starterkit` to `example-storefront` to better convey the intent behind our creating it. We’re also [updating our docs](https://github.com/reactioncommerce/reaction-docs/pull/829) to clarify this change.
8+
9+
The GraphQL API in [reaction v2.0.0-rc.12](https://github.com/reactioncommerce/reaction/pull/5259) has been changed from `/graphql-alpha` to `graphql-beta` to indicate the increased stability of the API. We think there are still some breaking changes to come in the next 3-6 months to the GraphQL API which is why we're keeping the `-beta` suffix for now. As you find bugs with that API, please file issues in the [reaction](https://github.com/reactioncommerce/reaction/issues) repo.
10+
11+
# Improvements
12+
13+
## Feature
14+
15+
- feat: always send a response to logout requests (#520)
16+
- feat: add Orders to Account Profile (#507)
17+
18+
## Fix
19+
20+
- fix: de-duplicate styled-components package (#542)
21+
- fix: only run snyk when package.json changes (#541)
22+
- fix: change calibre ci step to use npx (#535)
23+
- fix: prettier config was in the wrong place (#532)
24+
- feat: remove unused fields from GQL query (#527)
25+
- fix: Update component theming example remove blocking code to allow starterkit to start (#514)
26+
27+
## Chore
28+
29+
- chore: removes fossa status from readme (#545)
30+
- chore: rename project to example-storefront (#544)
31+
- chore: fix debugger command in README (#539)
32+
- chore: change pinned deps to ~ ranges (#538)
33+
- chore: match license from LICENSE.md and README (#536)
34+
- chore: Switch to semver ~1.2.3 style ranges (#534)
35+
- chore: update yarn.lock to resolve snyk js-yaml vuln (#531)
36+
- chore: ignore snyk js-yaml vuln for 30 days (#523)
37+
38+
## Docs
39+
40+
- docs: remove production warning (#543)
41+
- docs: add instructions on how to run starterkit w/ prod API (#537)
42+
- docs: Fix minor typo on [README.md](http://readme.md) (#525)
43+
144
# v2.0.0-rc.11
245

346
This is our third release candidate for this project. This project should be considered `pre-release` until we've released the final 2.0.0 version.

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM node:10-alpine
22

3-
ARG NAME=reaction-next-starterkit
3+
ARG NAME=example-storefront
44
ARG DESCRIPTION=""
5-
ARG URL=https://github.com/reactioncommerce/reaction-next-starterkit
6-
ARG DOC_URL=https://github.com/reactioncommerce/reaction-next-starterkit
7-
ARG VCS_URL=https://github.com/reactioncommerce/reaction-next-starterkit
5+
ARG URL=https://github.com/reactioncommerce/example-storefront
6+
ARG DOC_URL=https://github.com/reactioncommerce/example-storefront
7+
ARG VCS_URL=https://github.com/reactioncommerce/example-storefront
88
ARG VCS_REF
99
ARG VENDOR
1010
ARG BUILD_DATE
@@ -54,7 +54,6 @@ LABEL maintainer="Reaction Commerce <[email protected]>" \
5454
com.reactioncommerce.docker.git.sha1=$GIT_SHA1 \
5555
com.reactioncommerce.docker.license=$LICENSE
5656

57-
# apk list bash curl less vim | cut -d " " -f 1 | sed 's/-/=/' | xargs
5857
RUN apk --no-cache add bash curl less vim
5958
SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-u", "-c"]
6059

0 commit comments

Comments
 (0)