Skip to content

Commit

Permalink
Merge branch 'main' into lba-2111-maj-niv-diplome-par-defaut-depot-offre
Browse files Browse the repository at this point in the history
  • Loading branch information
kevbarns authored Apr 30, 2024
2 parents 1324bd2 + e8e20c2 commit b81772a
Show file tree
Hide file tree
Showing 190 changed files with 6,177 additions and 5,854 deletions.
5 changes: 3 additions & 2 deletions .infra/.env_server
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ LBA_LOG_LEVEL=info
LBA_LOG_FORMAT={{ vault[env_type].LBA_LOG_FORMAT }}
LBA_LOG_DESTINATIONS={{ vault[env_type].LBA_LOG_DESTINATIONS }}
LBA_LOG_TYPE=console
LBA_SLACK_WEBHOOK_URL={{ vault.LBA_SLACK_WEBHOOK_URL }}
LBA_JOB_SLACK_WEBHOOK={{ vault.LBA_JOB_SLACK_WEBHOOK }}
LBA_SLACK_WEBHOOK_URL={{ vault[env_type].LBA_SLACK_WEBHOOK_URL }}
LBA_JOB_SLACK_WEBHOOK={{ vault[env_type].LBA_JOB_SLACK_WEBHOOK }}
LBA_MONGODB_URI={{ vault[env_type].LBA_MONGODB_URI }}
LBA_CATALOGUE_URL=https://catalogue-apprentissage.intercariforef.org
LBA_SERVER_SENTRY_DSN={{ vault.LBA_SERVER_SENTRY_DSN }}
Expand Down Expand Up @@ -50,3 +50,4 @@ LBA_S3_BUCKET={{ vault.LBA_S3_BUCKET }}
LBA_ENTREPRISE_API_KEY={{ vault.LBA_ENTREPRISE_API_KEY }}
LBA_FRANCE_COMPETENCE_API_KEY={{ vault.LBA_FRANCE_COMPETENCE_API_KEY }}
LBA_FRANCE_COMPETENCE_TOKEN={{ vault.LBA_FRANCE_COMPETENCE_TOKEN }}
LBA_API_APPRENTISSAGE_KEY={{ vault.LBA_API_APPRENTISSAGE_KEY }}
12 changes: 3 additions & 9 deletions .infra/ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
tasks:
- include_tasks: ./tasks/files_copy.yml

- name: Création du docker-compose.yml {{env_type}}
shell:
chdir: /opt/app
cmd: 'sudo docker compose $(for file in $(ls docker-compose.*.yml); do echo -n "-f $file "; done) config -o docker-compose.yml'
register: docker_deploy_output

- name: Récupération des images docker
shell:
chdir: /opt/app
cmd: "sudo docker compose pull"
cmd: "/opt/app/tools/docker-compose.sh pull"

- name: Récupération du status de la stack
shell:
Expand Down Expand Up @@ -109,12 +103,12 @@

- name: Add cron to renew pole-emploi cert
ansible.builtin.cron:
name: "renew-certificate"
name: "renew-certificate-pe"
minute: "0"
hour: "2"
weekday: "1"
job: "bash /opt/app/tools/ssl/renew-certificate.sh {{ alias_dns_name }} >> /var/log/cron.log 2>&1; /opt/app/tools/monitoring/export-cron-status-prom.sh -c 'Renew certificate Alias' -v $?"
when: env_type != "preview"
when: env_type == "production"

- name: "Setup de la Metabase"
shell:
Expand Down
2 changes: 1 addition & 1 deletion .infra/docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ services:

metabase:
<<: *default
image: metabase/metabase:v0.49.3
image: metabase/metabase:v0.49.5
deploy:
<<: *deploy-default
resources:
Expand Down
4 changes: 2 additions & 2 deletions .infra/files/configs/mongodb/seed.gpg
Git LFS file not shown
2 changes: 1 addition & 1 deletion .infra/files/configs/reverse_proxy/system/5xx.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<img id="logo" src="/system/logo_LBA.svg" alt="logo La bonne alternance" />
<div id="center-container">
<h1>Cette page est temporairement indisponible</h1>
<img id="woman" src="/system/5xx.svg" alt="femme ne savant pas quoi faire" />
<img id="woman" src="/system/5xx.svg" alt="femme ne sachant pas quoi faire" />
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion .infra/files/scripts/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
#Needs to be run as sudo

docker compose run --rm --no-deps server yarn cli "$@"
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli "$@"
2 changes: 1 addition & 1 deletion .infra/files/scripts/migrations-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
#Needs to be run as sudo

