Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Fix Pipeline Issue #1295

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cleanClosedPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cleanMergedPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Build the web frontend app image
buildAPP:
Expand All @@ -151,7 +151,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -390,7 +390,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -444,7 +444,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -499,7 +499,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -556,7 +556,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/deployStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Checkout Target Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -353,7 +353,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -405,7 +405,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -457,7 +457,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -510,7 +510,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: E2E Smoke tests
uses: cypress-io/github-action@v6
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Checkout Target Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

- name: Install api dependencies
working-directory: api
run: npm install
run: npm ci --include=dev

- name: Run api linter
working-directory: api
Expand All @@ -105,7 +105,7 @@ jobs:

- name: Install app dependencies
working-directory: app
run: npm install
run: npm ci --include=dev

- name: Run app linter
working-directory: app
Expand All @@ -129,7 +129,7 @@ jobs:

- name: Install database dependencies
working-directory: database
run: npm install
run: npm ci --include=dev

- name: Run database linter
working-directory: database
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Checkout Target Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

# Load repo from cache
- name: Cache repo
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

- name: Install api dependencies
working-directory: api
run: npm install
run: npm ci --include=dev

- name: Run api tests with coverage
working-directory: api
Expand All @@ -110,7 +110,7 @@ jobs:

- name: Install app dependencies
working-directory: app
run: npm install
run: npm ci --include=dev

- name: Run app tests with coverage
working-directory: app
Expand Down
33 changes: 33 additions & 0 deletions README/Pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Pipeline Readme

## Troubleshooting

### Your cache folder contains root-owned files, due to a bug in previous versions of which has since been addressed.

```Bash
npm ERR! code EACCES
npm ERR! sysca11 open
npm ERR! path /opt/app—root/src/
npm ERR! errno —13
npm ERR!
npm ERR! Your cache folder contains files, due to a bug in
npm ERR! previous versions of which has since been addressed.
npm ERR!
npm ERR! To fix this problem, please run:
npm ERR! sudo cho•m -R "/opt/app-root/src/.npn"
```

#### Solution Adopted By This Repo

Update api/app `Dockerfile` to a multi-stage build where the `.npm` folder is not copied from stage 1 into stage 2 AND
the application is started by calling `node <file>` rather than `npm run <command>`, thereby bypassing npm entirely.

#### Misc related documentation/threads

##### Openshift

- https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#use-uid_create-images

##### Rocketchat

- https://chat.developer.gov.bc.ca/channel/devops-how-to/thread/vxnNGi8fJBqT6mmas
6 changes: 2 additions & 4 deletions api/.docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This DockerFile is used for local development (via docker-compose) only.
# ########################################################################################################

FROM node:18
FROM node:20

ENV HOME=/opt/app-root/src

Expand All @@ -14,9 +14,7 @@ WORKDIR $HOME
# A wildcard is used to ensure both package.json AND package-lock.json are copied where available (npm@5+)
COPY package*.json ./

# If you are building your code for production
# RUN npm install --only=production
RUN npm install
RUN npm ci --include=dev

ENV PATH ${HOME}/node_modules/.bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH

Expand Down
6 changes: 3 additions & 3 deletions api/.pipeline/templates/api.bc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ parameters:
value: dev
- name: BASE_IMAGE_URL
required: true
value: image-registry.openshift-image-registry.svc:5000/openshift/nodejs-18:1-98.1711398651
value: image-registry.openshift-image-registry.svc:5000/openshift/nodejs:latest
- name: SOURCE_IMAGE_NAME
required: true
value: nodejs-18
value: nodejs
- name: SOURCE_IMAGE_TAG
required: true
value: 1-98.1711398651
value: latest
- name: CPU_REQUEST
value: '50m'
- name: CPU_LIMIT
Expand Down
Loading
Loading