Merge branch 'alpha' into ft-int-duc

This commit is contained in:
Rodrigo Zamboni
2022-03-24 11:48:55 -03:00
committed by GitHub
8 changed files with 104 additions and 101 deletions
+76 -85
View File
@@ -9,93 +9,85 @@ on:
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
semantic_version: 16
extra_plugins: |
@saithodev/semantic-release-backmerge
conventional-changelog-eslint
branches: |
[
'main',
{
name: 'alpha',
prerelease: true
},
{
name: 'beta',
prerelease: true
}
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Because Semantic Realese deleted the .npmrc file, it was necessary to insert two steps to backup the file.
- name: BKP .npmrc Step 1
run: |
cp .npmrc .npmrcbkp
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
semantic_version: 16
extra_plugins: |
@saithodev/semantic-release-backmerge
conventional-changelog-eslint
branches: |
[
'main',
{
name: 'alpha',
prerelease: true
},
{
name: 'beta',
prerelease: true
}
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update Pip
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install --upgrade pip
# Because Semantic Realese deleted the .npmrc file, it was necessary to insert two steps to backup the file.
- name: BKP .npmrc Step 2
run: |
cp .npmrcbkp .npmrc
- name: Update Pip
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install --upgrade pip
ls -a
- name: Install Docker Compose
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install docker-compose --upgrade
ls -a
- name: Install AWS CLI
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install awscli --upgrade
ls -a
- name: Install AWS Elastic Beanstalk CLI
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install awsebcli --upgrade
ls -a
- name: Configure AWS Region
if: steps.semantic.outputs.new_release_published == 'true'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
- name: Install Docker Compose
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install docker-compose --upgrade
- name: Extract Environment
if: steps.semantic.outputs.new_release_published == 'true'
shell: bash
run: |
ls -a
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
echo "##[set-output name=result;]$(echo "production")"
else
echo "##[set-output name=result;]$(echo ${GITHUB_REF#refs/heads/})"
fi
id: extract_environment
- name: Install AWS CLI
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install awscli --upgrade
- name: Install AWS Elastic Beanstalk CLI
if: steps.semantic.outputs.new_release_published == 'true'
run: |
python3 -m pip install awsebcli --upgrade
- name: Configure AWS Region
if: steps.semantic.outputs.new_release_published == 'true'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
- name: Extract Environment
if: steps.semantic.outputs.new_release_published == 'true'
shell: bash
run: |
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
echo "##[set-output name=result;]$(echo "production")"
else
echo "##[set-output name=result;]$(echo ${GITHUB_REF#refs/heads/})"
fi
id: extract_environment
- name: Login to AWS ECR
if: steps.semantic.outputs.new_release_published == 'true'
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push Image to AWS ECR
if: steps.semantic.outputs.new_release_published == 'true'
env:
ENV: ${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
run: |
docker-compose -f build.docker-compose.yml build
docker-compose -f build.docker-compose.yml push
- name: Create ZIP file to Deploy AWS Beanstalk
if: steps.semantic.outputs.new_release_published == 'true'
env:
ENV: ${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
run: |
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
zip deploy.zip docker-compose.yml
- name: Login to AWS ECR
if: steps.semantic.outputs.new_release_published == 'true'
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Deploy AWS Beanstalk
if: steps.semantic.outputs.new_release_published == 'true'
@@ -104,8 +96,6 @@ jobs:
AWS_REGION: us-east-1
APP_NAME: maestro
run: |
[[ -d .elasticbeanstalk/ ]] && rm -R .elasticbeanstalk/
printf "1\nn" | eb init $APP_NAME --region $AWS_REGION
eb use $APP_NAME-$ENV
echo -e "deploy:\n artifact: deploy.zip" >> .elasticbeanstalk/config.yml
eb deploy
@@ -114,4 +104,5 @@ jobs:
continue-on-error: true
run: |
docker system prune
docker rmi -f $(docker images -aq)
docker rmi -f $(docker images -aq)
+6 -4
View File
@@ -16,19 +16,21 @@ jobs:
- name: Install Docker Compose
run: |
python3 -m pip install docker-compose --upgrade
- name: Build
env:
ENV: test
IMAGE_TAG: test
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
export ENV=test
docker-compose -f build.docker-compose.yml build
export IMAGE_TAG=test
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
- name: Run Test
env:
ENV: test
IMAGE_TAG: test
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
export ENV=test
docker-compose run --rm --entrypoint="npm run test" maestro
export IMAGE_TAG=test
docker-compose -f build.docker-compose.yml run -e NPM_TOKEN=${NPM_TOKEN} --rm --entrypoint="npm run test" maestro
+4 -1
View File
@@ -29,7 +29,10 @@
[
"@saithodev/semantic-release-backmerge",
{
"branches": ["alpha", "beta"],
"branches": [
{ "from": "main", "to": "alpha" },
{ "from": "main", "to": "beta" }
],
"backmergeStrategy": "merge"
}
],
+7 -3
View File
@@ -1,12 +1,16 @@
FROM node:14 as packages
FROM node:14.15.4-alpine3.12 as packages
WORKDIR /packages
ARG NPM_TOKEN
COPY package.json .
COPY .npmrc .
RUN npm install
RUN rm -f ./.npmrc
FROM node:alpine
FROM node:14.15.4-alpine3.12
WORKDIR /app
COPY . /app/
ARG NPM_TOKEN
COPY --from=packages /packages/node_modules /app/node_modules
RUN npm run build
EXPOSE 3333
ENTRYPOINT npm run start
ENTRYPOINT npm run start
+2
View File
@@ -6,6 +6,8 @@ services:
restart: always
ports:
- 3333:3333
env_file:
- .env
node_exporter:
image: prom/node-exporter:v1.3.1
+7 -7
View File
@@ -10781,12 +10781,12 @@
}
},
"@nestjs/config": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nestjs/config/-/config-1.2.0.tgz",
"integrity": "sha512-GGZOj2g6EMZ23orsQqeD2Vs5E2ZrmAiB0qCGvERv+5nQmZjY4nKkisG4awQsym1uotmmzgtsd9lOiKqTIFONhA==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@nestjs/config/-/config-1.2.1.tgz",
"integrity": "sha512-EgaGTXvG4unD5lGWmdSrUFrkGpX32lQGE/8qS60EnL82sIZV7HT1ZL7ib5S86P1nB+DnFDbDhDqTaZ3mivTyOg==",
"requires": {
"dotenv": "16.0.0",
"dotenv-expand": "8.0.1",
"dotenv-expand": "5.1.0",
"lodash": "4.17.21",
"uuid": "8.3.2"
},
@@ -12678,9 +12678,9 @@
"integrity": "sha512-vwEppIphpFdvaMCaHfCEv9IgwcxMljMw2TnAQBB4VWPvzXQLTb82jwmdOKzlEVUL3gNFT4l4TPKO+Bn+sqcrVQ=="
},
"dotenv-expand": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-8.0.1.tgz",
"integrity": "sha512-j/Ih7bIERDR5PzI89Zu8ayd3tXZ6E3dbY0ljQ9Db0K87qBO8zdLsi2dIvDHMWtjC3Yxb8XixOTHAtia0fDHRpg=="
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz",
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA=="
},
"ecdsa-sig-formatter": {
"version": "1.0.11",
+1 -1
View File
@@ -24,7 +24,7 @@
"@grpc/grpc-js": "^1.5.7",
"@grpc/proto-loader": "^0.6.9",
"@nestjs/common": "^8.4.0",
"@nestjs/config": "^1.2.0",
"@nestjs/config": "^1.2.1",
"@nestjs/core": "^8.4.0",
"@nestjs/mapped-types": "*",
"@nestjs/microservices": "^8.4.0",
+1
View File
@@ -3,6 +3,7 @@ import { Injectable } from '@nestjs/common';
@Injectable()
export class HealthService {
check() {
console.log('HEALTH');
return { message: 'Ok' };
}
}