Skip to content

Commit

Permalink
[#1126] Updated working dir and workspace dir to reside in modifiable…
Browse files Browse the repository at this point in the history
… locations. (#1138)
  • Loading branch information
AlexSkrypnyk authored Jan 15, 2024
1 parent 489473a commit ad70bda
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ aliases:
#: Shared runner container configuration applied to each job.
- &runner_config
#: Location of the checked-out files within the "runner" container.
working_directory: &working_directory /root/project
working_directory: &working_directory ~/project
environment:
#;< !PROVISION_USE_PROFILE
DREVOPS_DB_DOWNLOAD_SSH_FINGERPRINT: *db_ssh_fingerprint
Expand Down Expand Up @@ -157,7 +157,7 @@ aliases:
# Check only minimal stack requirements.
DREVOPS_DOCTOR_CHECK_MINIMAL: 1
# Directory to store code exported between jobs.
DREVOPS_EXPORT_CODE_DIR: &drevops_build_export_dir /workspace/code
DREVOPS_EXPORT_CODE_DIR: &drevops_build_export_dir /tmp/workspace/code
# Directory to use for artifact deployments.
DREVOPS_DEPLOY_ARTIFACT_SRC: *drevops_build_export_dir
# Source code location for artifact deployments.
Expand All @@ -180,7 +180,9 @@ aliases:
- &step_process_codebase
run:
name: Process codebase to run in CI
command: find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
command: |
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
mkdir -p /tmp/workspace/code
################################################################################
# JOBS
Expand All @@ -201,7 +203,7 @@ jobs:
<<: *runner_config
steps:
- attach_workspace:
at: /workspace
at: /tmp/workspace
#: Add SSH key into "runner" container to have SSH access to download DB.
- add_ssh_keys:
fingerprints:
Expand Down Expand Up @@ -289,7 +291,7 @@ jobs:
parallelism: *parallelism
steps:
- attach_workspace:
at: /workspace
at: /tmp/workspace
- checkout
- *step_process_codebase
- *step_setup_remote_docker
Expand Down Expand Up @@ -361,7 +363,7 @@ jobs:
name: Upload code coverage reports to Codecov
command: codecov -Z -s /tmp/artifacts/coverage
- persist_to_workspace:
root: /workspace
root: /tmp/workspace
paths:
- code

Expand All @@ -371,7 +373,7 @@ jobs:
<<: *runner_config
steps:
- attach_workspace:
at: /workspace
at: /tmp/workspace
- add_ssh_keys:
fingerprints:
- *deploy_ssh_fingerprint
Expand All @@ -392,7 +394,7 @@ jobs:
<<: *runner_config
steps:
- attach_workspace:
at: /workspace
at: /tmp/workspace
- add_ssh_keys:
fingerprints:
- *deploy_ssh_fingerprint
Expand Down Expand Up @@ -495,7 +497,7 @@ jobs:
fingerprints:
- *deploy_ssh_fingerprint
- attach_workspace:
at: /workspace
at: /tmp/workspace
- run:
name: Run deployment tests (long)
command: cd .drevops && DREVOPS_DEV_VOLUMES_MOUNTED=0 DREVOPS_DEV_TEST_COVERAGE_DIR=/tmp/artifacts/coverage ahoy test-deployment
Expand Down
11 changes: 11 additions & 0 deletions scripts/drevops/deploy-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ fi
note "Installing artifact builder."
composer global require --dev -n --ansi --prefer-source --ignore-platform-reqs drevops/git-artifact:^0.5

# Try resolving absolute paths.
if command -v realpath >/dev/null 2>&1; then
# Expand relative paths while also handling literal tilde expansion passed in
# singe quotes. This addresses the case where the paths are passed directly
# from YAML anchors as literal strings.
# shellcheck disable=SC2116
DREVOPS_DEPLOY_ARTIFACT_ROOT="$(realpath "${DREVOPS_DEPLOY_ARTIFACT_ROOT/#\~/${HOME}}")"
# shellcheck disable=SC2116
DREVOPS_DEPLOY_ARTIFACT_SRC="$(realpath "${DREVOPS_DEPLOY_ARTIFACT_SRC/#\~/${HOME}}")"
fi

# Copying git repo files meta file to the deploy code repo as it may not exist
# in deploy code source files.
cp -a "${DREVOPS_DEPLOY_ARTIFACT_ROOT}"/.git "${DREVOPS_DEPLOY_ARTIFACT_SRC}" || true
Expand Down

0 comments on commit ad70bda

Please sign in to comment.