diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 00000000..0279984d --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,15 @@ +# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins + +name: cd +on: + workflow_dispatch: + check_run: + types: + - completed + +jobs: + maven-cd: + uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1 + secrets: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} diff --git a/.gitignore b/.gitignore index f73f658c..5a8e2d85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target/ /work/ -*.hpl \ No newline at end of file +*.hpl +.idea diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000..3fb584e0 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,7 @@ + + + io.jenkins.tools.incrementals + git-changelist-maven-extension + 1.4 + + diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 00000000..f7daf60d --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,3 @@ +-Pconsume-incrementals +-Pmight-produce-incrementals +-Dchangelist.format=%d.v%s diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..74c59b11 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,4 @@ +buildPlugin(useContainerAgent: true, configurations: [ + [platform: 'linux', jdk: '11'], + [platform: 'linux', jdk: '17'] +]) diff --git a/pom.xml b/pom.xml index ebf73f9c..b904e985 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 1.509.2 + 4.53 @@ -11,11 +11,11 @@ Keychains and Provisioning Profiles Management This Jenkins plugin integrates a keychains and provisioning profiles managment for iOS and OSX projects build on a mac. kpp-management-plugin - 1.0.1-SNAPSHOT + ${changelist} hpi http://wiki.jenkins-ci.org/display/JENKINS/Keychains+and+Provisioning+Profiles+Plugin - scm:git:ssh://github.com/jenkinsci/kpp-management-plugin.git + scm:git:https://github.com/jenkinsci/kpp-management-plugin.git scm:git:ssh://git@github.com/jenkinsci/kpp-management-plugin.git https://github.com/jenkinsci/kpp-management-plugin @@ -27,38 +27,27 @@ repo - - - - michaelb - Michael Bär - michael.baer@sic-software.com - - repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ - - - - - org.jenkins-ci.tools - maven-hpi-plugin - 1.95 - - - + + + 999999-SNAPSHOT + 2.361.4 + + High + diff --git a/src/main/java/com/sic/plugins/kpp/KPPKeychainsBuildWrapper.java b/src/main/java/com/sic/plugins/kpp/KPPKeychainsBuildWrapper.java index 6fc6fa5c..c7af4985 100644 --- a/src/main/java/com/sic/plugins/kpp/KPPKeychainsBuildWrapper.java +++ b/src/main/java/com/sic/plugins/kpp/KPPKeychainsBuildWrapper.java @@ -41,6 +41,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + +import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundConstructor; /** @@ -100,13 +102,11 @@ public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener l /** * Copy the keychains configured for this build job to the workspace of the job. * @param build the current build - * @throws IOException - * @throws InterruptedException */ private void copyKeychainsToWorkspace(AbstractBuild build) throws IOException, InterruptedException { FilePath projectWorkspace = build.getWorkspace(); - Hudson hudson = Hudson.getInstance(); + Jenkins hudson = Jenkins.get(); FilePath hudsonRoot = hudson.getRootPath(); if (copiedKeychains == null) { @@ -131,7 +131,7 @@ public DescriptorImpl getDescriptor() { } /** - * Descriptor of the {@link KPPKeychainBuildWrapper}. + * Descriptor of the KPPKeychainBuildWrapper. */ @Extension public static final class DescriptorImpl extends BuildWrapperDescriptor { diff --git a/src/main/java/com/sic/plugins/kpp/KPPManagementLink.java b/src/main/java/com/sic/plugins/kpp/KPPManagementLink.java index 85daee36..aacc6f31 100644 --- a/src/main/java/com/sic/plugins/kpp/KPPManagementLink.java +++ b/src/main/java/com/sic/plugins/kpp/KPPManagementLink.java @@ -37,6 +37,8 @@ import java.security.NoSuchAlgorithmException; import java.util.List; import javax.servlet.ServletException; + +import jenkins.model.Jenkins; import net.sf.json.JSONObject; import org.apache.commons.fileupload.FileItem; import org.kohsuke.stapler.StaplerProxy; @@ -103,15 +105,12 @@ public String getProvisioningProfilesPath() { * * @param req Request * @param rsp Response - * @throws ServletException - * @throws IOException - * @throws NoSuchAlgorithmException */ public void doUploadFile(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, NoSuchAlgorithmException { - Hudson.getInstance().checkPermission(Hudson.ADMINISTER); + Jenkins.get().checkPermission(Hudson.ADMINISTER); FileItem file = req.getFileItem("file"); if (file == null || file.getSize() == 0) { @@ -138,15 +137,12 @@ public void doUploadFile(StaplerRequest req, StaplerResponse rsp) throws * * @param req Request * @param rsp Response - * @throws ServletException - * @throws IOException - * @throws NoSuchAlgorithmException */ public void doSave(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, NoSuchAlgorithmException { - Hudson.getInstance().checkPermission(Hudson.ADMINISTER); + Jenkins.get().checkPermission(Hudson.ADMINISTER); JSONObject data = req.getSubmittedForm(); List keychains = req.bindJSONToList(KPPKeychain.class, data.get("keychain")); @@ -175,7 +171,7 @@ public String getUrlName() { @Override public Object getTarget() { - Hudson.getInstance().checkPermission(Hudson.ADMINISTER); + Jenkins.get().checkPermission(Hudson.ADMINISTER); KPPKeychainsProvider.getInstance().update(); KPPProvisioningProfilesProvider.getInstance().update(); return this; @@ -183,7 +179,7 @@ public Object getTarget() { @Override public void save() throws IOException { - Hudson.getInstance().checkPermission(Hudson.ADMINISTER); + Jenkins.get().checkPermission(Hudson.ADMINISTER); KPPKeychainsProvider.getInstance().save(); KPPProvisioningProfilesProvider.getInstance().save(); } diff --git a/src/main/java/com/sic/plugins/kpp/KPPNodeProperty.java b/src/main/java/com/sic/plugins/kpp/KPPNodeProperty.java index edf55dc6..6d8f154e 100644 --- a/src/main/java/com/sic/plugins/kpp/KPPNodeProperty.java +++ b/src/main/java/com/sic/plugins/kpp/KPPNodeProperty.java @@ -30,6 +30,7 @@ import hudson.model.Node; import hudson.slaves.NodeProperty; import hudson.slaves.NodePropertyDescriptor; +import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundConstructor; /** @@ -63,7 +64,7 @@ public String getProvisioningProfilesPath() { public static KPPNodeProperty getCurrentNodeProperties() { KPPNodeProperty property = Computer.currentComputer().getNode().getNodeProperties().get(KPPNodeProperty.class); if(property == null) { - property = Hudson.getInstance().getGlobalNodeProperties().get(KPPNodeProperty.class); + property = Jenkins.get().getGlobalNodeProperties().get(KPPNodeProperty.class); } return property; } diff --git a/src/main/java/com/sic/plugins/kpp/KPPProvisioningProfilesBuildWrapper.java b/src/main/java/com/sic/plugins/kpp/KPPProvisioningProfilesBuildWrapper.java index 2b82614c..c9aaa8b7 100644 --- a/src/main/java/com/sic/plugins/kpp/KPPProvisioningProfilesBuildWrapper.java +++ b/src/main/java/com/sic/plugins/kpp/KPPProvisioningProfilesBuildWrapper.java @@ -43,6 +43,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + +import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundConstructor; /** @@ -103,13 +105,11 @@ public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener l /** * Copy the provisioning profiles configured for this job to the mobile provisioning profile path of the node or master, where the job is executed. * @param build current build - * @throws IOException - * @throws InterruptedException */ private void copyProvisioningProfiles(AbstractBuild build) throws IOException, InterruptedException { - Hudson hudson = Hudson.getInstance(); - FilePath hudsonRoot = hudson.getRootPath(); + Jenkins jenkins = Jenkins.get(); + FilePath hudsonRoot = jenkins.getRootPath(); VirtualChannel channel; String toProvisioningProfilesDirectoryPath = null; @@ -235,4 +235,3 @@ public boolean tearDown(AbstractBuild build, BuildListener listener) } } - \ No newline at end of file diff --git a/src/main/java/com/sic/plugins/kpp/model/KPPCertificate.java b/src/main/java/com/sic/plugins/kpp/model/KPPCertificate.java index 1abc8ba3..f26ac579 100644 --- a/src/main/java/com/sic/plugins/kpp/model/KPPCertificate.java +++ b/src/main/java/com/sic/plugins/kpp/model/KPPCertificate.java @@ -55,7 +55,6 @@ public String getCodeSigningIdentityName() { /** * Set the code singing identity name. - * @param codeSigningIdentityName */ public void setCodeSigningIdentityName(String codeSigningIdentityName) { this.codeSigningIdentityName = codeSigningIdentityName; diff --git a/src/main/java/com/sic/plugins/kpp/model/KPPKeychain.java b/src/main/java/com/sic/plugins/kpp/model/KPPKeychain.java index 9c4edfc2..bd96b6c9 100644 --- a/src/main/java/com/sic/plugins/kpp/model/KPPKeychain.java +++ b/src/main/java/com/sic/plugins/kpp/model/KPPKeychain.java @@ -32,6 +32,8 @@ import hudson.util.Secret; import java.io.Serializable; import java.util.List; + +import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundConstructor; /** @@ -114,7 +116,6 @@ public final String getDescription() { /** * Set description. - * @param description */ public final void setDescription(String description) { this.description = description; @@ -163,7 +164,7 @@ public int hashCode() { * @return descriptor */ public Descriptor getDescriptor() { - Descriptor ds = Hudson.getInstance().getDescriptorOrDie(getClass()); + Descriptor ds = Jenkins.get().getDescriptorOrDie(getClass()); return ds; } @@ -178,4 +179,4 @@ public String getDisplayName() { return Messages.KPPKeychain_DisplayName(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/sic/plugins/kpp/model/KPPKeychainCertificatePair.java b/src/main/java/com/sic/plugins/kpp/model/KPPKeychainCertificatePair.java index 68cdd77b..a387c8d6 100644 --- a/src/main/java/com/sic/plugins/kpp/model/KPPKeychainCertificatePair.java +++ b/src/main/java/com/sic/plugins/kpp/model/KPPKeychainCertificatePair.java @@ -161,7 +161,6 @@ public String getKeychainFileName() { /** * Get the keychain from a given string. The string has to start with the keychain filename. - * @param keychainString * @return keychain */ public static KPPKeychain getKeychainFromString(String keychainString) { @@ -186,7 +185,6 @@ public static KPPKeychain getKeychainFromString(String keychainString) { /** * Concatenation keychain filename and keychain description in one string. - * @param k * @return concatenated keychain string */ private static String getKeychainString(KPPKeychain k) { diff --git a/src/main/java/com/sic/plugins/kpp/model/KPPProvisioningProfile.java b/src/main/java/com/sic/plugins/kpp/model/KPPProvisioningProfile.java index 145e7d7b..48545d0e 100644 --- a/src/main/java/com/sic/plugins/kpp/model/KPPProvisioningProfile.java +++ b/src/main/java/com/sic/plugins/kpp/model/KPPProvisioningProfile.java @@ -34,6 +34,9 @@ import java.io.File; import java.io.Serializable; import java.util.List; +import java.util.Objects; + +import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; @@ -136,7 +139,7 @@ public boolean equals(Object obj) { return false; } final KPPProvisioningProfile other = (KPPProvisioningProfile) obj; - if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) { + if (!Objects.equals(this.fileName, other.fileName)) { return false; } return true; @@ -154,7 +157,7 @@ public int hashCode() { * @return descriptor */ public Descriptor getDescriptor() { - Descriptor ds = Hudson.getInstance().getDescriptorOrDie(getClass()); + Descriptor ds = Jenkins.get().getDescriptorOrDie(getClass()); return ds; } diff --git a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseKeychainsProvider.java b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseKeychainsProvider.java index b8332779..9541bf8e 100644 --- a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseKeychainsProvider.java +++ b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseKeychainsProvider.java @@ -103,7 +103,6 @@ public static ExtensionList all() { /** * Call this method to update keychains from save action. The keychains from save action are merged into current keychains list. * Then this list is sychnronized with the upload folder. - * @param keychainsAfterSave */ public void updateKeychainsFromSave(ListkeychainsFromSave) { List ksCurrent = new ArrayList(getKeychains()); @@ -134,7 +133,6 @@ public void updateKeychainsFromSave(ListkeychainsFromSave) { /** * Checks if a given file item is a keychain file. - * @param item * @return true, if it is a keychain file. */ public boolean isKeychainFile(FileItem item) { diff --git a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvider.java b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvider.java index 8e8276f0..5beb13d4 100644 --- a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvider.java +++ b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvider.java @@ -99,9 +99,6 @@ public String getUploadDirectoryPath() { /** * Store uploaded file inside upload directory. - * @param fileItemToUpload - * @throws FileNotFoundException - * @throws IOException */ public void upload(FileItem fileItemToUpload) throws FileNotFoundException, IOException { // save uploaded file @@ -129,7 +126,6 @@ public String getConfigXmlFileName() { /** * Save provider config xml. - * @throws IOException */ public final void save() { try { diff --git a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvisioningProfilesProvider.java b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvisioningProfilesProvider.java index edb2026b..535bc976 100644 --- a/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvisioningProfilesProvider.java +++ b/src/main/java/com/sic/plugins/kpp/provider/KPPBaseProvisioningProfilesProvider.java @@ -95,7 +95,6 @@ public String getProvisioningProfilesPath() { /** * Set the path to the directory to store provisioning profiles on the master or standalone jenkins instance. - * @param provisioningProfilesPath */ public void setProvisioningProfilesPath(String provisioningProfilesPath) { this.provisioningProfilesPath = provisioningProfilesPath; @@ -120,7 +119,6 @@ public static ExtensionList all() { /** * Call this method to update provisioning profiles from save action. The provisioning profiles from save action are merged into current provisioning profiles list. * Then this list is sychnronized with the upload folder. - * @param provisioningProfilesAfterSave */ public void updateProvisioningProfilesFromSave(ListprovisioningProfilesFromSave) { List ppsCurrent = new ArrayList(getProvisioningProfiles()); @@ -152,7 +150,6 @@ public void updateProvisioningProfilesFromSave(Listprovi /** * Checks if a given file item is a mobile provision profile file. - * @param item * @return true, if it is a mobile provision profile file. */ public boolean isMobileProvisionProfileFile(FileItem item) { @@ -161,7 +158,6 @@ public boolean isMobileProvisionProfileFile(FileItem item) { /** * If the fileName contains the uuid at the end, so remove the uuid part. - * @param fileName * @return fileName without uuid */ public static String removeUUIDFromFileName(String fileName) { @@ -175,11 +171,10 @@ public static String removeUUIDFromFileName(String fileName) { /** * Get the filename of the provisioning profile in the shape of uuid.mobileprovision. - * @param uuid * @return filename */ public static String getUUIDFileName(String uuid) { return String.format("%s%s", uuid, FILE_EXTENSION); } -} \ No newline at end of file +} diff --git a/src/main/java/com/sic/plugins/kpp/provider/KPPProvisioningProfilesProvider.java b/src/main/java/com/sic/plugins/kpp/provider/KPPProvisioningProfilesProvider.java index debe80c6..9c41dc8f 100644 --- a/src/main/java/com/sic/plugins/kpp/provider/KPPProvisioningProfilesProvider.java +++ b/src/main/java/com/sic/plugins/kpp/provider/KPPProvisioningProfilesProvider.java @@ -25,6 +25,8 @@ package com.sic.plugins.kpp.provider; import static com.sic.plugins.kpp.provider.KPPBaseProvider.LOGGER; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.Extension; import hudson.ExtensionList; import java.io.BufferedReader; @@ -53,7 +55,6 @@ public static KPPProvisioningProfilesProvider getInstance() { /** * Get the file for a given provisioning profile file name. - * @param fileName * @return file */ public File getProvisioningFile(String fileName) { @@ -67,6 +68,7 @@ public File getProvisioningFile(String fileName) { * @param fileName name of the provisioning profile file * @return UUID */ + @SuppressFBWarnings(value = "DM_DEFAULT_ENCODING", justification = "Requires triage") public static String parseUUIDFromProvisioningProfileFile(String fileName) { String uuid = "UUID not found"; BufferedReader br = null; diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index ecc3ba74..4d150764 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,4 @@ +
This plugin integrates management of keychain and provisioning files for iOS and OSX projects. -
\ No newline at end of file +