Skip to content

Update infrastructure for PCT compatibility with recent Jenkins core #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.2</version>
<version>4.46</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -34,10 +34,10 @@
<properties>
<revision>1.20</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.222.4</jenkins.version>
<java.level>8</java.level>
<pipeline-model-definition-version>1.3.8</pipeline-model-definition-version>
<jcasc.version>1.41</jcasc.version>
<bom>2.263</bom>
<jenkins.version>2.263.1</jenkins.version>
<pipeline-model-definition.version>1.9.3</pipeline-model-definition.version>
<jcasc.version>1.51</jcasc.version>
</properties>

<repositories>
Expand Down Expand Up @@ -71,16 +71,10 @@
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-extensions</artifactId>
<version>${pipeline-model-definition-version}</version>
<version>${pipeline-model-definition.version}</version>
<!-- optional because the dependency subtree is quite large -->
<optional>true</optional>
</dependency>
<!-- TODO: remove after upgrading to Jenkins 2.171+ and migrating to f:secretTextarea -->
<dependency>
<groupId>io.jenkins.temp.jelly</groupId>
<artifactId>multiline-secrets-ui</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
Expand Down Expand Up @@ -148,7 +142,7 @@
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-definition</artifactId>
<version>${pipeline-model-definition-version}</version>
<version>${pipeline-model-definition.version}</version>
<scope>test</scope>
</dependency>
<!-- Dependencies for testing JCasC compatibility-->
Expand All @@ -164,23 +158,31 @@
<version>${jcasc.version}</version>
<scope>test</scope>
</dependency>
<!-- these dependencies are added to satisfy the enforcer rules -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.222.x</artifactId>
<version>11</version>
<artifactId>bom-${bom}.x</artifactId>
<version>984.vb5eaac999a7e</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-api</artifactId>
<version>${pipeline-model-definition.version}</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-stage-tags-metadata</artifactId>
<version>${pipeline-model-definition.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ public KeyMaterialFactory newKeyMaterialFactory(@Nonnull URL endpoint, @Nonnull
String usernameColonPassword = new String(Base64.getDecoder().decode(token), StandardCharsets.UTF_8);
int colon = usernameColonPassword.indexOf(':');
if (colon > 0) {
return new RegistryKeyMaterialFactory(usernameColonPassword.substring(0, colon), usernameColonPassword.substring(colon + 1), endpoint, launcher, env, listener, dockerExecutable).
contextualize(new KeyMaterialContext(WorkspaceList.tempDir(workspace)));
FilePath tempDir = WorkspaceList.tempDir(workspace);
if (tempDir != null) {
return new RegistryKeyMaterialFactory(usernameColonPassword.substring(0, colon), usernameColonPassword.substring(colon + 1), endpoint, launcher, env, listener, dockerExecutable).
contextualize(new KeyMaterialContext(tempDir));
} else {
listener.getLogger().println("Failed to create temporary directory for docker login");
}
}
} catch (IllegalArgumentException x) {
// not Base64-encoded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import com.cloudbees.plugins.credentials.common.StandardCredentials;
import hudson.Extension;
import org.jenkinsci.plugins.credentialsbinding.MultiBinding;
import org.jenkinsci.plugins.pipeline.modeldefinition.model.CredentialsBindingHandler;

import javax.annotation.Nonnull;
Expand All @@ -37,12 +36,6 @@
@Extension(optional = true)
public class DockerServerCredentialsHandler extends CredentialsBindingHandler<DockerServerCredentials> {

@Nonnull
@Override
public List<MultiBinding<DockerServerCredentials>> toBindings(String varName, String credentialsId) {
return Collections.singletonList(new DockerServerCredentialsBinding(varName, credentialsId));
}

@Nonnull
@Override
public Class<? extends StandardCredentials> type() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<f:entry title="${%Client Key}" field="clientKeySecret">
<s:secretTextarea xmlns:s="/io/jenkins/temp/jelly"/>
<f:secretTextarea/>
</f:entry>
<f:entry title="${%Client Certificate}" field="clientCertificate">
<f:textarea/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void smokes() throws Exception {
} catch (IOException x) {
Assume.assumeNoException("Cannot contact download sites, perhaps test machine is not online", x);
}
String[] testedVersions = {"17.09.1-ce", "1.12.6", "1.10.0", "latest"};
String[] testedVersions = {"19.03.9"};
DockerTool[] installations = new DockerTool[testedVersions.length];
for (int i = 0; i < testedVersions.length; i++) {
String v = testedVersions[i];
Expand Down