docker compose run --rm --no-deps server yarn cli migrations:status
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli migrations:status
2 changes: 1 addition & 1 deletion .infra/files/scripts/migrations-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

run_migrations(){
echo "Application des migrations ..."
docker compose run --rm --no-deps server yarn cli migrations:up 2>&1 | tee "$LOG_FILEPATH"
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli migrations:up 2>&1 | tee "$LOG_FILEPATH"
}

run_migrations
17 changes: 17 additions & 0 deletions .infra/files/scripts/trigger_indexes_creation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
#Needs to be run as sudo

readonly LOG_DIR="/var/log/data-jobs"

if [ ! -d "$LOG_DIR" ]; then
sudo mkdir -p "$LOG_DIR"
sudo chown $(whoami):$(whoami) "$LOG_DIR"
fi

trigger_indexes_creation(){
echo "Création des index mongoDb ..."
/opt/app/tools/docker-compose.sh run --rm --no-deps server yarn cli indexes:recreate --queued
}

trigger_indexes_creation
1,216 changes: 637 additions & 579 deletions .infra/vault/vault.yml

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ fileignoreconfig:
- filename: .github/workflows/release.yml
checksum: ffd104ff02d60abf3183694209c5191a0bb7479ce37d8243778275351b4d2228
- filename: .infra/.env_server
checksum: 6558cb49387af378d27ce4f16134137df3506e001b388bf04f2153a3d74b71a5
checksum: ea90495a7b8a9ba9a34adc380228d4ad6f0336d1685488aaacd228bf3bd11e18
- filename: .infra/env.ini
checksum: 60d461050d64c0b87831d6918a8696a8dd2f69cd86b4e6d94b40c3b7b285c320
- filename: .infra/files/configs/mongodb/mongod.conf
checksum: 718bee5f44edc101636be8f11173ede5b728f2858abc3c26466ff9435f0d11de
- filename: .infra/files/configs/mongodb/seed.gpg
checksum: f3da269202d63aa1ad66b8eaa148076cf0135eec6b7fabe2394fcc3eabb466d2
checksum: 26a2a97a0624529d3f179b272edeb32959e0da5e1dd7a8854286c65c2b75143b
- filename: .infra/files/scripts/seed.sh
checksum: ddafc86248e8fd5f7c24ca5a62be703083f7704395f17fb7b43bc8e44227d561
- filename: .infra/local/mongod.conf
checksum: bb2ce0c27102259a5fa39da1fb4460af9ad6ad58adc715312e53dcd69c8e6be7
- filename: .infra/vault/vault.yml
checksum: 55b3dba68f43aeb480505c508a3a95baeb027f6699421f8642624d16ea88890c
checksum: 094824c6c1f794ece05abf61220465e1327f71d932e6eeabfbaf6f2094e5d538
- filename: docker-compose.yml
checksum: 8cdd1da6c1155f26b417a27e26311d4f00b7d8bd6c21f1f86c1c7cb3f0599e6a
- filename: server/.env.test
checksum: a5416822ec3c607557a69a8f20014de9fc40d8a871884bb79cc3906078c4ef15
checksum: 69332e43a85e702b93d00e62edf109c3b22189660de33e50e766ba15ea58f8b8
- filename: server/src/common/model/schema/_shared/mongoose-paginate.ts
checksum: b6762a7cb5df9bbee1f0ce893827f0991ad01514f7122a848b3b5d49b620f238
- filename: server/src/config.ts
Expand All @@ -54,7 +54,7 @@ fileignoreconfig:
- filename: server/src/security/accessTokenService.ts
checksum: 2183e326a88ae3c10193a7033ab5fd421ce576cd1e234c323df247da335f74d7
- filename: server/src/services/application.service.ts
checksum: d3ae58c0b6a9d42164b69dff4573734a6d854282974c4a10d065f2c2443f144a
checksum: 38021ae663db3a146c848a8d691c0c1bc9bb262a80a6f2dedf9fcdb372eef3ac
- filename: server/src/services/eligibleTrainingsForAppointment.service.ts
checksum: 52bfe91cc0cd07121cad6dc9490a7345dbbbeb285f11fc844a8dd8eb74fe310f
- filename: server/src/services/userRecruteur.service.ts
Expand Down Expand Up @@ -121,6 +121,8 @@ fileignoreconfig:
checksum: a50177afa593bae5707bdba29ef27b8f2ed0bc58487491bfff580e7e1f422243
- filename: ui/components/espace_pro/Admin/utilisateurs/infoDetails/InfoDetails.tsx
checksum: be2ad6ca5c2bd36d26cd7aebb33ab876bd32662be3735fee3b167325c284ccff
- filename: ui/components/footer.tsx
checksum: d82b5a7d6905070fb32383864566fc16eae4797ca18f82782fb32c95a0d50369
- filename: ui/pages/accessibilite.tsx
checksum: d6a7c57500f9de5e47e305f89435b21d717f505acac7b45656931f7ecdd0fcca
- filename: ui/pages/espace-pro/admin/eligible-trainings-for-appointment/search.tsx
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/create-recruiter-account-manual-validation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FlowCreationEntreprise } from "../pages/FlowCreationEntreprise"
import { JobPage } from "../pages/JobPage"
import { generateRandomString } from "../utils/generateRandomString"

