Skip to content

Commit 52fc6f6

Browse files
authored
Merge branch 'master' into restore-view-actions
2 parents ac39282 + b7ce450 commit 52fc6f6

File tree

80 files changed

+1166
-1010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1166
-1010
lines changed

.github/workflows/require-changelog-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
issues: write
1212
pull-requests: write
1313
steps:
14-
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # v5
14+
- uses: mheap/github-action-required-labels@fb29a14a076b0f74099f6198f77750e8fc236016 # v5
1515
with:
1616
mode: minimum
1717
count: 1

ath.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o xtrace
66
cd "$(dirname "$0")"
77

88
# https://github.com/jenkinsci/acceptance-test-harness/releases
9-
export ATH_VERSION=6180.v889d0fe56785
9+
export ATH_VERSION=6242.v4b_a_848d63ed8
1010

1111
if [[ $# -eq 0 ]]; then
1212
export JDK=17
@@ -26,33 +26,46 @@ fi
2626
mkdir -p target/ath-reports
2727
chmod a+rwx target/ath-reports
2828

29+
curl \
30+
--fail \
31+
--silent \
32+
--show-error \
33+
--output /tmp/ath.yml \
34+
--location "https://raw.githubusercontent.com/jenkinsci/acceptance-test-harness/refs/tags/${ATH_VERSION}/docker-compose.yml"
35+
36+
sed -i -e "s/jenkins\/ath:latest/jenkins\/ath:${ATH_VERSION}/g" /tmp/ath.yml
37+
2938
# obtain the groupId to grant to access the docker socket to run tests needing docker
30-
dockergid=$(docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ubuntu:noble stat -c %g /var/run/docker.sock)
39+
if [[ -z ${DOCKER_GID:-} ]]; then
40+
DOCKER_GID=$(docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ubuntu:noble stat -c %g /var/run/docker.sock) || exit 1
41+
export DOCKER_GID
42+
fi
43+
44+
trap 'docker-compose --file /tmp/ath.yml kill && docker-compose --file /tmp/ath.yml down' EXIT
3145

32-
exec docker run --rm \
46+
exec docker-compose \
47+
--file /tmp/ath.yml \
48+
run \
3349
--env JDK \
3450
--env ATH_VERSION \
3551
--env BROWSER \
36-
--shm-size 2g `# avoid selenium.WebDriverException exceptions like 'Failed to decode response from marionette' and webdriver closed` \
37-
--group-add ${dockergid} \
52+
--name mvn \
53+
--no-TTY \
54+
--rm \
3855
--volume "$(pwd)"/war/target/jenkins.war:/jenkins.war:ro \
39-
--volume /var/run/docker.sock:/var/run/docker.sock:rw \
4056
--volume "$(pwd)"/target/ath-reports:/reports:rw \
41-
--interactive \
42-
jenkins/ath:"$ATH_VERSION" \
57+
mvn \
4358
bash <<-'INSIDE'
4459
set -o errexit
4560
set -o nounset
4661
set -o pipefail
4762
set -o xtrace
4863
cd
4964
set-java.sh "${JDK}"
50-
# Start the VNC system provided by the image from the default user home directory
51-
eval "$(vnc.sh)"
5265
env | sort
53-
git clone --branch "$ATH_VERSION" --depth 1 https://github.com/jenkinsci/acceptance-test-harness
66+
git clone --branch "${ATH_VERSION}" --depth 1 https://github.com/jenkinsci/acceptance-test-harness
5467
cd acceptance-test-harness
55-
run.sh "$BROWSER" /jenkins.war \
68+
run.sh "remote-webdriver-${BROWSER}" /jenkins.war \
5669
-Dmaven.test.failure.ignore \
5770
-DforkCount=1 \
5871
-Dgroups=org.jenkinsci.test.acceptance.junit.SmokeTest

core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ THE SOFTWARE.
5757
<dependency>
5858
<groupId>org.xmlunit</groupId>
5959
<artifactId>xmlunit-bom</artifactId>
60-
<version>2.10.1</version>
60+
<version>2.10.2</version>
6161
<type>pom</type>
6262
<scope>import</scope>
6363
</dependency>
@@ -453,7 +453,7 @@ THE SOFTWARE.
453453
</dependency>
454454
<dependency>
455455
<groupId>org.mockito</groupId>
456-
<artifactId>mockito-core</artifactId>
456+
<artifactId>mockito-junit-jupiter</artifactId>
457457
<scope>test</scope>
458458
</dependency>
459459
<dependency>

core/src/main/java/hudson/model/MyViewsProperty.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import hudson.security.ACL;
3535
import hudson.util.FormValidation;
3636
import hudson.util.ListBoxModel;
37+
import hudson.views.DefaultViewsTabBar;
3738
import hudson.views.MyViewsTabBar;
3839
import hudson.views.ViewsTabBar;
3940
import jakarta.servlet.ServletException;
@@ -81,6 +82,8 @@ public class MyViewsProperty extends UserProperty implements ModifiableViewGroup
8182
@CheckForNull
8283
private String primaryViewName;
8384

85+
private ViewsTabBar viewsTabBar = new DefaultViewsTabBar();
86+
8487
/**
8588
* Always hold at least one view.
8689
*/
@@ -124,6 +127,9 @@ public Object readResolve() {
124127
protected void primaryView(String name) { primaryViewName = name; }
125128
};
126129

130+
if (viewsTabBar == null) {
131+
viewsTabBar = new DefaultViewsTabBar();
132+
}
127133
return this;
128134
}
129135

@@ -284,6 +290,7 @@ public ListBoxModel doFillPrimaryViewNameItems(@AncestorInPath User user) throws
284290
MyViewsProperty property = user.getProperty(MyViewsProperty.class);
285291
if (property == null) {
286292
property = new MyViewsProperty();
293+
property.readResolve();
287294
user.addProperty(property);
288295
}
289296
for (View view : property.views) {
@@ -303,7 +310,11 @@ public UserProperty reconfigure(StaplerRequest2 req, JSONObject form) throws For
303310

304311
@Override
305312
public ViewsTabBar getViewsTabBar() {
306-
return Jenkins.get().getViewsTabBar();
313+
return viewsTabBar;
314+
}
315+
316+
public void setViewsTabBar(ViewsTabBar viewsTabBar) {
317+
this.viewsTabBar = viewsTabBar;
307318
}
308319

309320
@Override

core/src/main/java/hudson/model/Queue.java

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
import java.util.GregorianCalendar;
9494
import java.util.HashMap;
9595
import java.util.HashSet;
96-
import java.util.Iterator;
9796
import java.util.LinkedHashSet;
9897
import java.util.List;
9998
import java.util.Map;
@@ -1541,7 +1540,7 @@ public void maintain() {
15411540

15421541
{ // blocked -> buildable
15431542
// copy as we'll mutate the list and we want to process in a potentially different order
1544-
List<BlockedItem> blockedItems = new ArrayList<>(blockedProjects.values());
1543+
List<BlockedItem> blockedItems = new ArrayList<>((blockedProjects));
15451544
// if facing a cycle of blocked tasks, ensure we process in the desired sort order
15461545
if (s != null) {
15471546
s.sortBlockedItems(blockedItems);
@@ -2954,29 +2953,8 @@ public boolean containsKey(Task task) {
29542953
return get(task) != null;
29552954
}
29562955

2957-
public T remove(Task task) {
2958-
Iterator<T> it = iterator();
2959-
while (it.hasNext()) {
2960-
T t = it.next();
2961-
if (t.task.equals(task)) {
2962-
it.remove();
2963-
return t;
2964-
}
2965-
}
2966-
return null;
2967-
}
2968-
2969-
public void put(Task task, T item) {
2970-
assert item.task.equals(task);
2971-
add(item);
2972-
}
2973-
2974-
public ItemList<T> values() {
2975-
return this;
2976-
}
2977-
29782956
/**
2979-
* Works like {@link #remove(Task)} but also marks the {@link Item} as cancelled.
2957+
* Removes a task and marks the {@link Item} as cancelled.
29802958
*/
29812959
public T cancel(Task p) {
29822960
T x = get(p);

core/src/main/java/hudson/model/ViewGroup.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.LinkedHashSet;
3434
import java.util.List;
3535
import jenkins.model.Jenkins;
36+
import jenkins.views.ViewsTabBarUserProperty;
3637

3738
/**
3839
* Container of {@link View}s.
@@ -159,4 +160,23 @@ default List<Action> getViewActions() {
159160
return Jenkins.get().getActions();
160161
}
161162

163+
/**
164+
* Returns the ViewsTabBar that the user has configured.
165+
*
166+
* @return users TabBar
167+
* @since TODO
168+
*/
169+
default ViewsTabBar getUserViewsTabBar() {
170+
User user = User.current();
171+
if (user != null) {
172+
ViewsTabBarUserProperty viewsTabBarUserProperty = user.getProperty(ViewsTabBarUserProperty.class);
173+
if (viewsTabBarUserProperty != null) {
174+
ViewsTabBar userViewTabsBars = viewsTabBarUserProperty.getViewsTabBar();
175+
if (userViewTabsBars != null) {
176+
return userViewTabsBars;
177+
}
178+
}
179+
}
180+
return getViewsTabBar();
181+
}
162182
}

core/src/main/java/hudson/views/DefaultMyViewsTabBar.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
* @author Winston Prakash
3636
* @since 1.378
3737
* @see MyViewsTabBar
38+
* @deprecated No longer used
3839
*/
40+
@Deprecated
3941
public class DefaultMyViewsTabBar extends MyViewsTabBar {
4042
@DataBoundConstructor
4143
public DefaultMyViewsTabBar() {

core/src/main/java/hudson/views/MyViewsTabBar.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
* @author Winston Prakash
5959
* @since 1.378
6060
* @see MyViewsTabBarDescriptor
61+
* @deprecated Implement {@link ViewsTabBar}
6162
*/
63+
@Deprecated
6264
public abstract class MyViewsTabBar implements Describable<MyViewsTabBar>, ExtensionPoint {
6365
/**
6466
* Returns all the registered {@link ListViewColumn} descriptors.

core/src/main/java/jenkins/model/Jenkins.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,10 +1941,12 @@ public Jenkins getItemGroup() {
19411941
return this;
19421942
}
19431943

1944+
@Deprecated
19441945
public MyViewsTabBar getMyViewsTabBar() {
19451946
return myViewsTabBar;
19461947
}
19471948

1949+
@Deprecated
19481950
public void setMyViewsTabBar(MyViewsTabBar myViewsTabBar) {
19491951
this.myViewsTabBar = myViewsTabBar;
19501952
}

core/src/main/java/jenkins/security/ConfidentialStore.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package jenkins.security;
22

3+
import com.google.common.annotations.VisibleForTesting;
34
import edu.umd.cs.findbugs.annotations.CheckForNull;
45
import edu.umd.cs.findbugs.annotations.NonNull;
56
import hudson.Extension;
@@ -19,6 +20,8 @@
1920
import java.util.logging.Logger;
2021
import jenkins.model.Jenkins;
2122
import org.kohsuke.MetaInfServices;
23+
import org.kohsuke.accmod.Restricted;
24+
import org.kohsuke.accmod.restrictions.NoExternalUse;
2225

2326
/**
2427
* The actual storage for the data held by {@link ConfidentialKey}s, and the holder
@@ -98,9 +101,11 @@ public abstract class ConfidentialStore {
98101
return cs;
99102
}
100103

101-
static final class Mock extends ConfidentialStore {
104+
@Restricted(NoExternalUse.class)
105+
@VisibleForTesting
106+
public static final class Mock extends ConfidentialStore {
102107

103-
static final Mock INSTANCE = new Mock();
108+
public static final Mock INSTANCE = new Mock();
104109

105110
private final SecureRandom rand;
106111

@@ -116,7 +121,7 @@ static final class Mock extends ConfidentialStore {
116121
rand.setSeed(new byte[] {1, 2, 3, 4});
117122
}
118123

119-
void clear() {
124+
public void clear() {
120125
data.clear();
121126
}
122127

0 commit comments

Comments
 (0)