mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-28 21:50:05 +00:00
Compare commits
13
Commits
v1.1.0-beta.2
...
v1.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e425e90eeb | ||
|
|
45f35b4e39 | ||
|
|
d450acd007 | ||
|
|
e9c1dfc320 | ||
|
|
67484cbef8 | ||
|
|
740be1d98b | ||
|
|
b9989d86c1 | ||
|
|
9b3a127f6a | ||
|
|
55028c4b83 | ||
|
|
7d5dee4b0c | ||
|
|
708bf2f585 | ||
|
|
1d53226540 | ||
|
|
5f6ae5d512 |
@@ -7,6 +7,22 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
extract_environment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
environment: ${{ steps.extract_environment.outputs.environment }}
|
||||||
|
steps:
|
||||||
|
- name: Extract Environment
|
||||||
|
run: |
|
||||||
|
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
||||||
|
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
|
||||||
|
id: extract_environment
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
@@ -70,6 +86,7 @@ jobs:
|
|||||||
- name: Configure AWS Region
|
- name: Configure AWS Region
|
||||||
if: steps.semantic.outputs.new_release_published == 'true'
|
if: steps.semantic.outputs.new_release_published == 'true'
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
id: aws
|
||||||
with:
|
with:
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
@@ -80,7 +97,7 @@ jobs:
|
|||||||
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
|
||||||
echo "##[set-output name=result;]$(echo "prd")"
|
echo "##[set-output name=result;]$(echo "prd")"
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then
|
elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then
|
||||||
echo "##[set-output name=result;]$(echo "alpha")"
|
echo "##[set-output name=result;]$(echo "dev")"
|
||||||
elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then
|
elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then
|
||||||
echo "##[set-output name=result;]$(echo "stg")"
|
echo "##[set-output name=result;]$(echo "stg")"
|
||||||
fi
|
fi
|
||||||
@@ -96,6 +113,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ steps.extract_environment.outputs.result }}
|
||||||
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
||||||
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
||||||
@@ -106,9 +124,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ steps.extract_environment.outputs.result }}
|
||||||
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
||||||
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
run: |
|
run: |
|
||||||
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
||||||
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
||||||
|
sed -i -e "s/\${ACCOUNT_ID}/$ACCOUNT_ID/g" docker-compose.yml
|
||||||
zip deploy.zip docker-compose.yml -r .ebextensions
|
zip deploy.zip docker-compose.yml -r .ebextensions
|
||||||
|
|
||||||
- name: Deploy AWS Beanstalk
|
- name: Deploy AWS Beanstalk
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
export ENV=test
|
export ENV=test
|
||||||
export IMAGE_TAG=test
|
export IMAGE_TAG=test
|
||||||
|
export ACCOUNT_ID=test
|
||||||
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
||||||
|
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
env:
|
env:
|
||||||
ENV: test
|
ENV: test
|
||||||
IMAGE_TAG: test
|
IMAGE_TAG: test
|
||||||
|
ACCOUNT_ID: test
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
export ENV=test
|
export ENV=test
|
||||||
|
|||||||
+3
-1
@@ -33,7 +33,9 @@
|
|||||||
{ "from": "main", "to": "alpha" },
|
{ "from": "main", "to": "alpha" },
|
||||||
{ "from": "main", "to": "beta" }
|
{ "from": "main", "to": "beta" }
|
||||||
],
|
],
|
||||||
"backmergeStrategy": "merge"
|
"backmergeStrategy": "merge",
|
||||||
|
"clearWorkspace": true,
|
||||||
|
"restoreWorkspace": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@semantic-release/npm",
|
"@semantic-release/npm",
|
||||||
|
|||||||
@@ -2,5 +2,3 @@
|
|||||||
<image src="./assets/maestro.svg" style="width:10rem">
|
<image src="./assets/maestro.svg" style="width:10rem">
|
||||||
<h1 align="center">Maestro</h1>
|
<h1 align="center">Maestro</h1>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
x
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
build: .
|
build: .
|
||||||
image: 468720548566.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
image: 468720548566.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
||||||
container_name: maestro
|
container_name: maestro
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -95,29 +95,31 @@ const verifyToken = async (accessToken: string) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await setUp(awsRegion, awsPoolId);
|
await setUp(awsRegion, awsPoolId);
|
||||||
if (accessToken) {
|
if (!accessToken) {
|
||||||
const user: any = decode(accessToken, { complete: true });
|
throw new UnauthorizedException();
|
||||||
|
|
||||||
if (user === null) {
|
|
||||||
throw new UnauthorizedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
const { kid } = user.header;
|
|
||||||
const pem = pems.filter((item: any) => item[kid]);
|
|
||||||
const pemValue: any = pem[0][kid];
|
|
||||||
|
|
||||||
if (!pem) {
|
|
||||||
throw new UnauthorizedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
verify(accessToken, pemValue, (err: any) => {
|
|
||||||
if (err) {
|
|
||||||
throw new UnauthorizedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user: any = decode(accessToken, { complete: true });
|
||||||
|
|
||||||
|
if (user === null) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
const { kid } = user.header;
|
||||||
|
const pem = pems.filter((item: any) => item[kid]);
|
||||||
|
const pemValue: any = pem[0][kid];
|
||||||
|
|
||||||
|
if (!pem) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
verify(accessToken, pemValue, (err: any) => {
|
||||||
|
if (err) {
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user