-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from grasmash/tugboat
Adding tugboat support.
- Loading branch information
Showing
17 changed files
with
226 additions
and
36 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Drupal editor configuration normalization | ||
# @see http://editorconfig.org/ | ||
|
||
# This is the top-most .editorconfig file; do not search in parent directories. | ||
root = true | ||
|
||
# All files. | ||
[*] | ||
end_of_line = LF | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
# Tab indentation (no size specified) | ||
[Makefile] | ||
indent_style = tab |
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
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
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
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
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,23 @@ | ||
<project name="blt" default="blt:update"> | ||
<target name="blt:update" description="Pulls in upstream changes to project template from BLT repository."> | ||
<echo>You may be prompted to trust GitHub's SSL certification and to enter your GitHub password.</echo> | ||
<echo>If you have two factor authentication enabled for GitHub, you must use an access token in lieu of a password.</echo> | ||
<echo>GitHub access tokens can be generated here: https://github.com/settings/tokens</echo> | ||
|
||
<input message="Press any key to continue" propertyName="continue" /> | ||
|
||
<exec dir="${repo.root}" command="./scripts/blt/update-scaffold" logoutput="true" passthru="true"/> | ||
</target> | ||
|
||
<target name="blt:alias" description="Installs the BLT alias for command line usage."> | ||
<echo>BLT can automatically create a Bash alias to make it easier to run BLT tasks.</echo> | ||
<echo>This alias may be created in .bash_profile or .bashrc depending on your system architecture.</echo> | ||
<propertyprompt propertyName="create_alias" defaultValue="y" useExistingValue="true" promptText="Create a bash alias now? (y/n)" /> | ||
<if> | ||
<equals arg1="${create_alias}" arg2="y"/> | ||
<then> | ||
<exec dir="${repo.root}/scripts/blt" command="./install-alias.sh" passthru="true" checkreturn="true"/> | ||
</then> | ||
</if> | ||
</target> | ||
</project> |
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
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
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
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
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,8 @@ | ||
tugboat-init: | ||
scripts/tugboat/init.sh | ||
|
||
tugboat-update: | ||
scripts/tugboat/update.sh | ||
|
||
tugboat-build: | ||
scripts/tugboat/build.sh |
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,48 @@ | ||
## Setup | ||
|
||
To set up this project with Tugboat, run the following commands from the project root: | ||
|
||
``` | ||
./blt.sh ci:tugboat:init | ||
``` | ||
|
||
## Workflow | ||
|
||
This workflow is for a brand new repository for which a base preview has never been built or committed. | ||
|
||
### Initial Setup | ||
1. Visit `https://dashboard.tugboat.qa/[project]/latest` to access the Base Preview. | ||
2. Initialize the Base Preview, click Actions -> init. | ||
3. Makefile -> tugboat-init is triggered. | ||
4. Commit the Base Preview, click actions -> commit. | ||
|
||
### Dev Workflow | ||
5. Submit a Pull Request via GitHub, feature-branch-1 against master. | ||
6. A new container with a clone of Base Preview is created for the PR. | ||
8. Tugboat merges feature-branch-1 into master in PR Preview. | ||
9. Makefile -> tugboat-build is triggered. | ||
10. Merge Pull Request on GitHub. | ||
11. Tugboat deletes the PR Preview. | ||
|
||
### Updating Base Preview | ||
|
||
12. Visit `https://dashboard.tugboat.qa/[project]/latest` to access the Base Preview. | ||
13. Initialize the Base Preview, click Actions -> update. | ||
14. Makefile -> tugboat-update is triggered. | ||
15. Tugboat commits updated Base Preview. | ||
16. Make manual changes to the Base Preview. | ||
17. Realize that you made mistake. | ||
18. Reset the Base Preview, click Actions -> reset. | ||
19. Base preview is reverted to commit made in step 15 | ||
|
||
## Troubleshooting | ||
|
||
* `Makefile:2: *** missing separator. Stop.` | ||
|
||
This is caused by using spaces rather than tabs in your Makefile. If are using PHPStorm with Drupal Coding Standards configuration, you will need to overcome the automated usage of spaces by installing the [Editorconfig plugin](https://plugins.jetbrains.com/plugin/7294) and creating `.editorconfig` file with the following contents: | ||
|
||
``` | ||
# Tab indentation (no size specified) | ||
[Makefile] | ||
indent_style = tab | ||
``` |
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
|
||
# Update current database to reflect the state of the Drupal file system | ||
$DIR/../../bolt.sh ci: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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
DOCROOT=/var/lib/tugboat/docroot | ||
|
||
mysql -h mysql -u tugboat -ptugboat -e 'CREATE DATABASE drupal;' | ||
composer selfupdate | ||
composer install | ||
|
||
# Install nvm and specified nodejs version. | ||
$DIR/install-node.sh 4.4.1 | ||
|
||
|
||
$DIR/../../bolt.sh ci:setup |
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,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ $# -ne 1 ]; then | ||
echo $0: usage: install-node.sh 4.4.1 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "$HOME/.nvm" ]; then | ||
echo "Downloading and installing nvm" | ||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash | ||
fi | ||
|
||
NODE_VERSION=$1 | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | ||
if [[ $(nvm ls $NODE_VERSION | grep "N/A") ]]; then | ||
echo "Downloading and installing node version $NODE_VERSION" | ||
nvm download $NODE_VERSION | ||
nvm install $NODE_VERSION | ||
fi | ||
|
||
# Sets version of node in .node-version so that | ||
# it can be picked up by tools like avn. | ||
echo $NODE_VERSION > .node-version | ||
|
||
echo "Please run the following command": | ||
echo "source ~/.bashrc && nvm use --delete-prefix $NODE_VERSION" |
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,6 @@ | ||
<?php | ||
|
||
$aliases['${project.machine_name}.ci'] = array( | ||
'uri' => $_ENV['TUGBOAT_URL'], | ||
'root' => '/var/lib/tugboat/docroot', | ||
); |
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,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Import config | ||
cd /var/lib/tugboat/docroot | ||
chown -R www-data sites/default/files | ||
|
||
# Update current database to reflect the state of the Drupal file system | ||
$DIR/../../bolt.sh ci:update |