Skip to content

Commit cf39f0a

Browse files
snufkingrasmash
authored andcommitted
Provide initial template for Gitlab Pipelines (acquia#1733)
* Adding the initial gitlab template. * Implementing the blt command which copies the template to the project root. * Updating the CI template file with extended steps based on existing commands on other CI platforms. * Updating typo and adding warning regarding the experimental nature of the plugin.
1 parent a1fab10 commit cf39f0a

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

scripts/gitlab/gitlab-ci.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
stages:
2+
- validate
3+
- build
4+
- test
5+
- deploy
6+
7+
variables:
8+
APP_NAME: Project
9+
10+
before_script:
11+
- echo "hello world"
12+
13+
validate:
14+
stage: validate
15+
script:
16+
- blt validate:all
17+
18+
build:
19+
stage: build
20+
script:
21+
- composer validate --no-check-all --ansi
22+
- composer install --ansi
23+
- blt setup:build
24+
25+
test:
26+
stage: test
27+
script:
28+
- blt tests --define tests.run-server=true --yes -v
29+
30+
production:
31+
stage: deploy
32+
script:
33+
- echo "Launching application"
34+
environment:
35+
name: production
36+
url: http://$APP_NAME.example.com
37+
only:
38+
- master

src/Robo/Commands/Ci/CiCommand.php

+18
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,22 @@ public function proboInit() {
6868
$this->say("<info>A pre-configured .probo.yml file was copied to your repository root.</info>");
6969
}
7070

71+
/**
72+
* Initializes default GitLab Pipelines configuration for this project.
73+
*
74+
* @command ci:gitlab:init
75+
*/
76+
public function gitlabInit() {
77+
$result = $this->taskFilesystemStack()
78+
->copy($this->getConfigValue('blt.root') . '/scripts/gitlab/gitlab-ci.yml', $this->getConfigValue('repo.root') . '/.gitlab-ci.yml', TRUE)
79+
->stopOnFail()
80+
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
81+
->run();
82+
if (!$result->wasSuccessful()) {
83+
throw new BltException("Could not initialize the GitLab Pipelines configuration.");
84+
}
85+
$this->say("<info>A pre-configured .gitlab-ci.yml file was copied to your repository root.</info>");
86+
$this->logger->warning("GitLab support is experimental and may not support all BLT features.");
87+
}
88+
7189
}

0 commit comments

Comments
 (0)