Skip to content

Commit 883857e

Browse files
committed
[#92] Replaced 'deployment' terminology with 'artifact build' for clarity.
1 parent d575f09 commit 883857e

4 files changed

Lines changed: 40 additions & 36 deletions

File tree

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,24 @@ destination repository.
165165

166166
## 📥 Installation
167167

168-
This package is intended to be used as a standalone binary. You will need to
168+
### As a standalone binary
169+
170+
This tool is intended to be used as a standalone binary. You will need to
169171
have PHP installed on your system to run the binary.
170172

171173
Download the latest release from the [GitHub releases page](https://github.com/drevops/git-artifact/releases/latest).
172174

173-
You may also install the package globally using Composer:
175+
### As a Composer dependency
176+
177+
You may also install this tool globally using Composer:
174178
```shell
175179
composer global require --dev drevops/git-artifact:~1.1
176180
```
177181

178-
### 📌 Version constraint
182+
#### 📌 Version constraint
179183

180184
When using `git-artifact` in CI/CD scripts, we recommend using **Tilde Version Range Operator** to ensure stability.
181-
The tilde constraint allows patch updates (e.g., `1.0.0``1.1.1`) but blocks minor version updates (e.g., `1.1.0``1.2.0`).
185+
The tilde constraint allows patch updates (e.g., `1.0.0``1.1.1`) but blocks minor version updates (e.g., `1.1.0``1.2.0`).
182186

183187
This ensures that:
184188
- **Security fixes and bug patches** are automatically applied

src/Commands/ArtifactCommand.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ class ArtifactCommand extends Command {
107107
protected bool $showChanges = FALSE;
108108

109109
/**
110-
* Flag to fail deployment when branch is missing.
110+
* Flag to fail artifact packaging when branch is missing.
111111
*
112-
* By default (false), deployment is skipped with exit code 0.
113-
* When true, deployment fails with exit code 1.
112+
* By default (false), artifact packaging is skipped with exit code 0.
113+
* When true, artifact packaging fails with exit code 1.
114114
*/
115115
protected bool $failOnMissingBranch = FALSE;
116116

117117
/**
118-
* Flag indicating deployment was skipped due to missing branch.
118+
* Flag indicating artifact packaging was skipped due to missing branch.
119119
*/
120-
protected bool $deploymentSkipped = FALSE;
120+
protected bool $packagingSkipped = FALSE;
121121

122122
/**
123123
* Flag to specify if push was successful.
@@ -175,7 +175,7 @@ protected function configure(): void {
175175
->addOption('root', NULL, InputOption::VALUE_REQUIRED, 'Path to the root for file path resolution. If not specified, current directory is used.')
176176
->addOption('show-changes', NULL, InputOption::VALUE_NONE, 'Show changes made to the repo by the build in the output.')
177177
->addOption('src', NULL, InputOption::VALUE_REQUIRED, 'Directory where source repository is located. If not specified, root directory is used.')
178-
->addOption('fail-on-missing-branch', NULL, InputOption::VALUE_NONE, 'Fail deployment if source branch cannot be determined. By default, deployment is skipped gracefully.');
178+
->addOption('fail-on-missing-branch', NULL, InputOption::VALUE_NONE, 'Fail artifact packaging if source branch cannot be determined. By default, artifact packaging is skipped gracefully.');
179179
// @formatter:on
180180
// phpcs:enable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma
181181
// phpcs:enable Drupal.WhiteSpace.Comma.TooManySpaces
@@ -209,8 +209,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
209209

210210
$this->resolveOptions($remote, $input->getOptions());
211211

212-
// Check if deployment was skipped due to missing branch.
213-
if ($this->deploymentSkipped) {
212+
// Check if artifact packaging was skipped due to missing branch.
213+
if ($this->packagingSkipped) {
214214
return Command::SUCCESS;
215215
}
216216

@@ -225,7 +225,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
225225
return Command::FAILURE;
226226
}
227227

228-
$this->output->writeln('<info>Deployment finished successfully.</info>');
228+
$this->output->writeln('<info>Artifact packaged successfully.</info>');
229229

230230
return Command::SUCCESS;
231231
}
@@ -353,20 +353,20 @@ protected function resolveOptions(string $url, array $options): void {
353353
}
354354
catch (BranchNotFoundException $exception) {
355355
if ($this->failOnMissingBranch) {
356-
// Strict mode: fail deployment.
357-
throw new \RuntimeException('Unable to determine source branch. Deployment failed. ' . $exception->getMessage(), $exception->getCode(), $exception);
356+
// Strict mode: fail artifact packaging.
357+
throw new \RuntimeException('Unable to determine source branch. Artifact packaging failed. ' . $exception->getMessage(), $exception->getCode(), $exception);
358358
}
359359

360360
$commit_hash = $exception->getCommitHash();
361-
$this->logger->notice('Source branch not found. Deployment will be skipped.');
361+
$this->logger->notice('Source branch not found. Artifact packaging will be skipped.');
362362
$this->logger->notice('Commit: ' . $commit_hash);
363363

364-
$this->output->writeln('<comment>Source branch not found. Deployment skipped.</comment>');
364+
$this->output->writeln('<comment>Source branch not found. Artifact packaging skipped.</comment>');
365365
$this->output->writeln('<comment>Commit: ' . $commit_hash . '</comment>');
366-
$this->output->writeln('<info>Use --fail-on-missing-branch to fail deployment instead.</info>');
366+
$this->output->writeln('<info>Use --fail-on-missing-branch to fail artifact packaging instead.</info>');
367367

368-
// Set flag to skip deployment and return early from execute().
369-
$this->deploymentSkipped = TRUE;
368+
// Set flag to skip artifact packaging and return early from execute().
369+
$this->packagingSkipped = TRUE;
370370

371371
return;
372372
}

tests/Functional/FunctionalTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function assertArtifactCommandSuccess(?array $args = [], string $branc
113113

114114
$this->assertStringNotContainsString('[error]', $output);
115115
$this->assertStringContainsString(sprintf('Pushed branch "%s" with commit message "%s"', $branch, $commit), $output);
116-
$this->assertStringContainsString('Deployment finished successfully.', $output);
116+
$this->assertStringContainsString('Artifact packaged successfully.', $output);
117117
$this->assertStringNotContainsString('Processing failed with an error:', $output);
118118

119119
return $output;
@@ -138,7 +138,7 @@ protected function assertArtifactCommandFailure(?array $args = [], string $commi
138138
$output = $this->runArtifactCommand($args, TRUE);
139139

140140
$this->assertStringNotContainsString(sprintf('Pushed branch "%s" with commit message "%s"', $args['--branch'], $commit), $output);
141-
$this->assertStringNotContainsString('Deployment finished successfully.', $output);
141+
$this->assertStringNotContainsString('Artifact packaged successfully.', $output);
142142
$this->assertStringContainsString('Processing failed with an error:', $output);
143143

144144
return $output;

tests/Functional/MissingBranchTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
class MissingBranchTest extends FunctionalTestCase {
1515

1616
/**
17-
* Test deployment skips gracefully when branch is missing (default).
17+
* Test artifact packaging skips gracefully when branch is missing (default).
1818
*
1919
* This simulates the scenario where a branch was deleted after PR merge.
20-
* Default behavior should skip deployment with exit code 0.
20+
* Default behavior should skip artifact packaging with exit code 0.
2121
*/
2222
public function testMissingBranchDefaultBehavior(): void {
2323
$this->gitCreateFixtureCommits(1);
@@ -44,23 +44,23 @@ public function testMissingBranchDefaultBehavior(): void {
4444
// Checkout the orphaned commit - now it's truly not on any branch.
4545
$repo->checkout($commit_hash);
4646

47-
// Default behavior: should skip deployment with exit code 0.
47+
// Default behavior: should skip artifact packaging with exit code 0.
4848
// Use explicit branch name (no tokens) to avoid token processing issues.
4949
$output = $this->runArtifactCommand([
5050
'--branch' => 'testbranch',
5151
'--dry-run' => TRUE,
5252
]);
5353

54-
$this->assertStringContainsString('Source branch not found. Deployment skipped.', $output);
54+
$this->assertStringContainsString('Source branch not found. Artifact packaging skipped.', $output);
5555
$this->assertStringContainsString('Commit: ' . $commit_hash, $output);
56-
$this->assertStringContainsString('Use --fail-on-missing-branch to fail deployment instead', $output);
56+
$this->assertStringContainsString('Use --fail-on-missing-branch to fail artifact packaging instead', $output);
5757
$this->assertStringNotContainsString('Processing failed with an error:', $output);
5858
}
5959

6060
/**
61-
* Test deployment fails when branch is missing with flag.
61+
* Test artifact packaging fails when branch is missing with flag.
6262
*
63-
* With --fail-on-missing-branch flag, deployment should fail.
63+
* With --fail-on-missing-branch flag, artifact packaging should fail.
6464
*/
6565
public function testMissingBranchWithFlag(): void {
6666
$this->gitCreateFixtureCommits(1);
@@ -100,29 +100,29 @@ public function testMissingBranchWithFlag(): void {
100100
}
101101

102102
/**
103-
* Test normal deployment when branch exists.
103+
* Test normal artifact packaging when branch exists.
104104
*
105105
* Verifies that normal operation still works when branch is available.
106106
*/
107107
public function testNormalDeploymentWithBranch(): void {
108108
$this->gitCreateFixtureCommits(1);
109109

110-
// Normal deployment with existing branch should work.
110+
// Normal artifact packaging with existing branch should work.
111111
$output = $this->assertArtifactCommandSuccess();
112112

113113
$this->assertStringContainsString('Pushed branch "testbranch" with commit message "Deployment commit"', $output);
114-
$this->assertStringContainsString('Deployment finished successfully.', $output);
114+
$this->assertStringContainsString('Artifact packaged successfully.', $output);
115115

116116
// Verify the branch exists in destination.
117117
$this->gitCheckout($this->dst, 'testbranch');
118118
$this->assertFilesExist($this->dst, 'f1');
119119
}
120120

121121
/**
122-
* Test deployment works with tag in detached HEAD state.
122+
* Test artifact packaging works with tag in detached HEAD state.
123123
*
124124
* When checked out at a tag, getOriginalBranch() should validate that
125-
* the tag exists and allow deployment to proceed.
125+
* the tag exists and allow artifact packaging to proceed.
126126
*/
127127
public function testDeploymentWithTagDetachedHead(): void {
128128
$this->gitCreateFixtureCommits(1);
@@ -135,11 +135,11 @@ public function testDeploymentWithTagDetachedHead(): void {
135135
// Checkout the tag to enter detached HEAD state.
136136
$repo->checkout('v1.0.0');
137137

138-
// Deployment should work because tag is a valid detachment source.
138+
// Artifact packaging should work because tag is a valid detachment source.
139139
$output = $this->assertArtifactCommandSuccess();
140140

141141
$this->assertStringContainsString('Pushed branch "testbranch" with commit message "Deployment commit"', $output);
142-
$this->assertStringContainsString('Deployment finished successfully.', $output);
142+
$this->assertStringContainsString('Artifact packaged successfully.', $output);
143143
}
144144

145145
}

0 commit comments

Comments
 (0)