Skip to content

Commit 28e2ce2

Browse files
authored
Fix containers env and workflow cancel on push (#222)
1 parent 1b1e2f1 commit 28e2ce2

8 files changed

Lines changed: 21 additions & 10 deletions

File tree

.github/workflows/docker-build-push.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
types: [completed]
1717
branches: [staging]
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
1923
permissions:
2024
contents: read
2125
packages: write
@@ -93,11 +97,9 @@ jobs:
9397
if [[ "${{ needs.set-env.outputs.environment_name }}" == 'production' ]]; then
9498
echo "API_URL=${{ vars.API_URL_PRODUCTION }}" >> $GITHUB_OUTPUT
9599
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN_PRODUCTION }}" >> $GITHUB_OUTPUT
96-
echo "GOOGLE_FOR_JOB_KEY=${{ secrets.GOOGLE_FOR_JOB_KEY_PRODUCTION }}" >> $GITHUB_OUTPUT
97100
else
98101
echo "API_URL=${{ vars.API_URL_STAGING }}" >> $GITHUB_OUTPUT
99102
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN_STAGING }}" >> $GITHUB_OUTPUT
100-
echo "GOOGLE_FOR_JOB_KEY=${{ secrets.GOOGLE_FOR_JOB_KEY_STAGING }}" >> $GITHUB_OUTPUT
101103
fi
102104
103105
- name: Set widget-volontariat build args
@@ -135,7 +137,6 @@ jobs:
135137
${{ matrix.service == 'widget-benevolat' && format('ENV={0}', steps.widget_benevolat_args.outputs.ENV) || '' }}
136138
${{ matrix.service == 'widget-benevolat' && format('API_URL={0}', steps.widget_benevolat_args.outputs.API_URL) || '' }}
137139
${{ matrix.service == 'widget-benevolat' && format('SENTRY_DSN={0}', steps.widget_benevolat_args.outputs.SENTRY_DSN) || '' }}
138-
${{ matrix.service == 'widget-benevolat' && format('GOOGLE_FOR_JOB_KEY={0}', steps.widget_benevolat_args.outputs.GOOGLE_FOR_JOB_KEY) || '' }}
139140
140141
# Widget Volontariat variables
141142
${{ matrix.service == 'widget-volontariat' && format('ENV={0}', steps.widget_volontariat_args.outputs.ENV) || '' }}

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
push:
77
branches: [main, staging]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
lint:
1115
name: Run ESLint

.github/workflows/terraform-deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
types: [completed]
77
branches: [staging]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
workflow_dispatch:
1014
inputs:
1115
environment:

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: [main, staging]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
api-tests:
1115
name: API Tests

process/src/services/slack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ENVIRONMENT, SLACK_TOKEN } from "../config";
22

33
export const postMessage = async ({ title, text, author_name, color }: { title?: string; text: string; author_name?: string; color?: string }, channelId: string) => {
4-
if (ENVIRONMENT !== "production") {
4+
if (ENVIRONMENT !== "production" || !channelId) {
55
console.log(`[Slack] ${text}`);
66
return { ok: true };
77
}

terraform/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,17 @@ resource "scaleway_container" "process" {
138138
"ENV" = terraform.workspace
139139
"API_URL" = "https://${local.api_hostname}"
140140
"BUCKET_NAME" = local.bucket_name
141+
"SLACK_WARNING_CHANNEL_ID" = terraform.workspace == "production" ? "C052V2UF918" : "C08QQT4702D"
142+
"SLACK_LBC_CHANNEL_ID" = terraform.workspace == "production" ? "C07SPFG724V" : ""
143+
"SLACK_PRODUCT_CHANNEL_ID" = terraform.workspace == "production" ? "C019LKL5N69" : ""
144+
"SLACK_CRON_CHANNEL_ID" = terraform.workspace == "production" ? "C085S6M2K5J" : ""
141145
}
142146

143147
secret_environment_variables = {
144148
"DB_ENDPOINT" = local.secrets.DB_ENDPOINT
145149
"ES_ENDPOINT" = local.secrets.ES_ENDPOINT
146150
"PG_ENDPOINT" = local.secrets.PG_ENDPOINT
147151
"SENTRY_DSN" = local.secrets.SENTRY_DSN
148-
"SLACK_WARNING_CHANNEL_ID" = local.secrets.SLACK_WARNING_CHANNEL_ID
149152
"SCW_ACCESS_KEY" = local.secrets.SCW_ACCESS_KEY
150153
"SCW_SECRET_KEY" = local.secrets.SCW_SECRET_KEY
151154
"DATA_SUBVENTION_TOKEN" = local.secrets.DATA_SUBVENTION_TOKEN
@@ -259,7 +262,6 @@ resource "scaleway_container" "benevolat" {
259262

260263
secret_environment_variables = {
261264
"SENTRY_DSN" = local.secrets.SENTRY_DSN
262-
"GOOGLE_FOR_JOB_KEY" = local.secrets.GOOGLE_FOR_JOB_KEY
263265
}
264266
}
265267

widget-benevolat/Dockerfile.production

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ WORKDIR /app
66
ARG ENV=development
77
ARG API_URL=http://localhost:9001
88
ARG SENTRY_DSN=
9-
ARG GOOGLE_FOR_JOB_KEY=
109

1110
ENV ENV=$ENV
1211
ENV API_URL=$API_URL
1312
ENV SENTRY_DSN=$SENTRY_DSN
14-
ENV GOOGLE_FOR_JOB_KEY=$GOOGLE_FOR_JOB_KEY
1513

1614
COPY package*.json ./
1715

widget-benevolat/config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const ENV = process.env.ENV || "development";
22
const API_URL = process.env.API_URL || "http://localhost:4000";
33
const SENTRY_DSN = process.env.SENTRY_DSN || "";
4-
const GOOGLE_FOR_JOB_KEY = process.env.GOOGLE_FOR_JOB_KEY || "";
54

65
const DOMAINES = {
76
environnement: "Environnement",
@@ -25,5 +24,4 @@ module.exports = {
2524
API_URL,
2625
SENTRY_DSN,
2726
DOMAINES,
28-
GOOGLE_FOR_JOB_KEY,
2927
};

0 commit comments

Comments
 (0)