@fishawack/lab-env 4.34.0 → 4.35.0
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/CHANGELOG.md +22 -1
- package/bitbucket-pipelines.yml +62 -0
- package/commands/create/cmds/new.js +2 -2
- package/commands/create/libs/vars.js +88 -1
- package/commands/create/services/aws/cloudfront.js +16 -44
- package/commands/create/services/aws/elasticbeanstalk.js +4 -2
- package/commands/create/services/aws/index.js +24 -6
- package/commands/create/services/egnyte.js +1 -7
- package/commands/create/templates/elasticbeanstalk/.ebextensions/adonis/post-deploy.config +6 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/adonis/software.config +5 -0
- package/package.json +33 -5
- package/.gitlab-ci.yml +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 4.35.0 (2024-09-26)
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* added new mtpa client ([dce9679](https://bitbucket.org/fishawackdigital/lab-env/commits/dce96797ebdfd722b8094bca01d38866fd762a54))
|
|
8
|
+
* re-provisioned static sites now ensure all cloudfront functions are set ([5ac017b](https://bitbucket.org/fishawackdigital/lab-env/commits/5ac017bb727bb80cffe545973fd6ffb61d17217b))
|
|
9
|
+
* support provisioning adonis envs ([4d73174](https://bitbucket.org/fishawackdigital/lab-env/commits/4d731746ea6227c0241eb32d1c9002734800d31e))
|
|
10
|
+
|
|
11
|
+
#### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **adonis:** added port and log level to adonis provision command ([b5940b8](https://bitbucket.org/fishawackdigital/lab-env/commits/b5940b844b801cb9c7f2684b61bb6ba684237860))
|
|
14
|
+
* dont create FW_DIR directories as they already exist in the image ([aa3c646](https://bitbucket.org/fishawackdigital/lab-env/commits/aa3c646014ca31f14c99138963e8922a47b19ac7))
|
|
15
|
+
* egnyte check now correctly returns fail or pass result ([8e232ed](https://bitbucket.org/fishawackdigital/lab-env/commits/8e232edd658080ed83e5bb4699518fe741fd91be))
|
|
16
|
+
* enforce lowercase repo names and start and end with digit or letter ([03c473e](https://bitbucket.org/fishawackdigital/lab-env/commits/03c473e1d569bce1792ef98ab23d68e84ba18c5f))
|
|
17
|
+
* remove response cloudfront function on deprov ([8343740](https://bitbucket.org/fishawackdigital/lab-env/commits/83437405b7d7cb98f78ecbad8ea52becf0128cab))
|
|
18
|
+
* set custom error response on re-provision command ([c162e4a](https://bitbucket.org/fishawackdigital/lab-env/commits/c162e4a016ced36586eb828cea6be1d5ede925fa))
|
|
19
|
+
* set FW_DIR to aws runner home and test mail ([b085d9e](https://bitbucket.org/fishawackdigital/lab-env/commits/b085d9ee2a474095131b182134358b3180e03818))
|
|
20
|
+
* static sites now attach response function with security headers ([28e192d](https://bitbucket.org/fishawackdigital/lab-env/commits/28e192d6fbc5ccf64560b1be15aa5e2b527ba345))
|
|
21
|
+
* use consistent bitbucket pipeline as standard projects ([8b19b1c](https://bitbucket.org/fishawackdigital/lab-env/commits/8b19b1cf224b1ae7606f1d43b1ca4a17f9c88ebf))
|
|
22
|
+
* use slug and nameSafe to response cloudfront response ([28e30eb](https://bitbucket.org/fishawackdigital/lab-env/commits/28e30ebb35df8bbd96300f090f4deeffce5d13a0))
|
|
23
|
+
|
|
3
24
|
### 4.34.0 (2024-08-21)
|
|
4
25
|
* [Feature] enable pipelines by default when running new command
|
|
5
26
|
* [Bug] limit elasticsearch memory size so it doesnt attempt to take up all the space
|
|
@@ -644,4 +665,4 @@
|
|
|
644
665
|
* [Docs] Added readme and changelog to repo
|
|
645
666
|
|
|
646
667
|
### 0.0.1 (2021-01-11)
|
|
647
|
-
* [Misc] Initial release
|
|
668
|
+
* [Misc] Initial release
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
definitions:
|
|
2
|
+
services:
|
|
3
|
+
docker:
|
|
4
|
+
image: docker:dind
|
|
5
|
+
memory: 12288
|
|
6
|
+
|
|
7
|
+
pipelines:
|
|
8
|
+
default:
|
|
9
|
+
- step:
|
|
10
|
+
image: fishawack/aws-runner
|
|
11
|
+
runs-on:
|
|
12
|
+
- self.hosted
|
|
13
|
+
- linux
|
|
14
|
+
- production
|
|
15
|
+
size: 4x
|
|
16
|
+
script:
|
|
17
|
+
# Set global repository CI flags
|
|
18
|
+
- export BRANCH=$BITBUCKET_BRANCH REPO=$BITBUCKET_REPO_SLUG
|
|
19
|
+
# Set FW DIR to project repo as that's the only location that's mountable
|
|
20
|
+
- export FW_DIR=/home/aws-runner
|
|
21
|
+
# Fetch secure AWS credentials from workspace variables
|
|
22
|
+
- echo $AWS_CREDENTIALS | base64 -d > $FW_DIR/.aws/credentials
|
|
23
|
+
# Fetch secure Egnyte credentials from workspace variables
|
|
24
|
+
- echo $EGNYTE_CREDENTIALS | base64 -d > $FW_DIR/targets/ftp-fishawack.egnyte.com.json
|
|
25
|
+
# Fetch secure Mail credentials from workspace variables
|
|
26
|
+
- jq --argjson JSON "$(echo $MAIL_CREDENTIALS | base64 -d)" '. += $JSON' $FW_DIR/targets/misc.json > $FW_DIR/targets/_misc.json
|
|
27
|
+
# Copy new merged misc to final location
|
|
28
|
+
- cp $FW_DIR/targets/_misc.json $FW_DIR/targets/misc.json
|
|
29
|
+
# Enable FULL docker images
|
|
30
|
+
- export FW_FULL=1
|
|
31
|
+
# Own the git dir as aws-runner so that a non-root user id can be mapped to each container
|
|
32
|
+
- chown -R aws-runner:aws-runner . /build
|
|
33
|
+
# Write ssh config to aws-runner so any bitbucket pipeline keys can be used by the user
|
|
34
|
+
- cat ~/.ssh/config >> $FW_DIR/.ssh/config
|
|
35
|
+
# Copy ssh dir to project dir so lab-env has access to keys
|
|
36
|
+
- su aws-runner -c 'cp /build/*/ssh/* $FW_DIR/.ssh/'
|
|
37
|
+
# Start ssh agent and add all (if any) keys
|
|
38
|
+
- eval `ssh-agent` && ssh-add || true
|
|
39
|
+
# Own the .tmp folder as aws-runner so that a non-root user id can be mapped to each container
|
|
40
|
+
- chown -R aws-runner:aws-runner /tmp
|
|
41
|
+
# Install
|
|
42
|
+
- su aws-runner -c 'npm ci'
|
|
43
|
+
# Test
|
|
44
|
+
- su aws-runner -c 'npm test'
|
|
45
|
+
services:
|
|
46
|
+
- docker
|
|
47
|
+
branches:
|
|
48
|
+
master:
|
|
49
|
+
- step:
|
|
50
|
+
image: fishawack/aws-runner
|
|
51
|
+
runs-on:
|
|
52
|
+
- self.hosted
|
|
53
|
+
- linux
|
|
54
|
+
- production
|
|
55
|
+
size: 4x
|
|
56
|
+
script:
|
|
57
|
+
# Install release deps
|
|
58
|
+
- npm install -g semantic-release@24 @semantic-release/changelog@6 @semantic-release/git@10 conventional-changelog-conventionalcommits@8
|
|
59
|
+
# Release version
|
|
60
|
+
- semantic-release --repositoryUrl=https://$GIT_CREDENTIALS@bitbucket.org/$BITBUCKET_REPO_FULL_NAME
|
|
61
|
+
# Sync development after publish
|
|
62
|
+
- git fetch origin "+refs/heads/*:refs/remotes/origin/*" && git checkout -b development origin/development && git merge master && git push origin development
|
|
@@ -35,7 +35,7 @@ module.exports = [
|
|
|
35
35
|
name = `${template.prefix}-${name}`;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
if(/^[a-
|
|
38
|
+
if(/^[a-z0-9][a-z0-9-_.]+[a-z0-9]$/.test(name)){
|
|
39
39
|
// Create Remote Repositories
|
|
40
40
|
if(!await bitbucket.exists(name)){
|
|
41
41
|
if(await bitbucket.exists(template.name)){
|
|
@@ -49,7 +49,7 @@ module.exports = [
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
} else {
|
|
52
|
-
console.log(utilities.colorize(`Repo
|
|
52
|
+
console.log(utilities.colorize(`Repo names must contain only lowercase letters, decimal digits, dashes, and underscores, and must begin & end with a lowercase letter or decimal digit.`, 'helper'));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
];
|
|
@@ -263,6 +263,36 @@ module.exports.eb = {
|
|
|
263
263
|
{ OptionName: 'SESSION_SECURE_COOKIE', Value: "true", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
264
264
|
]
|
|
265
265
|
},
|
|
266
|
+
adonis: {
|
|
267
|
+
shared: [
|
|
268
|
+
{
|
|
269
|
+
OptionName: 'NODE_ENV',
|
|
270
|
+
Value: 'production',
|
|
271
|
+
Namespace: 'aws:elasticbeanstalk:application:environment'
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
OptionName: 'APP_KEY',
|
|
275
|
+
Value: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString('base64')}`,
|
|
276
|
+
Namespace: 'aws:elasticbeanstalk:application:environment'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
OptionName: 'APP_URL',
|
|
280
|
+
Value: 'https://<%= DOMAIN_LINK %>',
|
|
281
|
+
Namespace: 'aws:elasticbeanstalk:application:environment'
|
|
282
|
+
},
|
|
283
|
+
{ OptionName: 'SESSION_DRIVER', Value: "cookie", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
284
|
+
{ OptionName: 'AWS_BUCKET', Value: "<%= s3Slug %>", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
285
|
+
{ OptionName: 'AWS_DEFAULT_REGION', Value: "<%= AWS_REGION %>", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
286
|
+
{ OptionName: 'AWS_ACCESS_KEY_ID', Value: "<%= AccessKeyId %>", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
287
|
+
{ OptionName: 'AWS_SECRET_ACCESS_KEY', Value: "<%= SecretAccessKey %>", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
288
|
+
{ OptionName: 'FILESYSTEM_DISK', Value: "s3", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
289
|
+
{ OptionName: 'FILESYSTEM_DISK_PUBLIC', Value: "s3-public", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
290
|
+
{ OptionName: 'PORT', Value: "3333", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
291
|
+
{ OptionName: 'LOG_LEVEL', Value: "info", Namespace: 'aws:elasticbeanstalk:application:environment' },
|
|
292
|
+
],
|
|
293
|
+
low: [],
|
|
294
|
+
high: []
|
|
295
|
+
},
|
|
266
296
|
drupal: {
|
|
267
297
|
shared: [],
|
|
268
298
|
low: [],
|
|
@@ -428,6 +458,13 @@ module.exports.eb = {
|
|
|
428
458
|
low: [],
|
|
429
459
|
high: [],
|
|
430
460
|
},
|
|
461
|
+
adonis: {
|
|
462
|
+
platform: "nginx",
|
|
463
|
+
language: "node",
|
|
464
|
+
shared: [],
|
|
465
|
+
low: [],
|
|
466
|
+
high: [],
|
|
467
|
+
},
|
|
431
468
|
drupal: {
|
|
432
469
|
platform: "httpd",
|
|
433
470
|
language: "php",
|
|
@@ -461,4 +498,54 @@ module.exports.eb = {
|
|
|
461
498
|
config(){
|
|
462
499
|
return template(fs.readFileSync(`${__dirname}/../templates/elasticbeanstalk/.elasticbeanstalk/config.yml`, {encoding: 'utf8'}))(process.env);
|
|
463
500
|
}
|
|
464
|
-
};
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
// Cloudfront distribution config
|
|
504
|
+
module.exports.cloudfront = (name, region, FunctionARNResponse, FunctionARNRequest, OAI) => ({
|
|
505
|
+
DistributionConfig: {
|
|
506
|
+
Enabled: true,
|
|
507
|
+
CallerReference: name,
|
|
508
|
+
Comment: `lab-env provisioned CloudFront distribution for project ${name}`,
|
|
509
|
+
CustomErrorResponses: {
|
|
510
|
+
Items: [
|
|
511
|
+
{
|
|
512
|
+
ErrorCachingMinTTL: 0,
|
|
513
|
+
ErrorCode: 404,
|
|
514
|
+
ResponseCode: 200,
|
|
515
|
+
ResponsePagePath: '/index.html'
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
Quantity: 1
|
|
519
|
+
},
|
|
520
|
+
DefaultCacheBehavior: {
|
|
521
|
+
Compress: true,
|
|
522
|
+
TargetOriginId: `${name}.s3.${region}.amazonaws.com`,
|
|
523
|
+
ViewerProtocolPolicy: 'redirect-to-https',
|
|
524
|
+
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6', // Built in, Managed AWS Policy - Cache Optimized
|
|
525
|
+
FunctionAssociations: {
|
|
526
|
+
Items: [
|
|
527
|
+
{
|
|
528
|
+
EventType: 'viewer-response',
|
|
529
|
+
FunctionARN: FunctionARNResponse
|
|
530
|
+
}
|
|
531
|
+
].concat(FunctionARNRequest ? {
|
|
532
|
+
EventType: 'viewer-request',
|
|
533
|
+
FunctionARN: FunctionARNRequest
|
|
534
|
+
} : []),
|
|
535
|
+
Quantity: 2
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
Origins: {
|
|
539
|
+
Items: [
|
|
540
|
+
{
|
|
541
|
+
DomainName: `${name}.s3.${region}.amazonaws.com`,
|
|
542
|
+
Id: `${name}.s3.${region}.amazonaws.com`,
|
|
543
|
+
S3OriginConfig: {
|
|
544
|
+
OriginAccessIdentity: `origin-access-identity/cloudfront/${OAI.CloudFrontOriginAccessIdentity.Id}`
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
],
|
|
548
|
+
Quantity: 1
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const { CloudFrontClient, CreateDistributionWithTagsCommand, CreateCloudFrontOriginAccessIdentityCommand, DeleteDistributionCommand , DeleteCloudFrontOriginAccessIdentityCommand, GetDistributionCommand, UpdateDistributionCommand, GetCloudFrontOriginAccessIdentityCommand, CreateFunctionCommand, GetFunctionCommand, UpdateFunctionCommand, PublishFunctionCommand, DeleteFunctionCommand, DescribeFunctionCommand } = require("@aws-sdk/client-cloudfront");
|
|
2
2
|
const fs = require('fs');
|
|
3
|
+
const { merge } = require('lodash');
|
|
3
4
|
const { Spinner, poll } = require('../../libs/utilities');
|
|
5
|
+
const { cloudfront } = require('../../libs/vars');
|
|
4
6
|
const { createClient } = require('./misc.js');
|
|
5
7
|
|
|
6
|
-
module.exports.createCloudFrontDistribution = async (name, account, tags = [],
|
|
8
|
+
module.exports.createCloudFrontDistribution = async (name, account, tags = [], FunctionARNRequest = null, FunctionARNResponse = null, region = 'us-east-1') => {
|
|
7
9
|
const client = createClient(CloudFrontClient, account, region);
|
|
8
10
|
|
|
9
11
|
let OAI = await Spinner.prototype.simple(`Creating CloudFront OAI`, () => {
|
|
@@ -24,49 +26,7 @@ module.exports.createCloudFrontDistribution = async (name, account, tags = [], F
|
|
|
24
26
|
return client.send(
|
|
25
27
|
new CreateDistributionWithTagsCommand({
|
|
26
28
|
DistributionConfigWithTags: {
|
|
27
|
-
|
|
28
|
-
Enabled: true,
|
|
29
|
-
CallerReference: name,
|
|
30
|
-
Comment: `lab-env provisioned CloudFront distribution for project ${name}`,
|
|
31
|
-
CustomErrorResponses: {
|
|
32
|
-
Items: [
|
|
33
|
-
{
|
|
34
|
-
ErrorCachingMinTTL: 0,
|
|
35
|
-
ErrorCode: 404,
|
|
36
|
-
ResponseCode: 200,
|
|
37
|
-
ResponsePagePath: '/index.html'
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
Quantity: 1
|
|
41
|
-
},
|
|
42
|
-
DefaultCacheBehavior: {
|
|
43
|
-
Compress: true,
|
|
44
|
-
TargetOriginId: `${name}.s3.${region}.amazonaws.com`,
|
|
45
|
-
ViewerProtocolPolicy: 'redirect-to-https',
|
|
46
|
-
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6', // Built in, Managed AWS Policy - Cache Optimized
|
|
47
|
-
FunctionAssociations: FunctionARN && {
|
|
48
|
-
Items: [
|
|
49
|
-
{
|
|
50
|
-
EventType: 'viewer-request',
|
|
51
|
-
FunctionARN
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
Quantity: 1
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
Origins: {
|
|
58
|
-
Items: [
|
|
59
|
-
{
|
|
60
|
-
DomainName: `${name}.s3.${region}.amazonaws.com`,
|
|
61
|
-
Id: `${name}.s3.${region}.amazonaws.com`,
|
|
62
|
-
S3OriginConfig: {
|
|
63
|
-
OriginAccessIdentity: `origin-access-identity/cloudfront/${OAI.CloudFrontOriginAccessIdentity.Id}`
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
Quantity: 1
|
|
68
|
-
}
|
|
69
|
-
},
|
|
29
|
+
...cloudfront(name, region, FunctionARNResponse, FunctionARNRequest, OAI),
|
|
70
30
|
Tags: {
|
|
71
31
|
Items: [{Key: 'client', Value: account}].concat(tags)
|
|
72
32
|
}
|
|
@@ -86,6 +46,18 @@ module.exports.createCloudFrontDistribution = async (name, account, tags = [], F
|
|
|
86
46
|
new GetDistributionCommand({ Id })
|
|
87
47
|
);
|
|
88
48
|
});
|
|
49
|
+
|
|
50
|
+
res = await Spinner.prototype.simple(`Ensuring CloudFront functions are applied to CloudFront distribution`, () => {
|
|
51
|
+
return client.send(
|
|
52
|
+
new UpdateDistributionCommand({
|
|
53
|
+
...merge(
|
|
54
|
+
res.Distribution,
|
|
55
|
+
cloudfront(name, region, FunctionARNResponse, FunctionARNRequest, OAI)
|
|
56
|
+
),
|
|
57
|
+
IfMatch: res.ETag
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
});
|
|
89
61
|
}
|
|
90
62
|
|
|
91
63
|
return res;
|
|
@@ -17,7 +17,7 @@ module.exports.createElasticBeanstalkApplication = async (name, account) => {
|
|
|
17
17
|
return res;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
module.exports.createElasticBeanstalkEnvironment = async (name, account, ApplicationName, OptionSettings, CNAMEPrefix, tags = []) => {
|
|
20
|
+
module.exports.createElasticBeanstalkEnvironment = async (name, account, {language}, ApplicationName, OptionSettings, CNAMEPrefix, tags = []) => {
|
|
21
21
|
const client = createClient(ElasticBeanstalkClient, account);
|
|
22
22
|
|
|
23
23
|
const solutions = await Spinner.prototype.simple(`Retrieving available solution stacks`, () => {
|
|
@@ -31,7 +31,9 @@ module.exports.createElasticBeanstalkEnvironment = async (name, account, Applica
|
|
|
31
31
|
new CreateEnvironmentCommand({
|
|
32
32
|
ApplicationName,
|
|
33
33
|
EnvironmentName: name,
|
|
34
|
-
SolutionStackName: solutions.SolutionStacks.filter(d =>
|
|
34
|
+
SolutionStackName: solutions.SolutionStacks.filter(d => {
|
|
35
|
+
return language === "node" ? d.includes('Node.js 20') : d.includes('PHP 8.1') && d.includes('Amazon Linux 2 ')
|
|
36
|
+
})[0],
|
|
35
37
|
OptionSettings,
|
|
36
38
|
CNAMEPrefix,
|
|
37
39
|
Tags: [{Key: 'client', Value: account}].concat(tags)
|
|
@@ -12,14 +12,30 @@ module.exports.ec2 = require("./ec2.js");
|
|
|
12
12
|
|
|
13
13
|
module.exports.slug = (repo, client, branch, service = "s3") => nameSafe(`${branch}-${repo}-${client}`, service);
|
|
14
14
|
|
|
15
|
-
module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin', 'optum', 'rally', 'menarini', 'childrensminnesota', 'gore', 'axogen', 'gedeonrichter', 'relievantmedsystems', 'gilead', 'alexion', 'insulet', 'danone'];
|
|
15
|
+
module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin', 'optum', 'rally', 'menarini', 'childrensminnesota', 'gore', 'axogen', 'gedeonrichter', 'relievantmedsystems', 'gilead', 'alexion', 'insulet', 'danone', 'mtpa'];
|
|
16
16
|
|
|
17
|
-
module.exports.static = async (name, account, tags = [], credentials = []) => {
|
|
17
|
+
module.exports.static = async (name, account, tags = [], credentials = [], repo, branch) => {
|
|
18
18
|
let s3 = await module.exports.s3.createS3Bucket(name, account, tags);
|
|
19
19
|
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
let cloudfront = await module.exports.cloudfront.createCloudFrontDistribution(
|
|
21
|
+
name,
|
|
22
|
+
account,
|
|
23
|
+
tags,
|
|
24
|
+
(await module.exports.cloudfront.createCloudFrontFunction(
|
|
25
|
+
name,
|
|
26
|
+
account,
|
|
27
|
+
credentials.length ? 'aws-cloudfront-auth' : 'aws-cloudfront-simple',
|
|
28
|
+
{
|
|
29
|
+
credentials: credentials.map(d => `Basic ${Buffer.from(`${d.username}:${d.password}`).toString('base64')}`)
|
|
30
|
+
}
|
|
31
|
+
)).FunctionSummary.FunctionMetadata.FunctionARN,
|
|
32
|
+
(await module.exports.cloudfront.createCloudFrontFunction(
|
|
33
|
+
module.exports.slug(`${repo}-response`, account, branch),
|
|
34
|
+
account,
|
|
35
|
+
'aws-cloudfront-response',
|
|
36
|
+
{}
|
|
37
|
+
)).FunctionSummary.FunctionMetadata.FunctionARN
|
|
38
|
+
);
|
|
23
39
|
|
|
24
40
|
await module.exports.s3.setS3BucketPolicy(name, account, cloudfront.Distribution.DistributionConfig.Origins.Items[0].S3OriginConfig.OriginAccessIdentity.split('origin-access-identity/cloudfront/')[1]);
|
|
25
41
|
|
|
@@ -40,6 +56,8 @@ module.exports.staticTerminate = async (name, account, repo, branch, id) => {
|
|
|
40
56
|
try { await module.exports.cloudfront.removeCloudFrontDistribution(id, account); } catch(e) {}
|
|
41
57
|
|
|
42
58
|
try { await module.exports.cloudfront.removeCloudFrontFunction(name, account); } catch(e) {}
|
|
59
|
+
|
|
60
|
+
try { await module.exports.cloudfront.removeCloudFrontFunction(module.exports.slug(`${repo}-response`, account, branch), account); } catch(e) {}
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
module.exports.fullstack = async (name, account, tags = [], credentials = [], repo, branch, framework, availability) => {
|
|
@@ -75,7 +93,7 @@ module.exports.fullstack = async (name, account, tags = [], credentials = [], re
|
|
|
75
93
|
});
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
const environment = await module.exports.elasticbeanstalk.createElasticBeanstalkEnvironment(name, account, repo, OptionSettings, CNAMEPrefix, tags);
|
|
96
|
+
const environment = await module.exports.elasticbeanstalk.createElasticBeanstalkEnvironment(name, account, {framework, availability, platform, language}, repo, OptionSettings, CNAMEPrefix, tags);
|
|
79
97
|
|
|
80
98
|
const configurations = eb.merge("configurations", {framework, availability, platform, language});
|
|
81
99
|
|
|
@@ -3,14 +3,8 @@ const { ftppass, creds } = require('../libs/vars');
|
|
|
3
3
|
const { exec } = require("child_process");
|
|
4
4
|
|
|
5
5
|
module.exports.check = async () => {
|
|
6
|
-
|
|
7
|
-
await module.exports.request(creds.egnyte.username, creds.egnyte.password, creds.egnyte.host);
|
|
6
|
+
return await module.exports.request(creds.egnyte.username, creds.egnyte.password, creds.egnyte.host) &&
|
|
8
7
|
await module.exports.request(ftppass['ftp-fishawack.egnyte.com'].username, ftppass['ftp-fishawack.egnyte.com'].password, 'ftp-fishawack.egnyte.com');
|
|
9
|
-
|
|
10
|
-
return true;
|
|
11
|
-
} catch(error) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
8
|
};
|
|
15
9
|
|
|
16
10
|
module.exports.request = async (username, password, host) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.0",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true mocha _Test/*.js --timeout 12000s --bail"
|
|
8
|
-
"preversion": "npm test",
|
|
9
|
-
"postversion": "git push && git push --tags && npm publish",
|
|
10
|
-
"postpublish": "git checkout development && git merge master && git push"
|
|
7
|
+
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true mocha _Test/*.js --timeout 12000s --bail"
|
|
11
8
|
},
|
|
12
9
|
"repository": {
|
|
13
10
|
"type": "git",
|
|
@@ -51,5 +48,36 @@
|
|
|
51
48
|
"engines": {
|
|
52
49
|
"npm": ">=8",
|
|
53
50
|
"node": ">=18"
|
|
51
|
+
},
|
|
52
|
+
"release": {
|
|
53
|
+
"plugins": [
|
|
54
|
+
[
|
|
55
|
+
"@semantic-release/commit-analyzer",
|
|
56
|
+
{
|
|
57
|
+
"preset": "conventionalcommits"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
"@semantic-release/release-notes-generator",
|
|
62
|
+
{
|
|
63
|
+
"preset": "conventionalcommits",
|
|
64
|
+
"writerOpts": {
|
|
65
|
+
"headerPartial": "### {{version}} ({{date}})\n",
|
|
66
|
+
"mainTemplate": "{{> header}}\n{{#each commitGroups}}\n\n{{#if title}}\n#### {{title}}\n\n{{/if}}\n{{#each commits}}\n{{> commit root=@root}}\n{{/each}}\n{{/each}}"
|
|
67
|
+
},
|
|
68
|
+
"presetConfig": {
|
|
69
|
+
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commits/{{hash}}"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
"@semantic-release/changelog",
|
|
75
|
+
{
|
|
76
|
+
"changelogTitle": "## Changelog"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"@semantic-release/npm",
|
|
80
|
+
"@semantic-release/git"
|
|
81
|
+
]
|
|
54
82
|
}
|
|
55
83
|
}
|
package/.gitlab-ci.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
stages:
|
|
2
|
-
- test
|
|
3
|
-
|
|
4
|
-
test:
|
|
5
|
-
stage: test
|
|
6
|
-
resource_group: test
|
|
7
|
-
coverage: '/Code coverage: \d+\.\d+/'
|
|
8
|
-
variables:
|
|
9
|
-
FW_FULL: 1
|
|
10
|
-
before_script:
|
|
11
|
-
# Remove all projects currently on runner
|
|
12
|
-
- find "/home/gitlab-runner/builds/" ! \( -type d \) -not -path "/*/0/${CI_PROJECT_PATH}/*" -not -path "/*/0/${CI_PROJECT_PATH}.tmp/*" -exec rm -rf {} +
|
|
13
|
-
# Remove all empty files now the folders are cleaned out
|
|
14
|
-
- find "/home/gitlab-runner/builds/" -type d -empty -delete
|
|
15
|
-
script:
|
|
16
|
-
# Install
|
|
17
|
-
- npm ci
|
|
18
|
-
# # Test
|
|
19
|
-
- npm test
|
|
20
|
-
after_script:
|
|
21
|
-
# Clean docker
|
|
22
|
-
- docker volume rm $(docker volume ls -q) || true
|
|
23
|
-
artifacts:
|
|
24
|
-
expire_in: 2 hrs
|
|
25
|
-
paths:
|
|
26
|
-
- coverage/
|