mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-29 08:50:05 +00:00
Compare commits
17
Commits
v1.6.0-beta.4
...
v1.7.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d1a54a720 | ||
|
|
8399a0e4c1 | ||
|
|
cf54cb0bc2 | ||
|
|
2344e4dba3 | ||
|
|
c1498f8f1b | ||
|
|
0b3cb581c4 | ||
|
|
97a6e05812 | ||
|
|
356d438404 | ||
|
|
cf870cff14 | ||
|
|
26c6a289eb | ||
|
|
8d27e42fcd | ||
|
|
c44e557b11 | ||
|
|
25d06ab4c5 | ||
|
|
31bb795d23 | ||
|
|
a2e25eb737 | ||
|
|
6be53bebaf | ||
|
|
bc108d43e3 |
@@ -2,37 +2,50 @@ name: Deploy
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- alpha
|
|
||||||
- beta
|
|
||||||
- main
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
environment:
|
||||||
|
description: 'Deployment environment'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- dev
|
||||||
|
- stg
|
||||||
|
- prd
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
extract_environment:
|
extract_environment:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
environment: ${{ steps.extract_environment.outputs.environment }}
|
environment: ${{ steps.extract_environment.outputs.environment }}
|
||||||
|
env:
|
||||||
|
EVENT: ${{ github.event_name }}
|
||||||
|
DEPLOY_ENV: ${{ github.event.inputs.environment }}
|
||||||
steps:
|
steps:
|
||||||
- name: Extract Environment
|
- name: Extract Environment
|
||||||
run: |
|
run: |
|
||||||
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
if [ ${EVENT} == "workflow_dispatch" ]; then
|
||||||
|
echo "##[set-output name=environment;]$(echo ${DEPLOY_ENV})"
|
||||||
|
elif [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
||||||
echo "##[set-output name=environment;]$(echo "prd")"
|
echo "##[set-output name=environment;]$(echo "prd")"
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then
|
|
||||||
echo "##[set-output name=environment;]$(echo "dev")"
|
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then
|
|
||||||
echo "##[set-output name=environment;]$(echo "stg")"
|
|
||||||
fi
|
fi
|
||||||
id: extract_environment
|
id: extract_environment
|
||||||
|
|
||||||
semantic_release:
|
semantic_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
#new_release_published: ${{ steps.semantic.outputs.last_release_version != steps.semantic.outputs.new_release_version }}
|
||||||
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
|
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
|
||||||
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
|
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
|
||||||
|
test: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }}
|
||||||
|
testt: ${{ (needs.semantic_release.outputs.new_release_published == 'true' && needs.semantic_release.outputs.new_release_version) || '1.0.0' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Semantic Release
|
- if: github.event_name != 'workflow_dispatch'
|
||||||
|
name: Semantic Release
|
||||||
uses: cycjimmy/semantic-release-action@v2
|
uses: cycjimmy/semantic-release-action@v2
|
||||||
id: semantic
|
id: semantic
|
||||||
with:
|
with:
|
||||||
@@ -41,77 +54,58 @@ jobs:
|
|||||||
conventional-changelog-eslint
|
conventional-changelog-eslint
|
||||||
branches: |
|
branches: |
|
||||||
[
|
[
|
||||||
'main',
|
'main'
|
||||||
{
|
|
||||||
name: 'alpha',
|
|
||||||
prerelease: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'beta',
|
|
||||||
prerelease: true
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
if: ${{ (github.event_name != 'workflow_dispatch' && needs.semantic_release.outputs.new_release_published == 'true') || 'true' }}
|
||||||
needs: [extract_environment, semantic_release]
|
needs: [extract_environment, semantic_release]
|
||||||
runs-on: [self-hosted, "${{ needs.extract_environment.outputs.environment }}"]
|
runs-on:
|
||||||
|
[self-hosted, '${{ needs.extract_environment.outputs.environment }}']
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: print
|
||||||
|
env:
|
||||||
|
EVENT: ${{ github.event_name }}
|
||||||
|
IMAGE_TAG: ${{ needs.semantic_release.outputs.test }}
|
||||||
|
IMAGE_TAGG: ${{ needs.semantic_release.outputs.testT }}
|
||||||
|
run: echo ${IMAGE_TAG} ${IMAGE_TAGG} ${EVENT}
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Update Pip
|
- name: Update Pip
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
- name: Install Docker Compose
|
- name: Install Docker Compose
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install docker-compose --upgrade
|
python3 -m pip install docker-compose --upgrade
|
||||||
|
|
||||||
- name: Install AWS CLI
|
- name: Install AWS CLI
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install awscli --upgrade
|
python3 -m pip install awscli --upgrade
|
||||||
|
|
||||||
- name: Install AWS Elastic Beanstalk CLI
|
- name: Install AWS Elastic Beanstalk CLI
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install awsebcli --upgrade
|
python3 -m pip install awsebcli --upgrade
|
||||||
|
|
||||||
- name: Configure AWS Region
|
- name: Configure AWS Region
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
id: aws
|
id: aws
|
||||||
with:
|
with:
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
- name: Extract Environment
|
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
|
||||||
echo "##[set-output name=result;]$(echo "prd")"
|
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then
|
|
||||||
echo "##[set-output name=result;]$(echo "dev")"
|
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then
|
|
||||||
echo "##[set-output name=result;]$(echo "stg")"
|
|
||||||
fi
|
|
||||||
id: extract_environment
|
|
||||||
|
|
||||||
- name: Login to AWS ECR
|
- name: Login to AWS ECR
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
id: login_ecr
|
id: login_ecr
|
||||||
uses: aws-actions/amazon-ecr-login@v1
|
uses: aws-actions/amazon-ecr-login@v1
|
||||||
|
|
||||||
- name: Build, Tag, and Push Image to AWS ECR
|
- name: Build, Tag, and Push Image to AWS ECR
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
||||||
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
@@ -120,9 +114,8 @@ jobs:
|
|||||||
docker-compose -f build.docker-compose.yml push
|
docker-compose -f build.docker-compose.yml push
|
||||||
|
|
||||||
- name: Create ZIP file to Deploy AWS Beanstalk
|
- name: Create ZIP file to Deploy AWS Beanstalk
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
||||||
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
run: |
|
run: |
|
||||||
@@ -132,11 +125,10 @@ jobs:
|
|||||||
zip deploy.zip docker-compose.yml -r .ebextensions
|
zip deploy.zip docker-compose.yml -r .ebextensions
|
||||||
|
|
||||||
- name: Deploy AWS Beanstalk
|
- name: Deploy AWS Beanstalk
|
||||||
if: needs.semantic_release.outputs.new_release_published == 'true'
|
|
||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
AWS_REGION: us-east-1
|
AWS_REGION: us-east-1
|
||||||
APP_NAME: maestro
|
APP_NAME: ${{ github.event.repository.name }}
|
||||||
run: |
|
run: |
|
||||||
eb use $APP_NAME-$ENV
|
eb use $APP_NAME-$ENV
|
||||||
echo -e "deploy:\n artifact: deploy.zip" >> .elasticbeanstalk/config.yml
|
echo -e "deploy:\n artifact: deploy.zip" >> .elasticbeanstalk/config.yml
|
||||||
+1
-1
@@ -29,7 +29,7 @@ lerna-debug.log*
|
|||||||
|
|
||||||
# IDE - VSCode
|
# IDE - VSCode
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
#!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|||||||
Generated
+16171
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"@nestjs/platform-express": "^8.4.3",
|
"@nestjs/platform-express": "^8.4.3",
|
||||||
"@nestjs/schedule": "^1.1.0",
|
"@nestjs/schedule": "^1.1.0",
|
||||||
"@nestjs/swagger": "^5.2.1",
|
"@nestjs/swagger": "^5.2.1",
|
||||||
"@victorradael/protospack": "^2.3.0",
|
"@victorradael/protospack": "2.3.0",
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.25.0",
|
||||||
"dotenv": "^14.2.0",
|
"dotenv": "^14.2.0",
|
||||||
"helmet": "^5.0.2",
|
"helmet": "^5.0.2",
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ export class AuthClient {
|
|||||||
options: {
|
options: {
|
||||||
url: process.env.DUC_URL,
|
url: process.env.DUC_URL,
|
||||||
package: DucPackages,
|
package: DucPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: process.env.LOCAL_ENV
|
||||||
|
? undefined
|
||||||
|
: credentials.createSsl(),
|
||||||
protoPath: DucProtoFilePath,
|
protoPath: DucProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ export class InputsClientConfiguration {
|
|||||||
options: {
|
options: {
|
||||||
url: process.env.INFACTORY_URL,
|
url: process.env.INFACTORY_URL,
|
||||||
package: InputPackages,
|
package: InputPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: process.env.LOCAL_ENV
|
||||||
|
? undefined
|
||||||
|
: credentials.createSsl(),
|
||||||
protoPath: InputProtoFilePath,
|
protoPath: InputProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { OnModuleInit, Inject } from '@nestjs/common';
|
import { OnModuleInit, Inject } from '@nestjs/common';
|
||||||
import { ClientGrpc } from '@nestjs/microservices';
|
import { ClientGrpc } from '@nestjs/microservices';
|
||||||
import {
|
import {
|
||||||
|
InputCreateResponse,
|
||||||
InputCreateS3Request,
|
InputCreateS3Request,
|
||||||
InputNewCreateRequest,
|
InputNewCreateRequest,
|
||||||
InputService,
|
InputService,
|
||||||
@@ -42,11 +43,9 @@ export class InputsClientService implements OnModuleInit {
|
|||||||
console.log('done');
|
console.log('done');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
}).catch((err) => {
|
||||||
.then((res) => res)
|
throw new Error(err);
|
||||||
.catch((err) => {
|
});
|
||||||
throw new Error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
return createInputResponse;
|
return createInputResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ export class OutputsClientConfiguration {
|
|||||||
options: {
|
options: {
|
||||||
url: process.env.OTFACTORY_URL,
|
url: process.env.OTFACTORY_URL,
|
||||||
package: OutputPackages,
|
package: OutputPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: process.env.LOCAL_ENV
|
||||||
|
? undefined
|
||||||
|
: credentials.createSsl(),
|
||||||
protoPath: OutputProtoFilePath,
|
protoPath: OutputProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ export class PipelinesClientConfiguration {
|
|||||||
options: {
|
options: {
|
||||||
url: process.env.PIFACTORY_URL,
|
url: process.env.PIFACTORY_URL,
|
||||||
package: PipelinePackages,
|
package: PipelinePackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: process.env.LOCAL_ENV
|
||||||
|
? undefined
|
||||||
|
: credentials.createSsl(),
|
||||||
protoPath: PipelineProtoFilePath,
|
protoPath: PipelineProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
const findAllPipelineResponse = await new Promise((resolve, reject) => {
|
const findAllPipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService.FindAll(objectSnakeToCamel(data)).subscribe({
|
this.pipelineService.FindAll(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x.pipelines);
|
||||||
},
|
},
|
||||||
error(err) {
|
error(err) {
|
||||||
console.log('Observable Error');
|
console.log('Observable Error');
|
||||||
|
|||||||
@@ -14,10 +14,18 @@ export class InputsService {
|
|||||||
data.plugin == 'json' ||
|
data.plugin == 'json' ||
|
||||||
data.plugin == 'parquet'
|
data.plugin == 'parquet'
|
||||||
) {
|
) {
|
||||||
const createInputResponse = await this.inputClient.createS3Inputs(data);
|
const { info, ...input } = data;
|
||||||
|
const inputPayload = this.generateInputS3Payload(input);
|
||||||
|
const createInputResponse = await this.inputClient.createS3Inputs({
|
||||||
|
input: inputPayload,
|
||||||
|
info,
|
||||||
|
});
|
||||||
return createInputResponse;
|
return createInputResponse;
|
||||||
} else {
|
} else {
|
||||||
const createInputResponse = await this.inputClient.create(data);
|
const createInputResponse: any = await this.inputClient.create(data);
|
||||||
|
if (createInputResponse?.input?.input_jdbc) {
|
||||||
|
return { input: createInputResponse?.input?.input_jdbc };
|
||||||
|
}
|
||||||
return createInputResponse;
|
return createInputResponse;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -91,4 +99,29 @@ export class InputsService {
|
|||||||
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateInputS3Payload(payload) {
|
||||||
|
const { credentials, plugin } = payload;
|
||||||
|
if (!credentials) return payload;
|
||||||
|
|
||||||
|
const {
|
||||||
|
client_aws_access_key_id,
|
||||||
|
client_aws_secret_access_key,
|
||||||
|
file_format_params,
|
||||||
|
format_file_params,
|
||||||
|
client_bucket,
|
||||||
|
file_to_extract,
|
||||||
|
} = credentials;
|
||||||
|
const formatedPayload = {
|
||||||
|
plugin,
|
||||||
|
source_bucket: client_bucket,
|
||||||
|
source_prefix: file_to_extract,
|
||||||
|
auth_parameters: {
|
||||||
|
aws_access_key_id: client_aws_access_key_id,
|
||||||
|
aws_secret_access_key: client_aws_secret_access_key,
|
||||||
|
},
|
||||||
|
file_format_params: file_format_params || format_file_params,
|
||||||
|
};
|
||||||
|
return formatedPayload;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class PipelinesService {
|
|||||||
constructor(private pipelineClient: PipelinesClientService) {}
|
constructor(private pipelineClient: PipelinesClientService) {}
|
||||||
|
|
||||||
adjustPayload(payload) {
|
adjustPayload(payload) {
|
||||||
payload.input = payload.input.input_s3 || payload.input.input_jdbc;
|
payload.input = payload.input?.input_s3 || payload.input?.input_jdbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(createPipelineDto) {
|
async create(createPipelineDto) {
|
||||||
@@ -18,7 +18,7 @@ export class PipelinesService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const pipeline = objectCamelToSnake(createPipelineResponse);
|
const pipeline = objectCamelToSnake(createPipelineResponse);
|
||||||
this.adjustPayload(pipeline);
|
this.adjustPayload(pipeline.pipeline);
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -32,7 +32,7 @@ export class PipelinesService {
|
|||||||
const findOnePipelineResponse = await this.pipelineClient.findOne(data);
|
const findOnePipelineResponse = await this.pipelineClient.findOne(data);
|
||||||
|
|
||||||
const pipeline = objectCamelToSnake(findOnePipelineResponse);
|
const pipeline = objectCamelToSnake(findOnePipelineResponse);
|
||||||
this.adjustPayload(pipeline);
|
this.adjustPayload(pipeline.pipeline);
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -48,7 +48,7 @@ export class PipelinesService {
|
|||||||
pipelines.forEach((pipeline) => {
|
pipelines.forEach((pipeline) => {
|
||||||
this.adjustPayload(pipeline);
|
this.adjustPayload(pipeline);
|
||||||
});
|
});
|
||||||
return pipelines;
|
return { pipelines };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user