Frontend container migration

Adding necessary scripts for migrating our frontend component to
container.
This commit is contained in:
Jakub Rusz 2022-09-07 15:17:09 +02:00 committed by Sanne Raymaekers
parent 28da80af49
commit 5cbe45d95a
4 changed files with 109 additions and 1 deletions

29
build_deploy.sh Executable file
View file

@ -0,0 +1,29 @@
#!/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="image-builder"
# IMAGE should match the quay repo set by app.yaml in app-interface
export IMAGE="quay.io/cloudservices/image-builder-frontend"
export APP_ROOT=$(pwd)
export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace
export NODE_BUILD_VERSION=16
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master
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

View file

@ -0,0 +1,41 @@
apiVersion: v1
kind: Template
metadata:
name: image-builder-frontend
objects:
- apiVersion: cloud.redhat.com/v1alpha1
kind: Frontend
metadata:
name: image-builder
spec:
envName: ${ENV_NAME}
title: Image-builder
deploymentRepo: https://github.com/RedHatInsights/image-builder-frontend
API:
versions:
- v1
frontend:
paths:
- /apps/image-builder
image: ${IMAGE}:${IMAGE_TAG}
navItems:
- appId: "image_builder"
title: "Image builder"
href: "/insights/image-builder"
product: "Red Hat Insights"
module:
manifestLocation: "/apps/image-builder/fed-mods.json"
moduleID: image_builder
modules:
- id: "image-builder"
module: "./RootApp"
routes:
- pathname: /insights/image-builder
parameters:
- name: ENV_NAME
required: true
- name: IMAGE_TAG
required: true
- name: IMAGE
value: quay.io/cloudservices/image-builder-frontend

View file

@ -91,7 +91,7 @@
"prod-beta": "BETA=true PROXY=true webpack serve --config config/dev.webpack.config.js",
"prod-stable": "PROXY=true webpack serve --config config/dev.webpack.config.js",
"stage-beta": "STAGE=true npm run prod-beta",
"test": "jest --verbose",
"test": "TZ=UTC jest --verbose --no-cache",
"test:single": "jest --verbose -w 1",
"build": "webpack --config config/prod.webpack.config.js",
"verify": "npm-run-all build lint test"

38
pr_check.sh Executable file
View file

@ -0,0 +1,38 @@
#!/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="image-builder"
# IMAGE should match the quay repo set by app.yaml in app-interface
export IMAGE="quay.io/cloudservices/image-builder-frontend"
export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace
export APP_ROOT=$(pwd)
#16 is the default Node version. Change this to override it.
export NODE_BUILD_VERSION=16
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master
# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
IQE_PLUGINS="image-builder-frontend"
# not sure if this is necessary
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