@abgov/nx-oc 3.1.0 → 3.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +7 -6
- package/src/executors/apply/apply.js +1 -1
- package/src/executors/apply/apply.spec.ts +1 -1
- package/src/generators/apply-infra/apply-infra.js +1 -1
- package/src/generators/apply-infra/apply-infra.spec.ts +1 -1
- package/src/generators/deployment/deployment.js +1 -1
- package/src/generators/deployment/deployment.spec.ts +7 -7
- package/src/generators/deployment/dotnet-files/Dockerfile.template +2 -2
- package/src/generators/deployment/express-files/Dockerfile.template +1 -1
- package/src/generators/pipeline/pipeline.js +1 -1
- package/src/generators/pipeline/pipeline.spec.ts +32 -33
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# About this project
|
|
2
|
-
This is the Government of Alberta -
|
|
2
|
+
This is the Government of Alberta - Nx plugin for OpenShift.
|
|
3
3
|
|
|
4
4
|
The plugin includes generators for setting up OpenShift pipeline and application yaml files, and executors for `oc cli` commands.
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/nx-oc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-beta.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
-
"description": "Government of Alberta -
|
|
6
|
+
"description": "Government of Alberta - Nx plugin for OpenShift.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/abgov/nx-tools.git",
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
"generators": "./generators.json",
|
|
13
13
|
"executors": "./executors.json",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"yaml": "^1.10.2"
|
|
16
|
-
"@nrwl/devkit": "13.8.1"
|
|
15
|
+
"yaml": "^1.10.2"
|
|
17
16
|
},
|
|
18
|
-
"
|
|
19
|
-
"peerDependencies": {
|
|
17
|
+
"types": "./src/index.d.ts",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@nrwl/devkit": "14.7.17"
|
|
20
|
+
}
|
|
20
21
|
}
|
|
@@ -18,7 +18,7 @@ function normalizeSchema(options) {
|
|
|
18
18
|
return { ocProjects };
|
|
19
19
|
}
|
|
20
20
|
function runExecutor(options, { projectName }) {
|
|
21
|
-
return
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
console.log(`Running oc apply for ${projectName}...`);
|
|
23
23
|
const { ocProjects } = normalizeSchema(options);
|
|
24
24
|
const failed = ocProjects
|
|
@@ -12,7 +12,7 @@ function applyOcResources(host) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
function default_1(host) {
|
|
15
|
-
return
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const { success } = (0, oc_utils_1.runOcCommand)('project', []);
|
|
17
17
|
if (success) {
|
|
18
18
|
applyOcResources(host);
|
|
@@ -45,7 +45,7 @@ function addFiles(host, options) {
|
|
|
45
45
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, `${options.appType}-files`), `${path.dirname((0, devkit_1.getWorkspacePath)(host))}/.openshift/${options.projectName}`, templateOptions);
|
|
46
46
|
}
|
|
47
47
|
function default_1(host, options) {
|
|
48
|
-
return
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
const config = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
50
50
|
if (config.projectType !== 'application') {
|
|
51
51
|
console.log('Cannot generate deployment for library.');
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
addProjectConfiguration,
|
|
3
3
|
readProjectConfiguration,
|
|
4
4
|
} from '@nrwl/devkit';
|
|
5
|
-
import {
|
|
5
|
+
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
|
|
6
6
|
import pipeline from '../pipeline/pipeline';
|
|
7
7
|
import { Schema } from './schema';
|
|
8
8
|
import generator from './deployment';
|
|
@@ -10,7 +10,7 @@ describe('Deployment Generator', () => {
|
|
|
10
10
|
const options: Schema = { project: 'test', tenant: 'test' };
|
|
11
11
|
|
|
12
12
|
it('can run', async () => {
|
|
13
|
-
const host =
|
|
13
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
14
14
|
await pipeline(host, {
|
|
15
15
|
pipeline: 'test',
|
|
16
16
|
type: 'jenkins',
|
|
@@ -41,7 +41,7 @@ describe('Deployment Generator', () => {
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it('can generate deployment for react', async () => {
|
|
44
|
-
const host =
|
|
44
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
45
45
|
await pipeline(host, {
|
|
46
46
|
pipeline: 'test',
|
|
47
47
|
type: 'jenkins',
|
|
@@ -68,7 +68,7 @@ describe('Deployment Generator', () => {
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it('can generate deployment for angular', async () => {
|
|
71
|
-
const host =
|
|
71
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
72
72
|
await pipeline(host, {
|
|
73
73
|
pipeline: 'test',
|
|
74
74
|
type: 'jenkins',
|
|
@@ -95,7 +95,7 @@ describe('Deployment Generator', () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
it('can generate deployment for express', async () => {
|
|
98
|
-
const host =
|
|
98
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
99
99
|
await pipeline(host, {
|
|
100
100
|
pipeline: 'test',
|
|
101
101
|
type: 'jenkins',
|
|
@@ -122,7 +122,7 @@ describe('Deployment Generator', () => {
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
it('can generate deployment for dotnet', async () => {
|
|
125
|
-
const host =
|
|
125
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
126
126
|
await pipeline(host, {
|
|
127
127
|
pipeline: 'test',
|
|
128
128
|
type: 'jenkins',
|
|
@@ -149,7 +149,7 @@ describe('Deployment Generator', () => {
|
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
it('can skip unknown project type', async () => {
|
|
152
|
-
const host =
|
|
152
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
153
153
|
await pipeline(host, {
|
|
154
154
|
pipeline: 'test',
|
|
155
155
|
type: 'jenkins',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This is a minimal Dockerfile for app deployment.
|
|
2
|
-
FROM registry.access.redhat.com/ubi8/dotnet-
|
|
2
|
+
FROM registry.access.redhat.com/ubi8/dotnet-60-runtime
|
|
3
3
|
|
|
4
4
|
ARG PROJECT
|
|
5
5
|
ARG ASSEMBLY
|
|
6
6
|
|
|
7
|
-
COPY ./dist/apps/${PROJECT}/Release/
|
|
7
|
+
COPY ./dist/apps/${PROJECT}/Release/net6.0 .
|
|
8
8
|
|
|
9
9
|
ENV ASSEMBLY ${ASSEMBLY}
|
|
10
10
|
CMD dotnet ${ASSEMBLY}
|
|
@@ -27,7 +27,7 @@ function addFiles(host, options) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function default_1(host, options) {
|
|
30
|
-
return
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const normalizedOptions = normalizeOptions(host, options);
|
|
32
32
|
addFiles(host, normalizedOptions);
|
|
33
33
|
yield (0, devkit_1.formatFiles)(host);
|
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
import generator from './pipeline';
|
|
4
4
|
|
|
5
5
|
describe('Pipeline Generator', () => {
|
|
6
|
-
|
|
7
6
|
describe('Jenkins', () => {
|
|
8
|
-
const options: Schema = {
|
|
9
|
-
pipeline: 'test',
|
|
7
|
+
const options: Schema = {
|
|
8
|
+
pipeline: 'test',
|
|
10
9
|
type: 'jenkins',
|
|
11
|
-
infra: 'test-infra',
|
|
12
|
-
envs: 'test-dev'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
it
|
|
16
|
-
const host =
|
|
10
|
+
infra: 'test-infra',
|
|
11
|
+
envs: 'test-dev',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
it('can run', async () => {
|
|
15
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
17
16
|
await generator(host, options);
|
|
18
17
|
expect(host.exists('.openshift/Jenkinsfile')).toBeTruthy();
|
|
19
18
|
expect(host.exists('.openshift/environment.infra.yml')).toBeTruthy();
|
|
20
19
|
expect(host.exists('.openshift/environments.yml')).toBeTruthy();
|
|
21
20
|
});
|
|
22
|
-
|
|
23
|
-
it
|
|
24
|
-
const host =
|
|
21
|
+
|
|
22
|
+
it('can generate multiple envs', async () => {
|
|
23
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
25
24
|
await generator(host, { ...options, envs: 'test-dev test-test' });
|
|
26
25
|
expect(host.exists('.openshift/environments.yml')).toBeTruthy();
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
const envs = host.read('.openshift/environments.yml').toString();
|
|
29
28
|
expect(envs).toContain('test-dev');
|
|
30
29
|
expect(envs).toContain('test-test');
|
|
31
30
|
});
|
|
32
|
-
|
|
33
|
-
it
|
|
34
|
-
const host =
|
|
31
|
+
|
|
32
|
+
it('can fail for duplicate env project', async () => {
|
|
33
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
35
34
|
await expect(
|
|
36
35
|
generator(host, { ...options, envs: 'test-dev test-dev' })
|
|
37
36
|
).rejects.toThrow('Each environment must be a unique project.');
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
|
-
|
|
39
|
+
|
|
41
40
|
describe('GitHub Actions', () => {
|
|
42
|
-
const options: Schema = {
|
|
43
|
-
pipeline: 'test',
|
|
41
|
+
const options: Schema = {
|
|
42
|
+
pipeline: 'test',
|
|
44
43
|
type: 'actions',
|
|
45
|
-
infra: 'test-infra',
|
|
46
|
-
envs: 'test-dev'
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
it
|
|
50
|
-
const host =
|
|
44
|
+
infra: 'test-infra',
|
|
45
|
+
envs: 'test-dev',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
it('can run', async () => {
|
|
49
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
51
50
|
await generator(host, options);
|
|
52
51
|
expect(host.exists('.github/workflows/pipeline.yml')).toBeTruthy();
|
|
53
52
|
expect(host.exists('.openshift/environment.infra.yml')).toBeTruthy();
|
|
54
53
|
expect(host.exists('.openshift/environments.yml')).toBeTruthy();
|
|
55
54
|
});
|
|
56
|
-
|
|
57
|
-
it
|
|
58
|
-
const host =
|
|
55
|
+
|
|
56
|
+
it('can generate multiple envs', async () => {
|
|
57
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
59
58
|
await generator(host, { ...options, envs: 'test-dev test-test' });
|
|
60
59
|
expect(host.exists('.openshift/environments.yml')).toBeTruthy();
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
const envs = host.read('.openshift/environments.yml').toString();
|
|
63
62
|
expect(envs).toContain('test-dev');
|
|
64
63
|
expect(envs).toContain('test-test');
|
|
65
64
|
});
|
|
66
|
-
|
|
67
|
-
it
|
|
68
|
-
const host =
|
|
65
|
+
|
|
66
|
+
it('can fail for duplicate env project', async () => {
|
|
67
|
+
const host = createTreeWithEmptyV1Workspace();
|
|
69
68
|
await expect(
|
|
70
69
|
generator(host, { ...options, envs: 'test-dev test-dev' })
|
|
71
70
|
).rejects.toThrow('Each environment must be a unique project.');
|