Skip to content

Commit

Permalink
Merge branch 'develop' into feature/webhook-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Apr 26, 2024
2 parents 7d93e5a + 9361fcc commit 51d3ecf
Show file tree
Hide file tree
Showing 80 changed files with 348 additions and 791 deletions.
7 changes: 1 addition & 6 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,7 @@ commands:
provision:
usage: Provision a site from the database dump or profile.
cmd: |
if [ -f .data/db.sql ]; then
docker compose exec cli mkdir -p .data
docker compose cp -L .data/db.sql cli:/app/.data/db.sql
fi
ahoy cli ./scripts/drevops/provision.sh
cmd: ahoy cli ./scripts/drevops/provision.sh

export-db:
usage: Export database dump or database image (if DREVOPS_DB_DOCKER_IMAGE variable is set).
Expand Down
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ aliases:
# This container has all the necessary tools to run a dockerized environment.
# @see https://github.com/drevops/ci-runner
# @see https://hub.docker.com/repository/docker/drevops/ci-runner/tags?page=1&ordering=last_updated
- image: drevops/ci-runner:24.3.0
- image: drevops/ci-runner:24.4.0
auth:
username: ${DOCKER_USER}
password: ${DOCKER_PASS}
Expand Down Expand Up @@ -171,8 +171,8 @@ jobs:
name: Export DB after download
command: |
[ ! -f /tmp/download-db-success ] && echo "==> Database download semaphore file is missing. DB export will not proceed." && exit 0
docker compose up -d
sleep 15
./scripts/drevops/login-docker.sh
docker compose up -d && sleep 15
docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "DREVOPS_PROVISION_POST_OPERATIONS_SKIP=1 ./scripts/drevops/provision.sh"
grep -q ^DREVOPS_DB_DOCKER_IMAGE .env && rm .data/db.sql || true
Expand Down Expand Up @@ -227,6 +227,9 @@ jobs:
- v1.19.0-db10-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }}
- v1.19.0-db10-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-
#;> !PROVISION_USE_PROFILE
- run:
name: Login to Docker registry
command: ./scripts/drevops/login-docker.sh
- run:
name: Build stack
command: docker compose up -d
Expand Down Expand Up @@ -292,8 +295,7 @@ jobs:
- run:
name: Process test logs and artifacts
command: |
mkdir -p "${DREVOPS_CI_TEST_RESULTS}"
mkdir -p "${DREVOPS_CI_ARTIFACTS}"
mkdir -p "${DREVOPS_CI_TEST_RESULTS}" "${DREVOPS_CI_ARTIFACTS}"
if docker compose ps --services --filter "status=running" | grep -q cli && docker compose exec cli test -d /app/.logs; then
docker compose cp cli:/app/.logs/. "${DREVOPS_CI_ARTIFACTS}/"
if docker compose exec -T cli sh -c '[ -d /app/.logs/test_results/ ]'; then
Expand All @@ -307,7 +309,7 @@ jobs:
path: *artifacts
- run:
name: Upload code coverage reports to Codecov
command: if [ -d /tmp/artifacts/coverage ]; then codecov -Z -s /tmp/artifacts/coverage; fi
command: if [ -n "${CODECOV_TOKEN}" ] && [ -d /tmp/artifacts/coverage ]; then codecov -Z -s /tmp/artifacts/coverage; fi
- persist_to_workspace:
root: /tmp/workspace
paths:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ web/themes/**/node_modules
web/themes/**/build
.data
.logs
.twig-cs-fixer.cache

# Ignore local override files.
docker-compose.override.yml
Expand Down
8 changes: 4 additions & 4 deletions .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ environment_variables:

# Uncomment to login into container registries if using private images.
# container-registries:
# dockerhub:
# # Environment variables DOCKER_USER and DOCKER_PASS needs to be set via Lagoon CLI.
# username: DOCKER_USER
# password: DOCKER_PASS
# dockerhub:
# # Environment variables DOCKER_USER and DOCKER_PASS needs to be set via Lagoon CLI.
# username: DOCKER_USER
# password: DOCKER_PASS

tasks:
post-rollout:
Expand Down
2 changes: 1 addition & 1 deletion .scaffold/docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const config = {
path: 'content',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/drevops/scaffold/tree/main/.scaffold/docs/content/',
editUrl: 'https://github.com/drevops/scaffold/tree/develop/.scaffold/docs/',
},
blog: false,
theme: {
Expand Down
28 changes: 28 additions & 0 deletions .scaffold/tests/bats/_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1334,3 +1334,31 @@ download_installer() {

popd >/dev/null || exit 1
}

process_ahoyyml() {
[ "${SCAFFOLD_DEV_VOLUMES_MOUNTED}" = "1" ] && return

# Override the provision command in .ahoy.yml to copy the database file to
# the container for when the volumes are not mounted.
# We are doing this only to replicate developer's workflow and experience
# when they run `ahoy build` locally.
local sed_opts
sed_opts=(-i) && [ "$(uname)" = "Darwin" ] && sed_opts=(-i '')
sed "${sed_opts[@]}" 's|cmd: ahoy cli ./scripts/drevops/provision.sh|cmd: if [ -f .data/db.sql ]; then docker compose exec cli mkdir -p .data; docker compose cp -L .data/db.sql cli:/app/.data/db.sql; fi; ahoy cli \.\/scripts\/drevops\/provision\.sh|g' .ahoy.yml
}

setup_ssh_key_fixture() {
export HOME="${BUILD_DIR}"
export SSH_KEY_FIXTURE_DIR="${BUILD_DIR}/.ssh"
fixture_prepare_dir "${SSH_KEY_FIXTURE_DIR}"
}

provision_default_ssh_key() {
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa" >/dev/null
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_TEST" >/dev/null
}

provision_ssh_key_with_suffix() {
local suffix="${1:-TEST}"
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" >/dev/null
}
20 changes: 1 addition & 19 deletions .scaffold/tests/bats/_helper.deployment.bash
Original file line number Diff line number Diff line change
Expand Up @@ -140,39 +140,21 @@ install_and_build_site() {

export DREVOPS_PROVISION_POST_OPERATIONS_SKIP=1

process_ahoyyml
ahoy build
sync_to_host
fi

popd >/dev/null || exit 1
}

setup_ssh_key_fixture() {
# Create a fixture directory for ssh keys
export HOME="${BUILD_DIR}"
export SSH_KEY_FIXTURE_DIR="${BUILD_DIR}/.ssh"
fixture_prepare_dir "${SSH_KEY_FIXTURE_DIR}"
}

setup_robo_fixture() {
export HOME="${BUILD_DIR}"
fixture_prepare_dir "${HOME}/.composer/vendor/bin"
touch "${HOME}/.composer/vendor/bin/robo"
chmod +x "${HOME}/.composer/vendor/bin/robo"
}

provision_default_ssh_key() {
# Generate fixture keys.
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa"
# Generate SSH key with TEST suffix.
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_TEST"
}

provision_ssh_key_with_suffix() {
local suffix="${1:-TEST}"
ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}"
}

provision_docker_config_file() {
export HOME="${BUILD_DIR}"
fixture_prepare_dir "${HOME}/.docker"
Expand Down
1 change: 1 addition & 0 deletions .scaffold/tests/bats/_helper.workflow.bash
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ assert_ahoy_build() {
export DOCKER_USER="${TEST_DOCKER_USER?Test Docker user is not set}"
export DOCKER_PASS="${TEST_DOCKER_PASS?Test Docker pass is not set}"

process_ahoyyml
run ahoy build
run sync_to_host

Expand Down
Loading

1 comment on commit 51d3ecf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.