Skip to content

Commit 8bef1f7

Browse files
committed
[#1918] Updated CI config to export and restore exported codebase only for artifact deployment.
1 parent 1a6706c commit 8bef1f7

File tree

12 files changed

+91
-21
lines changed

12 files changed

+91
-21
lines changed

.circleci/config.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ aliases:
8282
# Change to 'large' for faster builds.
8383
resource_class: medium
8484

85-
# Set up remote Docker.
8685
- &step_setup_remote_docker
8786
setup_remote_docker:
8887
# Docker Layer Caching allows to significantly speed up builds by caching
@@ -91,14 +90,18 @@ aliases:
9190
docker_layer_caching: false
9291
version: default
9392

94-
# Process the codebase to be run in CI environment.
9593
- &step_process_codebase_for_ci
9694
run:
9795
name: Process codebase to run in CI
9896
command: |
9997
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
10098
mkdir -p /tmp/workspace/code
10199
100+
- &load_variables_from_dotenv
101+
run:
102+
name: Load environment variables from .env file
103+
# Load variables from .env file, respecting existing values, and make them available for the next steps.
104+
command: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && export -p >> "$BASH_ENV"
102105

103106
################################################################################
104107
# PARAMETERS
@@ -133,6 +136,7 @@ jobs:
133136

134137
- checkout
135138
- *step_process_codebase_for_ci
139+
- *load_variables_from_dotenv
136140
- *step_setup_remote_docker
137141

138142
- run:
@@ -214,6 +218,7 @@ jobs:
214218

215219
- checkout
216220
- *step_process_codebase_for_ci
221+
- *load_variables_from_dotenv
217222

218223
- run:
219224
name: Validate Composer configuration
@@ -262,6 +267,7 @@ jobs:
262267
- run:
263268
name: Export built codebase
264269
command: |
270+
echo "${VORTEX_DEPLOY_TYPES:-}" | grep -vq "artifact" && exit 0 || true
265271
mkdir -p "/tmp/workspace/code"
266272
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
267273
du -sh "/tmp/workspace/code"
@@ -398,6 +404,7 @@ jobs:
398404

399405
- checkout
400406
- *step_process_codebase_for_ci
407+
- *load_variables_from_dotenv
401408

402409
- run:
403410
name: Deploy
@@ -424,6 +431,7 @@ jobs:
424431

425432
- checkout
426433
- *step_process_codebase_for_ci
434+
- *load_variables_from_dotenv
427435

428436
- run:
429437
name: Deploy
@@ -495,6 +503,7 @@ jobs:
495503
steps:
496504
- checkout
497505
- *step_process_codebase_for_ci
506+
- *load_variables_from_dotenv
498507
- *step_setup_remote_docker
499508

500509
- run:

.github/workflows/build-test-deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ jobs:
199199
- name: Process the codebase to run in CI
200200
run: find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e '/###/d' {} && sed -i -e 's/##//' {}"
201201

202+
- name: Load environment variables from .env
203+
run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"
204+
202205
- name: Validate Composer configuration
203206
run: composer validate --strict
204207
continue-on-error: ${{ vars.VORTEX_CI_COMPOSER_VALIDATE_IGNORE_FAILURE == '1' }}
@@ -248,7 +251,7 @@ jobs:
248251
run: docker compose up -d
249252

250253
- name: Export built codebase
251-
if: matrix.instance == 0
254+
if: matrix.instance == 0 && contains(env.VORTEX_DEPLOY_TYPES, 'artifact')
252255
run: |
253256
mkdir -p "/tmp/workspace/code"
254257
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
@@ -362,7 +365,7 @@ jobs:
362365

363366
- name: Upload exported codebase as artifact
364367
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
365-
if: ${{ matrix.instance == 0 && !startsWith(github.head_ref || github.ref_name, 'deps/') }}
368+
if: ${{ matrix.instance == 0 && !startsWith(github.head_ref || github.ref_name, 'deps/') && contains(env.VORTEX_DEPLOY_TYPES, 'artifact') }}
366369
with:
367370
name: code-artifact
368371
path: "/tmp/workspace/code"
@@ -407,8 +410,12 @@ jobs:
407410
persist-credentials: false
408411
ref: ${{ github.head_ref || github.ref_name }}
409412

413+
- name: Load environment variables from .env
414+
run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"
415+
410416
- name: Download exported codebase as an artifact
411417
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
418+
if: ${{ contains(env.VORTEX_DEPLOY_TYPES, 'artifact') }}
412419
with:
413420
name: code-artifact
414421
path: "/tmp/workspace/code"

.github/workflows/vortex-test-common.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,5 +273,5 @@ jobs:
273273
continue-on-error: ${{ vars.VORTEX_CI_YAMLLINT_IGNORE_FAILURE == '1' }}
274274

275275
- name: Check coding standards with actionlint
276-
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.7.2 -ignore 'SC2002:' -ignore 'SC2155:' -ignore 'SC2015:' -ignore 'SC2046:'
276+
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.7.2 -ignore 'SC2002:' -ignore 'SC2155:' -ignore 'SC2015:' -ignore 'SC2046:' -ignore 'SC1090:'
277277
continue-on-error: ${{ vars.VORTEX_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}

.vortex/installer/tests/Fixtures/install/_baseline/.github/workflows/build-test-deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ jobs:
188188
- name: Process the codebase to run in CI
189189
run: find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e '/###/d' {} && sed -i -e 's/##//' {}"
190190

191+
- name: Load environment variables from .env
192+
run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"
193+
191194
- name: Validate Composer configuration
192195
run: composer validate --strict
193196
continue-on-error: ${{ vars.VORTEX_CI_COMPOSER_VALIDATE_IGNORE_FAILURE == '1' }}
@@ -235,7 +238,7 @@ jobs:
235238
run: docker compose up -d
236239

237240
- name: Export built codebase
238-
if: matrix.instance == 0
241+
if: matrix.instance == 0 && contains(env.VORTEX_DEPLOY_TYPES, 'artifact')
239242
run: |
240243
mkdir -p "/tmp/workspace/code"
241244
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
@@ -347,7 +350,7 @@ jobs:
347350

348351
- name: Upload exported codebase as artifact
349352
uses: actions/upload-artifact@__HASH__ # __VERSION__
350-
if: ${{ matrix.instance == 0 && !startsWith(github.head_ref || github.ref_name, 'deps/') }}
353+
if: ${{ matrix.instance == 0 && !startsWith(github.head_ref || github.ref_name, 'deps/') && contains(env.VORTEX_DEPLOY_TYPES, 'artifact') }}
351354
with:
352355
name: code-artifact
353356
path: "/tmp/workspace/code"
@@ -389,8 +392,12 @@ jobs:
389392
persist-credentials: false
390393
ref: ${{ github.head_ref || github.ref_name }}
391394

395+
- name: Load environment variables from .env
396+
run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"
397+
392398
- name: Download exported codebase as an artifact
393399
uses: actions/download-artifact@__HASH__ # __VERSION__
400+
if: ${{ contains(env.VORTEX_DEPLOY_TYPES, 'artifact') }}
394401
with:
395402
name: code-artifact
396403
path: "/tmp/workspace/code"

.vortex/installer/tests/Fixtures/install/ciprovider_circleci/.circleci/config.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ aliases:
7171
# Change to 'large' for faster builds.
7272
resource_class: medium
7373

74-
# Set up remote Docker.
7574
- &step_setup_remote_docker
7675
setup_remote_docker:
7776
# Docker Layer Caching allows to significantly speed up builds by caching
@@ -80,14 +79,19 @@ aliases:
8079
docker_layer_caching: false
8180
version: default
8281

83-
# Process the codebase to be run in CI environment.
8482
- &step_process_codebase_for_ci
8583
run:
8684
name: Process codebase to run in CI
8785
command: |
8886
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
8987
mkdir -p /tmp/workspace/code
9088
89+
- &load_variables_from_dotenv
90+
run:
91+
name: Load environment variables from .env file
92+
# Load variables from .env file, respecting existing values, and make them available for the next steps.
93+
command: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && export -p >> "$BASH_ENV"
94+
9195
################################################################################
9296
# PARAMETERS
9397
################################################################################
@@ -120,6 +124,7 @@ jobs:
120124

121125
- checkout
122126
- *step_process_codebase_for_ci
127+
- *load_variables_from_dotenv
123128
- *step_setup_remote_docker
124129

125130
- run:
@@ -200,6 +205,7 @@ jobs:
200205

201206
- checkout
202207
- *step_process_codebase_for_ci
208+
- *load_variables_from_dotenv
203209

204210
- run:
205211
name: Validate Composer configuration
@@ -246,6 +252,7 @@ jobs:
246252
- run:
247253
name: Export built codebase
248254
command: |
255+
echo "${VORTEX_DEPLOY_TYPES:-}" | grep -vq "artifact" && exit 0 || true
249256
mkdir -p "/tmp/workspace/code"
250257
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
251258
du -sh "/tmp/workspace/code"
@@ -379,6 +386,7 @@ jobs:
379386

380387
- checkout
381388
- *step_process_codebase_for_ci
389+
- *load_variables_from_dotenv
382390

383391
- run:
384392
name: Deploy
@@ -405,6 +413,7 @@ jobs:
405413

406414
- checkout
407415
- *step_process_codebase_for_ci
416+
- *load_variables_from_dotenv
408417

409418
- run:
410419
name: Deploy

.vortex/installer/tests/Fixtures/install/deploy_type_all_circleci/.circleci/config.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ aliases:
7171
# Change to 'large' for faster builds.
7272
resource_class: medium
7373

74-
# Set up remote Docker.
7574
- &step_setup_remote_docker
7675
setup_remote_docker:
7776
# Docker Layer Caching allows to significantly speed up builds by caching
@@ -80,14 +79,19 @@ aliases:
8079
docker_layer_caching: false
8180
version: default
8281

83-
# Process the codebase to be run in CI environment.
8482
- &step_process_codebase_for_ci
8583
run:
8684
name: Process codebase to run in CI
8785
command: |
8886
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
8987
mkdir -p /tmp/workspace/code
9088
89+
- &load_variables_from_dotenv
90+
run:
91+
name: Load environment variables from .env file
92+
# Load variables from .env file, respecting existing values, and make them available for the next steps.
93+
command: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && export -p >> "$BASH_ENV"
94+
9195
################################################################################
9296
# PARAMETERS
9397
################################################################################
@@ -120,6 +124,7 @@ jobs:
120124

121125
- checkout
122126
- *step_process_codebase_for_ci
127+
- *load_variables_from_dotenv
123128
- *step_setup_remote_docker
124129

125130
- run:
@@ -200,6 +205,7 @@ jobs:
200205

201206
- checkout
202207
- *step_process_codebase_for_ci
208+
- *load_variables_from_dotenv
203209

204210
- run:
205211
name: Validate Composer configuration
@@ -246,6 +252,7 @@ jobs:
246252
- run:
247253
name: Export built codebase
248254
command: |
255+
echo "${VORTEX_DEPLOY_TYPES:-}" | grep -vq "artifact" && exit 0 || true
249256
mkdir -p "/tmp/workspace/code"
250257
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
251258
du -sh "/tmp/workspace/code"
@@ -379,6 +386,7 @@ jobs:
379386

380387
- checkout
381388
- *step_process_codebase_for_ci
389+
- *load_variables_from_dotenv
382390

383391
- run:
384392
name: Deploy
@@ -405,6 +413,7 @@ jobs:
405413

406414
- checkout
407415
- *step_process_codebase_for_ci
416+
- *load_variables_from_dotenv
408417

409418
- run:
410419
name: Deploy

.vortex/installer/tests/Fixtures/install/deploy_type_none_circleci/.circleci/config.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ aliases:
7171
# Change to 'large' for faster builds.
7272
resource_class: medium
7373

74-
# Set up remote Docker.
7574
- &step_setup_remote_docker
7675
setup_remote_docker:
7776
# Docker Layer Caching allows to significantly speed up builds by caching
@@ -80,14 +79,19 @@ aliases:
8079
docker_layer_caching: false
8180
version: default
8281

83-
# Process the codebase to be run in CI environment.
8482
- &step_process_codebase_for_ci
8583
run:
8684
name: Process codebase to run in CI
8785
command: |
8886
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
8987
mkdir -p /tmp/workspace/code
9088
89+
- &load_variables_from_dotenv
90+
run:
91+
name: Load environment variables from .env file
92+
# Load variables from .env file, respecting existing values, and make them available for the next steps.
93+
command: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && export -p >> "$BASH_ENV"
94+
9195
################################################################################
9296
# PARAMETERS
9397
################################################################################
@@ -120,6 +124,7 @@ jobs:
120124

121125
- checkout
122126
- *step_process_codebase_for_ci
127+
- *load_variables_from_dotenv
123128
- *step_setup_remote_docker
124129

125130
- run:
@@ -200,6 +205,7 @@ jobs:
200205

201206
- checkout
202207
- *step_process_codebase_for_ci
208+
- *load_variables_from_dotenv
203209

204210
- run:
205211
name: Validate Composer configuration
@@ -246,6 +252,7 @@ jobs:
246252
- run:
247253
name: Export built codebase
248254
command: |
255+
echo "${VORTEX_DEPLOY_TYPES:-}" | grep -vq "artifact" && exit 0 || true
249256
mkdir -p "/tmp/workspace/code"
250257
docker compose cp -L cli:"/app/." "/tmp/workspace/code"
251258
du -sh "/tmp/workspace/code"

.vortex/installer/tests/Fixtures/install/deploy_type_none_gha/.github/workflows/build-test-deploy.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@@ -361,61 +361,3 @@
1+
@@ -364,65 +364,3 @@
22
timeout-minutes: 120 # Cancel the action after 15 minutes, regardless of whether a connection has been established.
33
with:
44
detached: true
@@ -30,8 +30,12 @@
3030
- persist-credentials: false
3131
- ref: ${{ github.head_ref || github.ref_name }}
3232
-
33+
- - name: Load environment variables from .env
34+
- run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"
35+
-
3336
- - name: Download exported codebase as an artifact
3437
- uses: actions/download-artifact@__HASH__ # __VERSION__
38+
- if: ${{ contains(env.VORTEX_DEPLOY_TYPES, 'artifact') }}
3539
- with:
3640
- name: code-artifact
3741
- path: "/tmp/workspace/code"

0 commit comments

Comments
 (0)