Skip to content

Commit 633074a

Browse files
feat:CVEs SRVKP-10058 SRVKP-9700 and yarn 4 migration with node20 support
1 parent 3aeedc0 commit 633074a

18 files changed

Lines changed: 18887 additions & 13309 deletions

.ci-operator.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build_root_image:
2-
name: nodejs-18
3-
namespace: openshift
4-
tag: latest
2+
name: console-plugin-test-cypress
3+
namespace: ci
4+
tag: node20-yarn4

.github/workflows/publish_container_image.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
1-
name: publish container images
1+
name: Build and Publish Container
2+
23
on:
34
push:
45
branches:
56
- main
67
- release-v* # example: release-v1.14
8+
- main_ocp_4.22
79
tags: ['v*']
10+
pull_request:
11+
branches:
12+
- main
13+
- main_ocp_4.22
14+
workflow_dispatch:
815

916
jobs:
1017
setup:
1118
name: build container
1219
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
1323

1424
steps:
1525
- name: Checkout source code
1626
uses: actions/checkout@v4
1727

1828
- uses: actions/setup-node@v4
1929
with:
20-
node-version: '18'
30+
node-version: '20'
31+
32+
- name: Enable Corepack
33+
run: corepack enable
2134

2235
- uses: docker/setup-buildx-action@v3
2336

2437
- name: Login in to ghcr.io registry
38+
if: github.event_name != 'pull_request'
2539
uses: docker/login-action@v3
2640
with:
2741
registry: ghcr.io
@@ -41,5 +55,5 @@ jobs:
4155
run: ./scripts/build_container.sh
4256
env:
4357
SUPPORT_MULTI_ARCH: "true"
44-
CONSOLE_PLUGIN_IMAGE_REPO: 'ghcr.io/${{ github.repository }}'
45-
CONSOLE_PLUGIN_IMAGE_TAG: '${{ github.ref_name }}'
58+
CONSOLE_PLUGIN_IMAGE_REPO: ${{ github.event_name == 'pull_request' && format('ttl.sh/{0}/console-plugin-pr-{1}', github.repository, github.event.pull_request.number) || format('ghcr.io/{0}', github.repository) }}
59+
CONSOLE_PLUGIN_IMAGE_TAG: ${{ github.event_name == 'pull_request' && '24h' || github.ref_name }}

.konflux/dockerfiles/console-plugin.Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ FROM $BUILDER AS builder-ui
55

66
WORKDIR /go/src/github.com/openshift-pipelines/console-plugin
77
COPY . .
8-
RUN npm install -g yarn-1.22.22.tgz
9-
COPY .konflux/yarn.lock .
10-
COPY .konflux/package.json .
11-
RUN set -e; for f in patches/*.patch; do echo ${f}; [[ -f ${f} ]] || continue; git apply ${f}; done
12-
RUN yarn install --offline --frozen-lockfile --ignore-scripts && \
8+
#Install Yarn
9+
RUN if [[ -d /cachi2/output/deps/npm/ ]]; then \
10+
npm install -g /cachi2/output/deps/npm/yarnpkg-cli-dist-4.6.0.tgz; \
11+
YARN_ENABLE_NETWORK=0; \
12+
else \
13+
echo "ERROR: Hermetic npm deps not injected"; \
14+
exit 1; \
15+
fi
16+
17+
18+
# Install dependencies & build
19+
USER root
20+
RUN CYPRESS_INSTALL_BINARY=0 yarn install --immutable && \
1321
yarn build
1422

1523
FROM $RUNTIME

.konflux/npm/package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.konflux/npm/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "yarn4-nodejs22-ubil9-minimal",
3+
"version": "1.0.0",
4+
"description": "Konflux image containing rebuilds for tooling to assist in building with yarn",
5+
"dependencies": {
6+
"@yarnpkg/cli-dist": "4.6.0"}
7+
}

.tekton/console-plugin-1-16-console-plugin-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
- linux/x86_64
4040
- name: prefetch-input
4141
value: |
42-
{"type": "rpm", "path": ".konflux/rpms"}
42+
[{"type": "yarn"}, {"type": "npm", "path": ".konflux/npm"}]
4343
pipelineRef:
4444
name: docker-build-ta
4545
taskRunTemplate:

.tekton/console-plugin-1-16-console-plugin-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
value: .konflux/dockerfiles/console-plugin.Dockerfile
3434
- name: prefetch-input
3535
value: |
36-
{"type": "rpm", "path": ".konflux/rpms"}
36+
[{"type": "yarn"}, {"type": "npm", "path": ".konflux/npm"}]
3737
pipelineRef:
3838
name: docker-build-ta
3939
taskRunTemplate:

.yarnrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# .yarnrc.yml
2+
nodeLinker: node-modules
3+
4+
# Force packages to use the same webpack instance
5+
packageExtensions:
6+
"@openshift-console/dynamic-plugin-sdk-webpack@*":
7+
peerDependencies:
8+
webpack: "*"

Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1-
FROM registry.access.redhat.com/ubi8/nodejs-18:latest AS builder-ui
1+
ARG BUILDER=registry.access.redhat.com/ubi8/nodejs-18:latest
2+
ARG RUNTIME=registry.access.redhat.com/ubi8/nginx-124:latest
3+
4+
# Stage 1: Build UI
5+
FROM $BUILDER AS builder-ui
6+
27
USER root
3-
RUN command -v yarn || npm i -g yarn
48

9+
# Enable Corepack and prepare Yarn 4.6
10+
RUN npm install -g corepack && corepack enable && corepack prepare yarn@4.6.0 --activate
11+
12+
# Copy source
513
ADD . /usr/src/app
614
WORKDIR /usr/src/app
715

8-
RUN yarn install --frozen-lockfile && \
16+
# Install dependencies & build
17+
RUN yarn install --immutable && \
918
yarn build
1019

11-
FROM registry.access.redhat.com/ubi8/nginx-124:latest
20+
# Stage 2: Serve with Nginx
21+
FROM $RUNTIME
1222

1323
COPY --from=builder-ui /usr/src/app/dist /usr/share/nginx/html
14-
1524
COPY ./nginx.conf /etc/nginx/nginx.conf
1625

1726
USER 1001
18-
1927
ENTRYPOINT ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)