-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,47 @@ | ||
include: | ||
- local: 'scaffold/gitlab/DDEV.gitlab-ci.yml' | ||
|
||
variables: | ||
DRAINPIPE_DDEV_GIT_EMAIL: [email protected] | ||
DRAINPIPE_DDEV_GIT_NAME: Drainpipe Bot | ||
|
||
.drainpipe_setup_drupal: | ||
script: | ||
- sudo apt update | ||
- sudo apt install php-cli unzip -y | ||
- curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php | ||
- | | ||
HASH=`curl -sS https://composer.github.io/installer.sig` | ||
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;" | ||
- sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer | ||
- mkdir drainpipe | ||
- | | ||
shopt -s extglob | ||
shopt -s dotglob | ||
mv !(drainpipe) drainpipe/ | ||
- mv drainpipe /tmp/drainpipe | ||
- composer create-project drupal/recommended-project . --ignore-platform-reqs | ||
- mv /tmp/drainpipe . | ||
|
||
build: | ||
stage: build | ||
interruptible: true | ||
script: | ||
- echo "Hello, $GITLAB_USER_LOGIN!1!" | ||
- !reference [.drainpipe_setup_drupal, script] | ||
- !reference [.drainpipe_setup_ddev, script] | ||
- ddev composer config extra.drupal-scaffold.gitignore true | ||
- ddev composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"] | ||
- ddev composer config --json extra.drainpipe.gitlab \[] | ||
- ddev composer config --no-plugins allow-plugins.composer/installers true | ||
- ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true | ||
- ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true | ||
- | | ||
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}' | ||
- ddev composer config minimum-stability dev | ||
- ddev composer require lullabot/drainpipe --with-all-dependencies | ||
- ddev restart | ||
- test -f .gitlab/drainpipe/DDEV.gitlab-ci.yml | ||
- ddev drush site:install minimal -y | ||
- echo "\$settings['config_sync_directory'] = '../config';" >> web/sites/default/settings.php | ||
- ddev drush config:export -y | ||
- ddev task update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -441,7 +441,40 @@ Add the following to `composer.json` for GitLab helpers: | |
|
||
This will import [`scaffold/gitlab/Common.gitlab-ci.yml`](scaffold/gitlab/Common.gitlab-ci.yml), | ||
which provides helpers that can be used in GitLab CI with [includes and | ||
references](https://docs.gitlab.com/ee/ci/yaml/yaml_specific_features.html#reference-tags). | ||
references](https://docs.gitlab.com/ee/ci/yaml/yaml_specific_features.html#reference-tags), | ||
or `scaffold/gitlab/DDEV.gitlab-ci.yml` if you are using DDEV. | ||
|
||
``` | ||
include: | ||
- local: '.gitlab/drainpipe/DDEV.gitlab-ci.ymll' | ||
variables: | ||
DRAINPIPE_DDEV_GIT_EMAIL: [email protected] | ||
DRAINPIPE_DDEV_GIT_NAME: Drainpipe Bot | ||
build: | ||
stage: build | ||
interruptible: true | ||
script: | ||
- !reference [.drainpipe_setup_ddev, script] | ||
- composer install | ||
- ddev restart | ||
- ddev drush site:install minimal -y | ||
- echo "\$settings['config_sync_directory'] = '../config';" >> web/sites/default/settings.php | ||
- ddev drush config:export -y | ||
- ddev task update | ||
``` | ||
|
||
Available variables are: | ||
|
||
| Variable | | | ||
|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------| | ||
| DRAINPIPE_DDEV_SSH_PRIVATE_KEY | SSH private key used for e.g. committing to git | | ||
| DRAINPIPE_DDEV_SSH_KNOWN_HOSTS | The result of running e.g. `ssh-keyscan -H codeserver.dev.$PANTHEON_SITE_ID.drush.in` | | ||
| DRAINPIPE_DDEV_GIT_EMAIL | E-mail address to use for git commits | | ||
| DRAINPIPE_DDEV_GIT_NAME | Name to use for git commits | | ||
| DRAINPIPE_DDEV_COMPOSER_CACHE_DIR | Set to "false" to disable composer cache dir, or another value to override the default location of .ddev/.drainpipe-composer-cache | | ||
| DRAINPIPE_DDEV_VERSION | Install a specific version of DDEV instead of the latest | | ||
|
||
### Composer Lock Diff | ||
Updates Merge Request descriptions with a markdown table of any changes detected | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
default: | ||
image: ghcr.io/catthehacker/ubuntu:runner-22.04 | ||
services: | ||
- name: docker:dind | ||
alias: docker | ||
|
||
variables: | ||
DRAINPIPE_DDEV_SSH_PRIVATE_KEY: "" | ||
DRAINPIPE_DDEV_SSH_KNOWN_HOSTS: "" | ||
DRAINPIPE_DDEV_GIT_EMAIL: [email protected] | ||
DRAINPIPE_DDEV_GIT_NAME: Drainpipe Bot | ||
DRAINPIPE_DDEV_COMPOSER_CACHE_DIR: "" | ||
DRAINPIPE_DDEV_VERSION: "" | ||
DOCKER_HOST: "tcp://docker:2375" | ||
FF_NETWORK_PER_BUILD: 1 | ||
|
||
cache: | ||
- key: | ||
files: | ||
- composer.lock | ||
- composer.json | ||
paths: | ||
- .ddev/.drainpipe-composer-cache | ||
|
||
.drainpipe_setup_ddev: | ||
script: | ||
- sudo chown -R runner:runner $CI_PROJECT_DIR | ||
- | | ||
mkdir -p .ddev/homeadditions/.ssh | ||
# Copy private key | ||
if [ "$DRAINPIPE_DDEV_SSH_PRIVATE_KEY" != "" ]; then | ||
echo "$DRAINPIPE_DDEV_SSH_PRIVATE_KEY" > .ddev/homeadditions/.ssh/id_rsa | ||
chmod 600 .ddev/homeadditions/.ssh/id_rsa | ||
fi | ||
# Copy known hosts | ||
if [ "$DRAINPIPE_DDEV_SSH_KNOWN_HOSTS" != "" ]; then | ||
echo "$DRAINPIPE_DDEV_SSH_KNOWN_HOSTS" > .ddev/homeadditions/.ssh/known_hosts | ||
chmod 644 .ddev/homeadditions/.ssh/known_hosts | ||
fi | ||
# SSH config file | ||
touch .ddev/homeadditions/.ssh/config | ||
chmod 600 .ddev/homeadditions/.ssh/config | ||
chmod 700 .ddev/homeadditions/.ssh | ||
- | | ||
if [ "$DRAINPIPE_DDEV_VERSION" != "" ]; then | ||
curl -fsSL https://ddev.com/install.sh | bash -s "v$DRAINPIPE_DDEV_VERSION" | ||
else | ||
curl -fsSL https://ddev.com/install.sh | bash | ||
fi | ||
- ddev config global --no-bind-mounts | ||
- if [ ! -f ".ddev/config.yaml" ]; then ddev config --auto; fi | ||
- | | ||
if [ "$DRAINPIPE_DDEV_COMPOSER_CACHE_DIR" != "false" ]; then | ||
# @todo Replace /var/www/html with an environment variable. | ||
CACHE_DIR=".ddev/.drainpipe-composer-cache" | ||
if [ "$DRAINPIPE_DDEV_COMPOSER_CACHE_DIR" != "" ]; then | ||
CACHE_DIR="$DRAINPIPE_DDEV_COMPOSER_CACHE_DIR" | ||
fi | ||
ddev config --web-environment-add="COMPOSER_CACHE_DIR=/var/www/html/$CACHE_DIR" | ||
fi | ||
- ddev start | ||
- ddev describe | ||
# Copy git credentials | ||
- ddev exec "git config --global user.name \"$DRAINPIPE_DDEV_GIT_NAME\"" | ||
- ddev exec "git config --global user.email \"$DRAINPIPE_DDEV_GIT_EMAIL\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters