@hiiretail/gcp-infra-cli 0.64.1 → 0.65.3
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/generators/init/clan-infra/index.js +19 -4
- package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +1 -1
- package/generators/init/clan-infra/templates/github/workflows/release-notes.yml +11 -9
- package/generators/init/clan-infra/templates/{release-notes → release-notes-schema}/release-notes.schema.json +0 -0
- package/generators/maintenance/manage-states/index.js +0 -3
- package/generators/resources/cloudsql/index.js +0 -2
- package/generators/resources/cloudsql-database/index.js +0 -2
- package/generators/resources/pubsub/append.js +0 -3
- package/generators/resources/pubsub/get-gcp-projects.js +0 -1
- package/generators/resources/pubsub/index.js +2 -1
- package/generators/resources/pubsub/validate.js +12 -0
- package/generators/resources/scheduler/index.js +0 -2
- package/package.json +5 -5
- package/CHANGELOG.md +0 -95
|
@@ -46,8 +46,7 @@ module.exports = class extends BaseGenerator {
|
|
|
46
46
|
{
|
|
47
47
|
type: 'input',
|
|
48
48
|
name: 'foldersToSync',
|
|
49
|
-
message: 'Provide the name of docs subfolders that you want to sync to the Developer Portal (comma-seperated)',
|
|
50
|
-
validate: required,
|
|
49
|
+
message: 'Provide the name of docs subfolders that you want to sync to the Developer Portal (comma-seperated). Leave empty to add it later.',
|
|
51
50
|
},
|
|
52
51
|
{
|
|
53
52
|
type: 'list',
|
|
@@ -56,6 +55,12 @@ module.exports = class extends BaseGenerator {
|
|
|
56
55
|
default: 'false',
|
|
57
56
|
choices: ['true', 'false'],
|
|
58
57
|
},
|
|
58
|
+
{
|
|
59
|
+
type: 'input',
|
|
60
|
+
name: 'serviceName',
|
|
61
|
+
message: 'Provide the name of your service',
|
|
62
|
+
validate: required,
|
|
63
|
+
},
|
|
59
64
|
];
|
|
60
65
|
|
|
61
66
|
return this.prompt(prompts).then((props) => {
|
|
@@ -64,7 +69,12 @@ module.exports = class extends BaseGenerator {
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
writing() {
|
|
67
|
-
const {
|
|
72
|
+
const {
|
|
73
|
+
clan,
|
|
74
|
+
tribe,
|
|
75
|
+
group,
|
|
76
|
+
serviceName,
|
|
77
|
+
} = this.answers;
|
|
68
78
|
const groups = group.startsWith('@') ? group : `@extenda/${group}`;
|
|
69
79
|
const [tribeProd, tribeStaging] = getGcpProjects(this, tribe);
|
|
70
80
|
const [clanProd, clanStaging] = getGcpProjects(this, clan);
|
|
@@ -118,7 +128,12 @@ module.exports = class extends BaseGenerator {
|
|
|
118
128
|
});
|
|
119
129
|
this.copyDir(
|
|
120
130
|
'release-notes',
|
|
121
|
-
this.destinationPath(
|
|
131
|
+
this.destinationPath(`docs/${serviceName}/release-notes`),
|
|
132
|
+
this.answers,
|
|
133
|
+
);
|
|
134
|
+
this.copyDir(
|
|
135
|
+
'release-notes-schema',
|
|
136
|
+
this.destinationPath('docs/'),
|
|
122
137
|
this.answers,
|
|
123
138
|
);
|
|
124
139
|
this.fs.copy(
|
|
@@ -19,7 +19,7 @@ include {
|
|
|
19
19
|
inputs = merge(
|
|
20
20
|
{
|
|
21
21
|
secrets = merge(yamldecode(file("${get_terragrunt_dir()}/secrets.yaml")).secrets,
|
|
22
|
-
{ "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0] })
|
|
22
|
+
{ "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0].name })
|
|
23
23
|
project_id = local.project_vars.locals.project_id
|
|
24
24
|
labels = {
|
|
25
25
|
terraform = ""
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
name: Release Notes
|
|
2
|
-
on:
|
|
2
|
+
on:
|
|
3
3
|
pull_request:
|
|
4
|
-
paths:
|
|
4
|
+
paths:
|
|
5
|
+
- 'docs/**/release-notes/*.yaml'
|
|
6
|
+
- 'docs/release-notes.schema.json'
|
|
7
|
+
- '.github/workflows/release-notes.yaml'
|
|
5
8
|
|
|
6
9
|
jobs:
|
|
7
10
|
yamllint:
|
|
@@ -15,17 +18,16 @@ jobs:
|
|
|
15
18
|
run: sudo pip install yamllint
|
|
16
19
|
|
|
17
20
|
- name: YAML lint
|
|
18
|
-
run:
|
|
21
|
+
run: |
|
|
22
|
+
for f in docs/**/release-notes/*.yaml; do
|
|
23
|
+
yamllint docs/release-notes.schema.json -d "$f"
|
|
24
|
+
done
|
|
19
25
|
|
|
20
26
|
- name: Install pajv
|
|
21
27
|
run: sudo npm install -g pajv
|
|
22
28
|
|
|
23
29
|
- name: Validate YAML schema
|
|
24
30
|
run: |
|
|
25
|
-
for f in docs
|
|
26
|
-
pajv -s docs/release-notes
|
|
31
|
+
for f in docs/**/release-notes/*.yaml; do
|
|
32
|
+
pajv -s docs/release-notes.schema.json -d "$f"
|
|
27
33
|
done
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# TODO:
|
|
31
|
-
# - name: Publish
|
|
File without changes
|
|
@@ -8,7 +8,6 @@ const Separator = require('enquirer-separator');
|
|
|
8
8
|
const { Storage } = require('@google-cloud/storage');
|
|
9
9
|
const BaseGenerator = require('../../../src/BaseGenerator');
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
const getBucketName = (answers) => {
|
|
13
12
|
const dirName = path.basename(process.cwd());
|
|
14
13
|
let bucketName = '';
|
|
@@ -22,7 +21,6 @@ const getBucketName = (answers) => {
|
|
|
22
21
|
return bucketName;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
|
|
26
24
|
const downloadStateFiles = (files, dest) => {
|
|
27
25
|
files.forEach((file) => {
|
|
28
26
|
const destFile = path.join(dest, file.name);
|
|
@@ -35,7 +33,6 @@ const downloadStateFiles = (files, dest) => {
|
|
|
35
33
|
});
|
|
36
34
|
};
|
|
37
35
|
|
|
38
|
-
|
|
39
36
|
module.exports = class extends BaseGenerator {
|
|
40
37
|
prompting() {
|
|
41
38
|
const prompts = [
|
|
@@ -26,7 +26,6 @@ module.exports = class extends SecretsGenerator {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
writing() {
|
|
31
30
|
const {
|
|
32
31
|
instanceType,
|
|
@@ -50,7 +49,6 @@ module.exports = class extends SecretsGenerator {
|
|
|
50
49
|
this.writeSecrets('cloud-sql', 'databases', instanceType, dbName);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
end() {
|
|
55
53
|
const {
|
|
56
54
|
instanceType,
|
|
@@ -25,7 +25,6 @@ const appendIncludePull = async (fileContent, originalContentYaml, subscriptionF
|
|
|
25
25
|
|
|
26
26
|
const newPullArray = [];
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
newPullArray.push(
|
|
30
29
|
{
|
|
31
30
|
name: `${input.existingTopic}+${input.subscriberName}`,
|
|
@@ -61,7 +60,6 @@ const appendNotIncludePush = async (inputs, subscriptionFilePath) => {
|
|
|
61
60
|
fs.appendFileSync(subscriptionFilePath, `push_subscriptions:\n${yamlPushArray}`);
|
|
62
61
|
};
|
|
63
62
|
|
|
64
|
-
|
|
65
63
|
const appendIncludePush = async (fileContent, originalContentYaml, subscriptionFilePath, input) => {
|
|
66
64
|
if (fileContent.includes('push_subscriptions')) {
|
|
67
65
|
const pushArray = Object.values(originalContentYaml.push_subscriptions);
|
|
@@ -90,7 +88,6 @@ const appendIncludePush = async (fileContent, originalContentYaml, subscriptionF
|
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
90
|
|
|
93
|
-
|
|
94
91
|
module.exports = {
|
|
95
92
|
appendNotIncludePull,
|
|
96
93
|
appendIncludePull,
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
validSystemName,
|
|
8
8
|
validVersion,
|
|
9
9
|
validSubscriberName,
|
|
10
|
+
checkExistingTopicPath,
|
|
10
11
|
} = require('./validate');
|
|
11
12
|
const handleSubscribers = require('./handle-subscribers');
|
|
12
13
|
const { getProjectId, getProdPushEndopint } = require('./get-gcp-projects');
|
|
@@ -117,7 +118,7 @@ module.exports = class extends BaseGenerator {
|
|
|
117
118
|
type: 'input',
|
|
118
119
|
name: 'existingTopic',
|
|
119
120
|
message: 'Please provide the name of the existing topic you want to subscribe to',
|
|
120
|
-
validate: required,
|
|
121
|
+
validate: (input) => required(input) && checkExistingTopicPath(input),
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
124
|
when: (response) => response.createResource === 'subscription' && response.pushOrPull === 'push',
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
1
4
|
const validSystemName = (input) => {
|
|
2
5
|
if (input.replace(/\s/g, '').length === 3) {
|
|
3
6
|
return true;
|
|
@@ -24,9 +27,18 @@ const validSubscriberName = (input) => {
|
|
|
24
27
|
return 'Not supported input for subscriber name';
|
|
25
28
|
};
|
|
26
29
|
|
|
30
|
+
const checkExistingTopicPath = (input) => {
|
|
31
|
+
const topicDirPath = path.join(process.cwd(), 'infra', 'staging', 'pubsub', input);
|
|
32
|
+
|
|
33
|
+
if (fs.existsSync(topicDirPath)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return 'Topic does not exist. Check the spelling';
|
|
37
|
+
};
|
|
27
38
|
|
|
28
39
|
module.exports = {
|
|
29
40
|
validSystemName,
|
|
30
41
|
validVersion,
|
|
31
42
|
validSubscriberName,
|
|
43
|
+
checkExistingTopicPath,
|
|
32
44
|
};
|
|
@@ -72,7 +72,6 @@ module.exports = class extends BaseGenerator {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
75
|
writing() {
|
|
77
76
|
['prod', 'staging'].forEach((env) => {
|
|
78
77
|
this.copyDir(
|
|
@@ -86,7 +85,6 @@ module.exports = class extends BaseGenerator {
|
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
|
|
90
88
|
end() {
|
|
91
89
|
this.log(`
|
|
92
90
|
${chalk.green('Your job resources have now been created. Please add any other specifications supported by the module if needed')}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hiiretail/gcp-infra-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.3",
|
|
4
4
|
"description": "Infrastructure as code generator for GCP.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"commander": "^5.1.0",
|
|
36
36
|
"enquirer-separator": "^0.1.0",
|
|
37
37
|
"glob": "^7.1.6",
|
|
38
|
-
"inquirer": "^7.
|
|
38
|
+
"inquirer": "^7.3.3",
|
|
39
39
|
"js-yaml": "^4.1.0",
|
|
40
40
|
"npm-api": "^1.0.0",
|
|
41
41
|
"semver": "^7.3.2",
|
|
42
42
|
"sprintf-js": "^1.1.2",
|
|
43
|
-
"yeoman-environment": "^2.
|
|
44
|
-
"yeoman-generator": "^4.
|
|
43
|
+
"yeoman-environment": "^2.10.3",
|
|
44
|
+
"yeoman-generator": "^4.13.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"eslint": "^6.8.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"jest-sonar": "^0.2.5",
|
|
52
52
|
"mock-fs": "^4.12.0",
|
|
53
53
|
"yeoman-assert": "^3.1.1",
|
|
54
|
-
"yeoman-test": "^2.
|
|
54
|
+
"yeoman-test": "^2.7.0",
|
|
55
55
|
"sprintf-js": "^1.1.2"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
### 2021-03-28
|
|
4
|
-
* Remove Pub/Sub cross-project resource according to Architecture Chapter decision.
|
|
5
|
-
|
|
6
|
-
### 2021-03-03
|
|
7
|
-
* Add the generator for creating subscriptions which will subscribe to a topic in a diffrent project
|
|
8
|
-
|
|
9
|
-
### 2021-03-01
|
|
10
|
-
* Add terraform state files maintenance utility generator
|
|
11
|
-
|
|
12
|
-
### 2021-03-01
|
|
13
|
-
* New generator for solution review board (SRB) documentation, including utilities to
|
|
14
|
-
create ADRs and C4 diagrams from Structurizr DSL
|
|
15
|
-
|
|
16
|
-
### 2021-02-02
|
|
17
|
-
* Add KMS support
|
|
18
|
-
|
|
19
|
-
### 2020-12-23
|
|
20
|
-
* Release notes schema and validator
|
|
21
|
-
|
|
22
|
-
### 2020-12-15
|
|
23
|
-
* Add more monitoring templates
|
|
24
|
-
|
|
25
|
-
### 2020-12-11
|
|
26
|
-
* Add cloudsql into monitoring generator
|
|
27
|
-
|
|
28
|
-
### 2020-12-11
|
|
29
|
-
* Add Generator for kafka connect pubsub source
|
|
30
|
-
|
|
31
|
-
### 2020-11-27
|
|
32
|
-
* Add Kafka-connect generator
|
|
33
|
-
|
|
34
|
-
### 2020-11-10
|
|
35
|
-
* Add elastic cloud generator
|
|
36
|
-
|
|
37
|
-
### 2020-10-20
|
|
38
|
-
* Add Confluent cluster generator
|
|
39
|
-
|
|
40
|
-
### 2020-10-20
|
|
41
|
-
* Add Kafka topics generator
|
|
42
|
-
|
|
43
|
-
### 2020-10-13
|
|
44
|
-
* Add Cloud Storage creation feature
|
|
45
|
-
|
|
46
|
-
### 2020-09-18
|
|
47
|
-
* Generator for update module versions
|
|
48
|
-
|
|
49
|
-
### 2020-09-14
|
|
50
|
-
* Add generator for Hii Retail IAM
|
|
51
|
-
|
|
52
|
-
### 2020-08-21
|
|
53
|
-
* Add Cloud Scheduler generator
|
|
54
|
-
|
|
55
|
-
### 2020-08-12
|
|
56
|
-
* Generator for monitoring
|
|
57
|
-
|
|
58
|
-
### 2020-06-24
|
|
59
|
-
* Add the firebase generator
|
|
60
|
-
|
|
61
|
-
### 2020-06-15
|
|
62
|
-
* Memorystore secrets
|
|
63
|
-
|
|
64
|
-
### 2020-06-09
|
|
65
|
-
* Tribe GKE Generator
|
|
66
|
-
|
|
67
|
-
### 2020-06-09
|
|
68
|
-
* Add secrets handler
|
|
69
|
-
|
|
70
|
-
### 2020-06-05
|
|
71
|
-
* Add organization generator
|
|
72
|
-
|
|
73
|
-
### 2020-06-04
|
|
74
|
-
* Create a template for MySQL database
|
|
75
|
-
|
|
76
|
-
### 2020-06-04
|
|
77
|
-
* CloudSQL MSSQL Template
|
|
78
|
-
|
|
79
|
-
### 2020-06-04
|
|
80
|
-
* Create CloudSQL MySQL templates
|
|
81
|
-
|
|
82
|
-
### 2020-06-03
|
|
83
|
-
* Pubsub generator
|
|
84
|
-
|
|
85
|
-
### 2020-06-03
|
|
86
|
-
* Add PostgreSQL Database template
|
|
87
|
-
|
|
88
|
-
### 2020-06-03
|
|
89
|
-
* Add CloudSQL Postgres Template
|
|
90
|
-
|
|
91
|
-
### 2020-06-02
|
|
92
|
-
* Add memorystore generator templates
|
|
93
|
-
|
|
94
|
-
### 2020-06-01
|
|
95
|
-
* Add init generator
|