Skip to content

Commit e3e0ab1

Browse files
committed
Merge branch 'improvement/ARTESCA-14679' into tmp/octopus/w/130.0/improvement/ARTESCA-14679
2 parents b2b541a + a7fa3d5 commit e3e0ab1

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ui/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ WORKDIR /home/node
99
COPY package.json package-lock.json tsconfig.json /home/node/
1010
RUN npm ci --legacy-peer-deps
1111

12+
USER root
13+
RUN mkdir -p /home && echo -e "VERSION_MAJOR=1\nVERSION_MINOR=0\nVERSION_PATCH=0\nVERSION_SUFFIX=" > /home/VERSION
14+
USER node
15+
1216
COPY entrypoint.sh /entrypoint.sh
1317

1418
ENTRYPOINT ["/entrypoint.sh"]

ui/rspack.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@ import packageJson from './package.json';
33
import { Configuration } from '@rspack/cli';
44
import rspack from '@rspack/core';
55
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
6+
import fs from 'fs';
67

78
const deps = packageJson.dependencies;
89

910
const isProduction = process.env.NODE_ENV === 'production';
1011

12+
let version = process.env.VERSION;
13+
if (!version) {
14+
const versionFileContents = fs.readFileSync(
15+
path.join(__dirname, '../VERSION'),
16+
{ encoding: 'utf-8' },
17+
);
18+
const versionRegex =
19+
/.*VERSION_MAJOR=(?<versionMajor>\d+)(\n){0,1}.*VERSION_MINOR=(?<versionMinor>\d+)(\n){0,1}.*VERSION_PATCH=(?<versionPatch>\d+)(\n){0,1}.*VERSION_SUFFIX=(?<versionSuffix>.*)/m;
20+
const { versionMajor, versionMinor, versionPatch, versionSuffix } =
21+
versionRegex.exec(versionFileContents).groups;
22+
version = `${versionMajor}.${versionMinor}.${versionPatch}${versionSuffix}`;
23+
}
24+
1125
const config: Configuration = {
1226
entry: {
1327
metalk8s_ui: './src/index.ts',
@@ -97,7 +111,7 @@ const config: Configuration = {
97111
plugins: [
98112
new ModuleFederationPlugin({
99113
name: 'metalk8s',
100-
filename: 'static/js/remoteEntry.js',
114+
filename: `static/js/remoteEntry.${version}.js`,
101115
exposes: {
102116
'./FederableApp': './src/FederableApp.tsx',
103117
'./platformLibrary': './src/services/platformlibrary/k8s.ts',

0 commit comments

Comments
 (0)