Skip to content

Commit

Permalink
fix: fix circleCI environment variable handling
Browse files Browse the repository at this point in the history
  • Loading branch information
qoomon committed Feb 16, 2023
1 parent c8c9465 commit 436a42a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.4.1

##### Fixes
- threat empty circleCI environment variables as not set


## 6.4.0

##### Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This plugin can virtually set project version and properties, based on current *

```groovy
plugins {
id 'me.qoomon.git-versioning' version '6.3.8'
id 'me.qoomon.git-versioning' version '6.4.1'
}
version = '0.0.0-SNAPSHOT'
Expand All @@ -41,7 +41,7 @@ gitVersioning.apply {

```kotlin
plugins {
id("me.qoomon.git-versioning") version "6.3.8"
id("me.qoomon.git-versioning") version "6.4.1"
}

version = "0.0.0-SNAPSHOT"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group 'me.qoomon'
version '6.4.0'
version '6.4.1'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
import static java.util.stream.Collectors.toList;
import static me.qoomon.gitversioning.commons.GitRefType.*;
import static me.qoomon.gitversioning.commons.StringUtil.*;
import static org.apache.commons.lang3.StringUtils.leftPad;
import static org.apache.commons.lang3.StringUtils.rightPad;
import static org.apache.commons.lang3.StringUtils.*;
import static org.eclipse.jgit.lib.Constants.HEAD;

public abstract class GitVersioningPluginExtension {
Expand Down Expand Up @@ -351,11 +350,11 @@ private void handleEnvironment(Repository repository) throws IOException {
project.getLogger().debug(" CI_COMMIT_TAG: " + commitTag);
project.getLogger().debug(" CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: " + mrSourceBranch);

if (commitBranch != null) {
if (!isBlank(commitBranch)) {
setBranch(commitBranch);
} else if (mrSourceBranch != null) {
} else if (!isBlank(mrSourceBranch)) {
setBranch(mrSourceBranch);
} else if (commitTag != null) {
} else if (!isBlank(commitTag)) {
addTag(commitTag);
}
return;
Expand All @@ -373,10 +372,10 @@ private void handleEnvironment(Repository repository) throws IOException {
project.getLogger().debug(" CIRCLE_BRANCH: " + commitBranch);
project.getLogger().debug(" CIRCLE_TAG: " + commitTag);

if (commitBranch != null) {
setBranch(commitBranch);
} else if (commitTag != null) {
addTag(commitTag);
if (!isBlank(commitBranch)) {
setBranch(commitBranch.trim());
} else if (!isBlank(commitTag)) {
addTag(commitTag.trim());
}
return;
}
Expand All @@ -392,13 +391,13 @@ private void handleEnvironment(Repository repository) throws IOException {
project.getLogger().debug(" BRANCH_NAME: " + commitBranch);
project.getLogger().debug(" TAG_NAME: " + commitTag);

if (commitBranch != null) {
if (!isBlank(commitBranch)) {
if (commitBranch.equals(commitTag)) {
addTag(commitBranch);
} else {
setBranch(commitBranch);
}
} else if (commitTag != null) {
} else if (!isBlank(commitTag)) {
addTag(commitTag);
}
return;
Expand Down

0 comments on commit 436a42a

Please sign in to comment.