Skip to content

Commit

Permalink
chore(build): ephemeral envs onboarding (#928)
Browse files Browse the repository at this point in the history
* integrate frontend container building script
* node version-engine from package.json
  • Loading branch information
mirekdlugosz authored and cdcabrera committed May 25, 2022
1 parent a8cdb00 commit 85b5a71
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
34 changes: 34 additions & 0 deletions build_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# --------------------------------------------
# Export vars for helper scripts to use
# --------------------------------------------
# name of app-sre "application" folder this component lives in; needs to match for quay
export COMPONENT="rhsm"
export APP_NAME=`node -e 'console.log(require("./package.json").insights.appname)'`
export APP_ROOT=$(pwd)
export NODE_BUILD_VERSION=`node -e 'console.log(require("./package.json").engines.node.match(/(\d+)\.\d+\.\d+/)[1])'`
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master

# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
IQE_PLUGINS="curiosity"
IQE_MARKER_EXPRESSION="smoke"
IQE_FILTER_EXPRESSION=""

set -exv
# source is preferred to | bash -s in this case to avoid a subshell
source <(curl -sSL $COMMON_BUILDER/src/frontend-build.sh)
BUILD_RESULTS=$?

# Stubbed out for now
mkdir -p $WORKSPACE/artifacts
cat << EOF > $WORKSPACE/artifacts/junit-dummy.xml
<testsuite tests="1">
<testcase classname="dummy" name="dummytest"/>
</testsuite>
EOF

# teardown_docker
exit $BUILD_RESULTS
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@
"api:docs": "node ./scripts/openapi.docs.js",
"api:proxy-hosts": "bash ./scripts/proxy.api.sh",
"build": "run-s -l build:pre build:js build:post test:integration",
"build:ephemeral": "run-s -l build:pre build:js build:post test:integration-ephemeral",
"build:js": "export NODE_ENV=production; webpack --config config/webpack.prod.config.js",
"build:post": "bash ./scripts/post.sh",
"build:pre": "bash ./scripts/pre.sh",
"build:deps": "bash ./scripts/dependencies.sh --doctor -u --doctorInstall \"yarn\" --doctorTest \"yarn test:deps\" --reject \"@patternfly/*, @redhat-cloud-services/frontend*, victory*\"",
"build:prod": "run-s build:ephemeral",
"dev:chrome": "bash ./scripts/dev.chrome.sh -b prod-stable",
"release": "standard-version",
"start": "run-p -l api:dev start:js",
Expand All @@ -66,15 +68,19 @@
"start:proxy": "run-s -l api:proxy-hosts start:js-proxy",
"test": "export NODE_ENV=test; run-s test:spell* test:lint test:ci",
"test:ci": "export CI=true; jest ./src --coverage",
"test:ci-ephemeral": "export CI=true; TZ=UTC jest ./src --coverage --no-cache",
"test:ephemeral": "export NODE_ENV=test; run-s test:spell* test:lint test:ci-ephemeral",
"test:clearCache": "jest --clearCache",
"test:dev": "export NODE_ENV=test; run-s test:spell test:lint test:local",
"test:deps": "run-s test build",
"test:integration": "jest ./tests",
"test:integration-ephemeral": "TZ=UTC jest ./tests --no-cache",
"test:integration-dev": "jest --roots=./tests --watch",
"test:lint": "eslint --ext=json --ext=js --ext=jsx src",
"test:spell-support": "cspell ./README.md ./config/README.md ./CONTRIBUTING.md --config ./config/cspell.config.json",
"test:spell": "cspell './public/locales/**/en*json' './src/**/*.js' --config ./config/cspell.config.json",
"test:local": "jest --roots=./src --watch"
"test:local": "jest --roots=./src --watch",
"verify": "run-s test:ephemeral build:ephemeral"
},
"dependencies": {
"@joi/date": "^2.1.0",
Expand Down
34 changes: 34 additions & 0 deletions pr_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# --------------------------------------------
# Export vars for helper scripts to use
# --------------------------------------------
# name of app-sre "application" folder this component lives in; needs to match for quay
export COMPONENT="rhsm"
export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace
export APP_ROOT=$(pwd)
export NODE_BUILD_VERSION=`node -e 'console.log(require("./package.json").engines.node.match(/(\d+)\.\d+\.\d+/)[1])'`
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master

# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
IQE_PLUGINS="curiosity"
IQE_MARKER_EXPRESSION="smoke"
IQE_FILTER_EXPRESSION=""

set -exv
# source is preferred to | bash -s in this case to avoid a subshell
source <(curl -sSL $COMMON_BUILDER/src/frontend-build.sh)
BUILD_RESULTS=$?

# Stubbed out for now
mkdir -p $WORKSPACE/artifacts
cat << EOF > $WORKSPACE/artifacts/junit-dummy.xml
<testsuite tests="1">
<testcase classname="dummy" name="dummytest"/>
</testsuite>
EOF

# teardown_docker
exit $BUILD_RESULTS

0 comments on commit 85b5a71

Please sign in to comment.