@@ -98,18 +98,6 @@ pregetdb:
9898 script:
9999 # no need to wait for a build
100100 # can be run from anywhere
101-
102- # TODO: factorise this:
103- - cp .env-ci .env
104- # TODO use copier or something to inialize this env variables
105- - echo BUILD_NAME=${BUILD_NAME} >> .env
106- - echo PGDATABASE=${BUILD_NAME} >> .env
107- - echo CI_PROJECT_NAME=${CI_PROJECT_NAME} >> .env
108- - echo "DOMAIN=${DOMAIN}" >> .env
109- # uid , gid used by docker in postgres to fix perms on .db
110- - echo "UID=`id -u`" >> .env
111- - echo "GID=`id -g`" >> .env
112-
113101 # create spare db, --detach allow the runner to continue
114102 # we don't need to build the project for that
115103 # -- profile allow us to run only this container
@@ -121,6 +109,7 @@ pregetdb:
121109 # because at the moment, we don't want to create spares for migrations branches
122110 - if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH # on default branch
123111 - if: $CI_DEFAULT_BRANCH == $CI_MERGE_REQUEST_TARGET_BRANCH_NAME # on PR targeting default branch
112+ needs: ["fetch"]
124113
125114fetch:
126115 # run once per commit
@@ -136,6 +125,7 @@ fetch:
136125 - git fetch --all
137126 - git checkout ${NEW_HEAD}
138127 - sops -d ci.secrets.docker-compose.yml > secrets.docker-compose.yml
128+ - ./bin/generate_env
139129 needs: ["prebuild"]
140130
141131build:
@@ -144,15 +134,6 @@ build:
144134 # ak build then docker build
145135 - cd ~gitlab-runner/builds/${AK_WORKING_DIR}
146136
147- - cp .env-ci .env
148- # TODO use copier or something to inialize this env variables
149- - echo BUILD_NAME=${BUILD_NAME} >> .env
150- - echo CI_PROJECT_NAME=${CI_PROJECT_NAME} >> .env
151- - echo "DOMAIN=${DOMAIN}" >> .env
152- # uid , gid used by docker in postgres to fix perms on .db
153- - echo "UID=`id -u`" >> .env
154- - echo "GID=`id -g`" >> .env
155-
156137 # ak build
157138 - cd odoo && time ak clone && time ak sparse && time ak build && cd ..
158139
@@ -308,10 +289,6 @@ test:
308289 script:
309290 - CURRENT_PATH=`pwd`
310291 - cd ~gitlab-runner/builds/${AK_WORKING_DIR}
311- - cp .env .env-test
312- - echo "ENABLE_TRAEFIK=false" >> .env-test
313- - echo "COMPOSE_PROJECT_NAME=${BUILD_NAME}_test" >> .env-test
314- - echo "PGDATABASE=${BUILD_NAME}_test" >> .env-test
315292 - docker compose --env-file .env-test kill
316293 - dropdb --force --if-exists ${BUILD_NAME}_test
317294 - docker compose --env-file .env-test run --rm odoo initdb ${BUILD_NAME}_test --cache-prefix ${CI_PROJECT_NAME:0:7}
0 commit comments