mikemadison13/blt-gitlab-pipelines

Gitlabs Pipelines integration for Acquia BLT.

dev-main 2023-09-02 16:19 UTC

This package is auto-updated.

Last update: 2024-10-31 00:17:51 UTC


README

This is an Acquia BLT plugin providing Gitlab Pipelines integration. This plugin will work with both Gitlab and Acquia Code Studio Pipelines!

This plugin is community-created and community-supported. Acquia does not provide any direct support for this software or provide any warranty as to its stability.

Installation and usage

To use this plugin, you must already have a Drupal project using BLT 11.3 (or higher). While the Environment Detector was added in BLT 10, the fix to properly subclass was not introduced until this commit (and released in 11.3)

1. In your project, require the plugin with Composer:

composer require mikemadison13/blt-gitlab-pipelines

2. Initialize the Gitlab integration by calling recipes:ci:gitlab:init, which is provided by this plugin:

blt recipes:ci:gitlab:init

This will copy a template version of the .gitlab-ci.yml to your project root directory. Make sure to commit this as well as your updated composer.json to Git.

Note: the template YAML file assumes standard BLT steps for builds (and is similar to the templated Travis CI and Acquia Piplines files). Modifications can be made as necessary! Build scripts can also be modified by copying them out of this plugin and changing the file path as needed in the YAML file.

3. Generate and Integrate SSH Keys

In order to utilize Pipelines to deploy into your hosting environment, you must utilize SSH keys for security. While the Plugin does come with the necessary defaults for Acquia Cloud deployments, there are manual steps required to complete the process.

Overall, the process looks like:

Note that this plugin assumes that the "variable" is called SSH_KEY in Gitlab. If you name your variable anything else (or if you use a passphrase) you will need to customize the before_script section of the deploy step to ensure that you are utilizing the correct variable name.

4. Customize the generated .gitlab-ci.yml file

The variables section of the gitlab file includes a number of items that should be customized. This includes:

PHP_VERSION which defaults to 8.0 NODE_VERSION which defaults to 14.x

These variables should match your project defaults for these technologies.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.