Skip to content

Commit

Permalink
Merge branch 'main' into feat-2582-certificat-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgarcia75 authored Nov 8, 2024
2 parents 4c98933 + c515cfd commit 6af1162
Show file tree
Hide file tree
Showing 793 changed files with 36,400 additions and 21,493 deletions.
6 changes: 2 additions & 4 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ exclude_patterns:
- "**/spec/"
- "**/test/"
- "**/tests/"
- "**/__tests__/"
- "**/*test.ts"
- "Tests/"
- "**/vendor/"
- "**/*_test.go"
- "**/*.d.ts"
- "**/snu-lib/"
- "**/*.ts"
- "snu-lib/"
- "lib/"
2 changes: 1 addition & 1 deletion .github/workflows/cc-sync-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
PG_CONN_STR: ${{ secrets.SCW_PROD_BACKEND_CONN_STR }}
PGUSER: ${{ secrets.SCW_PROD_BACKEND_USER }}
PGPASSWORD: ${{ secrets.SCW_PROD_BACKEND_PASSWORD }}
prod_directory: ./terraform/environments/production
prod_directory: ./devops/terraform/environments/production
run: |
terraform init
output=$(terraform output -json)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clean-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
echo "registry_id=$registry_id" >> $GITHUB_OUTPUT
- name: Get images
working-directory: terraform/environments/ci
working-directory: devops/terraform/environments/ci
run: |
curl -sX GET -H "X-Auth-Token: $SCW_SECRET_KEY" \
"https://api.scaleway.com/registry/v1/regions/${{ env.region }}/images?namespace_id=${{ steps.registry_id.outputs.registry_id }}&name=${{ env.image_name }}" \
Expand All @@ -88,7 +88,7 @@ jobs:
PGUSER: ${{ secrets.SCW_CI_BACKEND_USER }}
PGPASSWORD: ${{ secrets.SCW_CI_BACKEND_PASSWORD }}
project_id: 1b29c5d9-9723-400a-aa8b-0c85ae3567f7
working-directory: terraform/environments/ci
working-directory: devops/terraform/environments/ci
run: |
# Get all CI container namespaces
# the grep excludes snu-ci namespace
Expand Down
36 changes: 26 additions & 10 deletions .github/workflows/deploy-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- main

jobs:

prepare:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
Expand All @@ -31,7 +30,7 @@ jobs:

- name: Prepare
id: prepare
run : |
run: |
api_image_tag=$(git log --max-count=1 --oneline -- api packages package-lock.json | cut -d " " -f 1)
echo "api_image_tag: $api_image_tag"
echo "api_image_tag=$api_image_tag" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -74,12 +73,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
app: [
{name: api, tag: "${{needs.prepare.outputs.api_image_tag}}" },
{name: app, tag: "${{needs.prepare.outputs.app_image_tag}}" },
{name: admin, tag: "${{needs.prepare.outputs.admin_image_tag}}" },
{name: antivirus, tag: "${{needs.prepare.outputs.antivirus_image_tag}}" },
]
app:
[
{
name: api,
path: api,
tag: "${{needs.prepare.outputs.api_image_tag}}",
},
{
name: app,
path: app,
tag: "${{needs.prepare.outputs.app_image_tag}}",
},
{
name: admin,
path: admin,
tag: "${{needs.prepare.outputs.admin_image_tag}}",
},
{
name: antivirus,
path: devops/antivirus,
tag: "${{needs.prepare.outputs.antivirus_image_tag}}",
},
]

steps:
- uses: actions/checkout@v4
Expand All @@ -103,7 +119,7 @@ jobs:
password: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
registry: ${{ secrets.SCW_CI_IMAGE_REGISTRY }}
image_name: ${{ matrix.app.name }}
dockerfile_path: ${{ matrix.app.name }}/Dockerfile
dockerfile_path: ${{ matrix.app.path }}/Dockerfile
image_tag: ${{ matrix.app.tag }}
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}

Expand All @@ -119,7 +135,7 @@ jobs:
PG_CONN_STR: ${{ secrets.SCW_CI_BACKEND_CONN_STR }}
PGUSER: ${{ secrets.SCW_CI_BACKEND_USER }}
PGPASSWORD: ${{ secrets.SCW_CI_BACKEND_PASSWORD }}
ci_directory: ./terraform/environments/ci
ci_directory: ./devops/terraform/environments/ci

steps:
- uses: actions/checkout@v4
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/deploy-custom-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run_tests_api:
needs: prepare
uses: ./.github/workflows/run-tests-api.yml
uses: ./.github/workflows/run-tests-api-pr.yml
with:
branch_name: ${{ needs.prepare.outputs.branch_name }}
secrets: inherit
Expand Down Expand Up @@ -93,9 +93,21 @@ jobs:
matrix:
app:
[
{ name: api, tag: "${{needs.prepare.outputs.api_image_tag}}" },
{ name: app, tag: "${{needs.prepare.outputs.app_image_tag}}" },
{ name: admin, tag: "${{needs.prepare.outputs.admin_image_tag}}" },
{
name: api,
path: api,
tag: "${{needs.prepare.outputs.api_image_tag}}",
},
{
name: app,
path: app,
tag: "${{needs.prepare.outputs.app_image_tag}}",
},
{
name: admin,
path: admin,
tag: "${{needs.prepare.outputs.admin_image_tag}}",
},
]

steps:
Expand All @@ -120,7 +132,7 @@ jobs:
password: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
registry: ${{ secrets.SCW_CI_IMAGE_REGISTRY }}
image_name: ${{matrix.app.name}}
dockerfile_path: ${{matrix.app.name}}/Dockerfile
dockerfile_path: ${{matrix.app.path}}/Dockerfile
image_tag: ${{matrix.app.tag}}
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}

Expand All @@ -136,7 +148,7 @@ jobs:
PG_CONN_STR: ${{ secrets.SCW_CI_BACKEND_CONN_STR }}
PGUSER: ${{ secrets.SCW_CI_BACKEND_USER }}
PGPASSWORD: ${{ secrets.SCW_CI_BACKEND_PASSWORD }}
custom_directory: ./terraform/environments/ci/custom
custom_directory: ./devops/terraform/environments/ci/custom

steps:
- uses: actions/checkout@v4
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/deploy-production-hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ concurrency:
cancel-in-progress: false

env:
prod_directory: ./terraform/environments/production
staging_directory: ./terraform/environments/production/staging
prod_directory: ./devops/terraform/environments/production
staging_directory: ./devops/terraform/environments/production/staging
production_branch: "production"

jobs:
Expand Down Expand Up @@ -84,11 +84,24 @@ jobs:
matrix:
app:
[
{ name: api, tag: "${{needs.prepare.outputs.api_image_tag}}" },
{ name: app, tag: "${{needs.prepare.outputs.app_image_tag}}" },
{ name: admin, tag: "${{needs.prepare.outputs.admin_image_tag}}" },
{
name: api,
path: api,
tag: "${{needs.prepare.outputs.api_image_tag}}",
},
{
name: app,
path: app,
tag: "${{needs.prepare.outputs.app_image_tag}}",
},
{
name: admin,
path: admin,
tag: "${{needs.prepare.outputs.admin_image_tag}}",
},
{
name: antivirus,
path: devops/antivirus,
tag: "${{needs.prepare.outputs.antivirus_image_tag}}",
},
]
Expand All @@ -115,7 +128,7 @@ jobs:
password: ${{ secrets.SCW_PROD_DEPLOY_SECRET_KEY }}
registry: ${{ secrets.SCW_PROD_IMAGE_REGISTRY }}
image_name: ${{ matrix.app.name }}
dockerfile_path: ${{ matrix.app.name }}/Dockerfile
dockerfile_path: ${{ matrix.app.path }}/Dockerfile
image_tag: ${{ matrix.app.tag }}
image_tag_stable: hotfix
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ concurrency:
cancel-in-progress: false

env:
prod_directory: ./terraform/environments/production
staging_directory: ./terraform/environments/production/staging
prod_directory: ./devops/terraform/environments/production
staging_directory: ./devops/terraform/environments/production/staging
production_branch: "production"

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/destroy-custom-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
PG_CONN_STR: ${{ secrets.SCW_CI_BACKEND_CONN_STR }}
PGUSER: ${{ secrets.SCW_CI_BACKEND_USER }}
PGPASSWORD: ${{ secrets.SCW_CI_BACKEND_PASSWORD }}
custom_directory: ./terraform/environments/ci/custom
custom_directory: ./devops/terraform/environments/ci/custom

steps:
- uses: actions/checkout@v4
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/destroy-environment-wip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Destroy environment

on:
delete:
workflow_dispatch:

defaults:
run:
working-directory: devops/scripts

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"

- name: Get environment name
id: env_name
run: |
env_name=$(node get-environment-name.js ${{ github.event.ref }})
echo "env_name: $env_name"
echo "env_name=$env_name" >> $GITHUB_OUTPUT
- name: Destroy environment
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
run: node destroy-environment.js snu-custom ${{ steps.env_name.outputs.env_name }}
4 changes: 2 additions & 2 deletions .github/workflows/eslint_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
"api",
"admin",
"app",
"send-in-blue",
"devops/send-in-blue",
"packages/lib",
"knowledge-base-public",
"analytics",
"devops/analytics",
]
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mirroring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Mirroring

on:
push:
branches: [main]
branches: [production_state]

jobs:
mirror:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/run-tests-api-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: API - Run Tests

on:
workflow_dispatch:
workflow_call:
inputs:
branch_name:
required: true
type: string

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'api/**'
- 'packages/lib/**'
- name: Git checkout
if: steps.changes.outputs.src == 'true'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_name }}

- name: Node 18.x
if: steps.changes.outputs.src == 'true'
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Start MongoDB 7.0
if: steps.changes.outputs.src == 'true'
uses: supercharge/[email protected]
with:
mongodb-version: "7.0"

- uses: actions/cache@v4
id: cache-npm
with:
path: |
node_modules
api/node_modules
app/node_modules
admin/node_modules
packages/ds/node_modules
packages/lib/node_modules
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodemodules-
- name: Install packages
if: ${{ (steps.changes.outputs.src == 'true') && (steps.cache-npm.outputs.cache-hit != 'true') }}
run: npm ci

- name: Build lib
if: steps.changes.outputs.src == 'true'
working-directory: packages/lib
run: npm run build

- name: Lint code
if: steps.changes.outputs.src == 'true'
working-directory: api
run: npm run lint

- name: Test and Send coverage
if: steps.changes.outputs.src == 'true'
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CI: true
with:
workingDirectory: api
coverageCommand: npm run coverage
Loading

0 comments on commit 6af1162

Please sign in to comment.