Skip to content

Commit c39ff4d

Browse files
committed
Merge branch 'master' of https://github.com/jenkinsci/gitlab-plugin into fix/missing-defined-variables
2 parents 947445a + bcaa2cf commit c39ff4d

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Sync project branch
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
jobs:
8+
sync-project-branch:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: gsoc-2023-project
14+
- run: |
15+
git fetch --unshallow origin || git fetch origin
16+
git config user.email "[email protected]"
17+
git config user.name "Sync project branch action"
18+
git merge --no-edit origin/master
19+
- uses: peter-evans/create-pull-request@v5
20+
with:
21+
title: Merge remote-tracking branch `origin/master` into `gsoc-2023-project`
22+
branch: sync-project-branch
23+
delete-branch: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ work
1111
.project
1212
.settings
1313
.DS_Store
14+
META-INF/

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.jenkins-ci.plugins</groupId>
66
<artifactId>plugin</artifactId>
7-
<version>4.62</version>
7+
<version>4.63</version>
88
<relativePath />
99
</parent>
1010

@@ -50,7 +50,7 @@
5050
</distributionManagement>
5151

5252
<properties>
53-
<revision>1.7.13</revision>
53+
<revision>1.7.15</revision>
5454
<changelist>-SNAPSHOT</changelist>
5555
<jenkins.version>2.375.4</jenkins.version>
5656
<spotbugs.effort>Max</spotbugs.effort>
@@ -67,7 +67,7 @@
6767
<!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
6868
<groupId>io.jenkins.tools.bom</groupId>
6969
<artifactId>bom-2.361.x</artifactId>
70-
<version>2062.v154408a_24d20</version>
70+
<version>2102.v854b_fec19c92</version>
7171
<type>pom</type>
7272
<scope>import</scope>
7373
</dependency>
@@ -420,7 +420,7 @@
420420
<plugin>
421421
<groupId>io.fabric8</groupId>
422422
<artifactId>docker-maven-plugin</artifactId>
423-
<version>0.42.1</version>
423+
<version>0.43.0</version>
424424
<configuration>
425425
<verbose>true</verbose>
426426
<images>
@@ -504,7 +504,7 @@
504504
<plugin>
505505
<groupId>org.codehaus.mojo</groupId>
506506
<artifactId>build-helper-maven-plugin</artifactId>
507-
<version>3.3.0</version>
507+
<version>3.4.0</version>
508508
<executions>
509509
<execution>
510510
<id>add-source</id>

src/main/java/com/dabsquared/gitlabjenkins/util/CommitStatusUpdater.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ public static void updateCommitStatus(
5959
return;
6060
}
6161

62+
EnvVars environment = null;
6263
if (gitLabBranchBuilds == null || gitLabBranchBuilds.isEmpty()) {
6364
try {
64-
if (!build.getEnvironment(listener).isEmpty()) {
65-
gitLabBranchBuilds = retrieveGitlabProjectIds(build, build.getEnvironment(listener));
65+
environment = build.getEnvironment(listener);
66+
if (!environment.isEmpty()) {
67+
gitLabBranchBuilds = retrieveGitlabProjectIds(build, environment);
6668
}
6769
} catch (IOException | InterruptedException e) {
6870
printf(listener, "Failed to get Gitlab Build list to update status: %s%n", e.getMessage());
@@ -96,7 +98,7 @@ public static void updateCommitStatus(
9698
gitLabBranchBuild.getProjectId(),
9799
gitLabBranchBuild.getRevisionHash(),
98100
state,
99-
getBuildBranchOrTag(build),
101+
getBuildBranchOrTag(build, environment),
100102
current_build_name,
101103
buildUrl,
102104
state.name());
@@ -155,10 +157,10 @@ private static boolean existsCommit(GitLabClient client, String gitlabProjectId,
155157
}
156158
}
157159

158-
private static String getBuildBranchOrTag(Run<?, ?> build) {
160+
private static String getBuildBranchOrTag(Run<?, ?> build, EnvVars environment) {
159161
GitLabWebHookCause cause = build.getCause(GitLabWebHookCause.class);
160162
if (cause == null) {
161-
return null;
163+
return environment == null ? null : environment.get("BRANCH_NAME", null);
162164
}
163165
if (cause.getData().getActionType() == CauseData.ActionType.TAG_PUSH) {
164166
return StringUtils.removeStart(cause.getData().getSourceBranch(), "refs/tags/");

0 commit comments

Comments
 (0)