describe("create-recruiter-account-siret-inexistent", () => {
it("tests create-recruiter-account-siret-inexistent", () => {
describe("create-recruiter-account-manual-validation", () => {
it("tests create-recruiter-account-manual-validation", () => {
cy.viewport(1271, 721)

const email = `cypress-manual-validation-${generateRandomString()}@mail.com`
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/create-recruiter-account.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { JobPage } from "../pages/JobPage"
import { LoginBar } from "../pages/LoginBar"
import { generateRandomString } from "../utils/generateRandomString"

describe("create-recruiter-account-siret-inexistent", () => {
it("test create-recruiter-account-siret-inexistent", () => {
describe("create-recruiter-account", () => {
it("test create-recruiter-account", () => {
cy.viewport(1271, 721)

const emailDomain = Cypress.env("ENTREPRISE_AUTOVALIDE_EMAIL_DOMAIN")
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/send-spontaneous-application.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe("send-spontaneous-application", () => {
const fakeMail = `${generateRandomString()}@beta.gouv.fr`

cy.viewport(1254, 704)

SearchForm.goToHome()
SearchForm.fillSearch({
metier: "Comptabilité, gestion de paie",
Expand Down
9 changes: 7 additions & 2 deletions cypress/pages/FlowCreationEntreprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ export const FlowCreationEntreprise = {
jobCount?: number
jobDurationInMonths: number
}) {
const typedRomeLabel = romeLabel.substring(0, romeLabel.length - 10)
cy.intercept(`${Cypress.env("server")}/api/v1/metiers/intitule?label=${encodeURI(typedRomeLabel)}`).as("romeSearch")

cy.get("[data-testid='offre-metier'] input").click()
cy.get("[data-testid='offre-metier'] input").type(romeLabel.substring(0, romeLabel.length - 10))
cy.get(`[data-testid='offre-metier'] #downshift-1-item-0 p:first-of-type`, { timeout: 10000 }).should("have.text", romeLabel)
cy.get("[data-testid='offre-metier'] input").type(typedRomeLabel)
cy.wait("@romeSearch")
// cy.get(`[data-testid='offre-metier'] #downshift-1-item-0 p:first-of-type`, { timeout: 10000 }).should("have.text", romeLabel)
cy.get(`[data-testid='offre-metier'] [data-testid='${romeLabel}']`).click()

cy.get("[data-testid='offre-job-type'] [data-testid='Apprentissage']").click()
Expand Down Expand Up @@ -84,6 +88,7 @@ export const FlowCreationEntreprise = {
},
delegationPage: {
selectCFAs(cfas: string[]) {
cy.url().should("contain", Cypress.env("ui") + "/espace-pro/creation/mise-en-relation")
;[...new Array(10)].forEach((_, index) => {
cy.get(`[data-testid='cfa-${index}'] input[type='checkbox']`).uncheck({ force: true })
})
Expand Down
27 changes: 26 additions & 1 deletion cypress/pages/FlowItemList.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
export const FlowItemList = {
lbaCompanies: {
openFirstWithEmail() {
cy.get(".resultCard.lba.hasEmail").first().click()
cy.url().should("contain", "/recherche-apprentissage?display=list")
cy.url().then((url) => {
const searchParams = new URL(url).searchParams
const romes = searchParams.get("romes")
const longitude = searchParams.get("lon")
const latitude = searchParams.get("lat")
const insee = searchParams.get("insee")
const radius = searchParams.get("radius")
const diploma = searchParams.get("diploma")
const builtParams = new URLSearchParams()
builtParams.append("romes", romes)
builtParams.append("longitude", longitude)
builtParams.append("latitude", latitude)
builtParams.append("insee", insee)
builtParams.append("radius", radius)
builtParams.append("diploma", diploma)
cy.request(`${Cypress.env("server")}/api/v1/jobs?sources=lba,matcha&caller=cypress&${builtParams.toString()}`).then((response) => {
const json = response.body
const resultWithEmail = json.lbaCompanies.results.find((result) => Boolean(result.contact.email))
if (!resultWithEmail) {
throw new Error("impossible de trouver une candidature spontanée avec un email")
}
const raisonSociale = resultWithEmail.title
cy.get(".resultCard.lba").contains(raisonSociale).click()
})
})
},
},
lbaJobs: {
Expand Down
1 change: 1 addition & 0 deletions server/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ LBA_ENTREPRISE_API_KEY=LBA_ENTREPRISE_API_KEY
PUBLIC_VERSION=0.0.0-local
LBA_FRANCE_COMPETENCE_API_KEY=LBA_FRANCE_COMPETENCE_API_KEY
LBA_FRANCE_COMPETENCE_TOKEN=LBA_FRANCE_COMPETENCE_TOKEN
LBA_API_APPRENTISSAGE_KEY=LBA_API_APPRENTISSAGE_KEY
39 changes: 8 additions & 31 deletions server/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,6 @@ program
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("recruiters:get-missing-address-detail"))

// Temporaire, one shot à executer en recette et prod
program
.command("migration:get-missing-geocoords")
.description("Récupération des geocoordonnées manquautes")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("migration:get-missing-geocoords"))

// Temporaire, one shot à executer en recette et prod
program.command("import:rome").description("import référentiel fiche metier rome v3").option("-q, --queued", "Run job asynchronously", false).action(createJobAction("import:rome"))
// Temporaire, one shot à executer en recette et prod
Expand Down Expand Up @@ -317,12 +310,6 @@ program
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("pe:offre:export"))

program
.command("validate-user")
.description("Contrôle de validation des entreprises en attente de validation")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("user:validate"))

program
.command("update-siret-infos-in-error")
.description("Remplis les données venant du SIRET pour les utilisateurs ayant eu une erreur pendant l'inscription")
Expand Down Expand Up @@ -365,12 +352,14 @@ program
.command("etablissement:invite:premium:follow-up")
.description("(Relance) Invite les établissements (via email décisionnaire) au premium (Parcoursup)")
.option("-q, --queued", "Run job asynchronously", false)
.option("-b, --bypassDate", "Run follow-up now without the 10 days waiting", false)
.action(createJobAction("etablissement:invite:premium:follow-up"))

program
.command("etablissement:invite:premium:affelnet:follow-up")
.description("(Relance) Invite les établissements (via email décisionnaire) au premium (Affelnet)")
.option("-q, --queued", "Run job asynchronously", false)
.option("-b, --bypassDate", "Run follow-up now without the 10 days waiting", false)
.action(createJobAction("etablissement:invite:premium:affelnet:follow-up"))

program
Expand Down Expand Up @@ -531,12 +520,6 @@ program
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("referentiel:rncp-romes:update"))

program
.command("fill-recruiters-raison-sociale")
.description("Remplissage des raisons sociales pour les recruiters et userRecruiters qui n'en ont pas")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("recruiters:raison-sociale:fill"))

program
.command("fix-job-expiration-date")
.description("Répare les date d'expiration d'offre qui seraient trop dans le futur")
Expand All @@ -561,18 +544,6 @@ program
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("recruiters:data-validation:fix"))

program
.command("fix-data-validation-user-recruteurs")
.description("Répare les data de la collection userrecruteurs")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("user-recruters:data-validation:fix"))

program
.command("fix-data-validation-user-recruteurs-cfa")
.description("Répare les data des userrecruteurs CFA")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("user-recruters-cfa:data-validation:fix"))

program
.command("anonymize-user-recruteurs")
.description("Anonymize les userrecruteurs qui ne se sont pas connectés depuis plus de 2 ans")
Expand All @@ -593,6 +564,12 @@ program
.requiredOption("--from-date <string>, [fromDate]", "format DD-MM-YYYY. Date depuis laquelle les prises de rendez-vous sont renvoyéees")
.action(createJobAction("prdv:emails:resend"))

program
.command("migrate-multi-compte")
.description("Migre les données vers les tables multi-compte")
.option("-q, --queued", "Run job asynchronously", false)
.action(createJobAction("migrate-multi-compte"))

export async function startCLI() {
await program.parseAsync(process.argv)
}
Loading

0 comments on commit b81772a

Please sign in to comment.