├── .gitignore ├── .travis.yml ├── EnvVar-1.png ├── EnvVar-2.png ├── EnvVars-3.png ├── LICENSE ├── OWNERS ├── PR-Testing ├── .gitignore ├── Dockerfile-jenkins-test-new-plugin ├── README └── build-jenkins-plugin-snapshot-image.sh ├── README.md ├── RELEASING.md ├── deploy.sh ├── pom.xml └── src └── main ├── java └── com │ └── openshift │ └── jenkins │ └── plugins │ └── pipeline │ ├── Argument.java │ ├── Auth.java │ ├── Common.java │ ├── ImageStreamRevisionState.java │ ├── MessageConstants.java │ ├── NameValuePair.java │ ├── OpenShiftApiObjHandler.java │ ├── OpenShiftBasePostAction.java │ ├── OpenShiftBaseStep.java │ ├── OpenShiftBuildCanceller.java │ ├── OpenShiftBuildVerifier.java │ ├── OpenShiftBuilder.java │ ├── OpenShiftCreator.java │ ├── OpenShiftDeleterJsonYaml.java │ ├── OpenShiftDeleterLabels.java │ ├── OpenShiftDeleterList.java │ ├── OpenShiftDeployCanceller.java │ ├── OpenShiftDeployer.java │ ├── OpenShiftDeploymentVerifier.java │ ├── OpenShiftExec.java │ ├── OpenShiftImageStreams.java │ ├── OpenShiftImageTagger.java │ ├── OpenShiftItemListener.java │ ├── OpenShiftScaler.java │ ├── OpenShiftScalerPostAction.java │ ├── OpenShiftServiceVerifier.java │ ├── ParamVerify.java │ ├── TimedBuildStepDescriptor.java │ ├── TimedOpenShiftBasePostAction.java │ ├── TimedOpenShiftBaseStep.java │ ├── dsl │ ├── OpenShiftBaseStep.java │ ├── OpenShiftBuildVerifier.java │ ├── OpenShiftBuildVerifierExecution.java │ ├── OpenShiftBuilder.java │ ├── OpenShiftBuilderExecution.java │ ├── OpenShiftCreator.java │ ├── OpenShiftCreatorExecution.java │ ├── OpenShiftDeleterJsonYaml.java │ ├── OpenShiftDeleterJsonYamlExecution.java │ ├── OpenShiftDeleterLabels.java │ ├── OpenShiftDeleterLabelsExecution.java │ ├── OpenShiftDeleterList.java │ ├── OpenShiftDeleterListExecution.java │ ├── OpenShiftDeployer.java │ ├── OpenShiftDeployerExecution.java │ ├── OpenShiftDeploymentVerifier.java │ ├── OpenShiftDeploymentVerifierExecution.java │ ├── OpenShiftExec.java │ ├── OpenShiftExecExecution.java │ ├── OpenShiftImageStreams.java │ ├── OpenShiftImageTagger.java │ ├── OpenShiftImageTaggerExecution.java │ ├── OpenShiftScaler.java │ ├── OpenShiftScalerExecution.java │ ├── OpenShiftServiceVerifier.java │ ├── OpenShiftServiceVerifierExecution.java │ └── TimedOpenShiftBaseStep.java │ └── model │ ├── GlobalConfig.java │ ├── IOpenShiftApiObjHandler.java │ ├── IOpenShiftBuildVerifier.java │ ├── IOpenShiftBuilder.java │ ├── IOpenShiftCreator.java │ ├── IOpenShiftDeleterJsonYaml.java │ ├── IOpenShiftDeleterLabels.java │ ├── IOpenShiftDeleterList.java │ ├── IOpenShiftDeployer.java │ ├── IOpenShiftDeploymentVerification.java │ ├── IOpenShiftExec.java │ ├── IOpenShiftImageTagger.java │ ├── IOpenShiftParameterOverrides.java │ ├── IOpenShiftPlugin.java │ ├── IOpenShiftPluginDescriptor.java │ ├── IOpenShiftScaler.java │ ├── IOpenShiftServiceVerifier.java │ ├── ITimedOpenShiftPlugin.java │ └── RetryIClient.java ├── resources ├── com │ └── openshift │ │ └── jenkins │ │ └── plugins │ │ └── pipeline │ │ ├── Argument │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-value.html │ │ ├── Common │ │ ├── cluster.jelly │ │ ├── global-wait.jelly │ │ ├── verbose-wait.jelly │ │ └── verbose.jelly │ │ ├── NameValuePair │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-name.html │ │ └── help-value.html │ │ ├── OpenShiftBuildCanceller │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-bldCfg.html │ │ ├── OpenShiftBuildVerifier │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-bldCfg.html │ │ └── help-checkForTriggeredDeployments.html │ │ ├── OpenShiftBuilder │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-bldCfg.html │ │ ├── help-buildName.html │ │ ├── help-checkForTriggeredDeployments.html │ │ ├── help-commitID.html │ │ ├── help-env.html │ │ └── help-showBuildLogs.html │ │ ├── OpenShiftCreator │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-jsonyaml.html │ │ ├── OpenShiftDeleterJsonYaml │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-jsonyaml.html │ │ ├── OpenShiftDeleterLabels │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-keys.html │ │ ├── help-types.html │ │ └── help-values.html │ │ ├── OpenShiftDeleterList │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-keys.html │ │ └── help-types.html │ │ ├── OpenShiftDeployCanceller │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-depCfg.html │ │ ├── OpenShiftDeployer │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-depCfg.html │ │ ├── OpenShiftDeploymentVerifier │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-depCfg.html │ │ ├── help-replicaCount.html │ │ └── help-verifyReplicaCount.html │ │ ├── OpenShiftExec │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-arguments.html │ │ ├── help-command.html │ │ ├── help-container.html │ │ └── help-pod.html │ │ ├── OpenShiftImageStreams │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-imageStreamName.html │ │ └── help-tag.html │ │ ├── OpenShiftImageTagger │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-alias.html │ │ ├── help-destinationAuthToken.html │ │ ├── help-destinationNamespace.html │ │ ├── help-prodStream.html │ │ ├── help-prodTag.html │ │ ├── help-testStream.html │ │ └── help-testTag.html │ │ ├── OpenShiftScaler │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-depCfg.html │ │ ├── help-replicaCount.html │ │ └── help-verifyReplicaCount.html │ │ ├── OpenShiftScalerPostAction │ │ ├── config.jelly │ │ ├── global.jelly │ │ ├── help-depCfg.html │ │ ├── help-replicaCount.html │ │ └── help-verifyReplicaCount.html │ │ ├── OpenShiftServiceVerifier │ │ ├── config.jelly │ │ ├── global.jelly │ │ └── help-svcName.html │ │ └── dsl │ │ ├── OpenShiftBuildVerifier │ │ ├── config.jelly │ │ ├── help-bldCfg.html │ │ └── help-checkForTriggeredDeployments.html │ │ ├── OpenShiftBuilder │ │ ├── config.jelly │ │ ├── help-bldCfg.html │ │ ├── help-buildName.html │ │ ├── help-checkForTriggeredDeployments.html │ │ ├── help-commitID.html │ │ ├── help-env.html │ │ └── help-showBuildLogs.html │ │ ├── OpenShiftCreator │ │ ├── config.jelly │ │ └── help-jsonyaml.html │ │ ├── OpenShiftDeleterJsonYaml │ │ ├── config.jelly │ │ └── help-jsonyaml.html │ │ ├── OpenShiftDeleterLabels │ │ ├── config.jelly │ │ ├── help-keys.html │ │ ├── help-types.html │ │ └── help-values.html │ │ ├── OpenShiftDeleterList │ │ ├── config.jelly │ │ ├── help-keys.html │ │ └── help-types.html │ │ ├── OpenShiftDeployer │ │ ├── config.jelly │ │ └── help-depCfg.html │ │ ├── OpenShiftDeploymentVerifier │ │ ├── config.jelly │ │ ├── help-depCfg.html │ │ ├── help-replicaCount.html │ │ └── help-verifyReplicaCount.html │ │ ├── OpenShiftExec │ │ ├── config.jelly │ │ ├── help-arguments.html │ │ ├── help-command.html │ │ ├── help-container.html │ │ └── help-pod.html │ │ ├── OpenShiftImageStreams │ │ ├── config.jelly │ │ ├── help-name.html │ │ └── help-tag.html │ │ ├── OpenShiftImageTagger │ │ ├── config.jelly │ │ ├── help-alias.html │ │ ├── help-destStream.html │ │ ├── help-destTag.html │ │ ├── help-destinationAuthToken.html │ │ ├── help-destinationNamespace.html │ │ ├── help-srcStream.html │ │ └── help-srcTag.html │ │ ├── OpenShiftScaler │ │ ├── config.jelly │ │ ├── help-depCfg.html │ │ ├── help-replicaCount.html │ │ └── help-verifyReplicaCount.html │ │ └── OpenShiftServiceVerifier │ │ ├── config.jelly │ │ └── help-svcName.html └── index.jelly └── webapp ├── help-apiURL.html ├── help-authToken.html ├── help-namespace.html ├── help-verbose.html ├── help-waitTime.html └── help-waitUnit.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | target/ 15 | .classpath 16 | .project 17 | .settings/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - openjdk8 5 | 6 | script: 7 | mvn clean verify 8 | 9 | sudo: false 10 | -------------------------------------------------------------------------------- /EnvVar-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/openshift-pipeline-plugin/5d250c2892abb9ef4f6d6fbbb3f82394e84c3bcb/EnvVar-1.png -------------------------------------------------------------------------------- /EnvVar-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/openshift-pipeline-plugin/5d250c2892abb9ef4f6d6fbbb3f82394e84c3bcb/EnvVar-2.png -------------------------------------------------------------------------------- /EnvVars-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/openshift-pipeline-plugin/5d250c2892abb9ef4f6d6fbbb3f82394e84c3bcb/EnvVars-3.png -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | approvers: 2 | - bparees 3 | - gabemontero 4 | - adambkaplan 5 | - akram 6 | - waveywaves 7 | - jkhelil 8 | 9 | -------------------------------------------------------------------------------- /PR-Testing/.gitignore: -------------------------------------------------------------------------------- 1 | /jpi/ 2 | -------------------------------------------------------------------------------- /PR-Testing/Dockerfile-jenkins-test-new-plugin: -------------------------------------------------------------------------------- 1 | FROM openshift/jenkins-2-centos7 2 | USER root 3 | RUN touch /opt/openshift/configuration/plugins.txt 4 | RUN touch /opt/openshift/plugins/openshift-pipeline-plugin.lock 5 | COPY ./jpi /opt/openshift/plugins 6 | RUN /usr/local/bin/install-plugins.sh /opt/openshift/configuration/plugins.txt 7 | -------------------------------------------------------------------------------- /PR-Testing/README: -------------------------------------------------------------------------------- 1 | These files are leveraged by the test-openshift-pipeline-plugin job at https://ci.openshift.redhat.com/jenkins. 2 | A test image based off of the jenkins image at https://github.com/openshift/jenkins will be built with the dockerfile 3 | here and any OpenShift Jenkins plugin file stored in the PR-Testing/jpi file as "openshift-pipeline.jpi". In the case of 4 | the https://ci.openshift.redhat.com/jenkins/view/All/job/test_branch_jenkins_plugin/ job , it will be the hpi file from your PR. But you can also test any local changes 5 | you have to the plugin in the same way. 6 | 7 | To test your changes locally: 8 | - Build the Jenkins plugin with maven (e.g. mvn clean package) 9 | - In the PR-Testing folder, run `./build-jenkins-plugin-snapshot-image.sh` 10 | 11 | This script will build the docker image: openshift/jenkins-plugin-snapshot-test:latest 12 | 13 | Next, run the extended tests for the plugin located at https://github.com/openshift/origin. 14 | To target the snapshot image built above, set the environment variable USE_SNAPSHOT_JENKINS_IMAGE 15 | to a non-empty string. For example, from the top level directory of the origin repository, run: 16 | USE_SNAPSHOT_JENKINS_IMAGE=1 make test-extended SUITE=core FOCUS='openshift pipeline plugin' 17 | 18 | Note: Specifying the environment variable on the same line as the command to run limits the variable's lifetime to 19 | the invocation of the test framework. Limiting the variable's lifetime is not required, but is encouraged to ensure 20 | you do not unintentionally run tests against the local Jenkins image at a later time. 21 | 22 | If the USE_SNAPSHOT_JENKINS_IMAGE variable is not set, the extended tests will ignore the local snapshot image and 23 | test the official jenkins image (see https://github.com/openshift/jenkins). 24 | -------------------------------------------------------------------------------- /PR-Testing/build-jenkins-plugin-snapshot-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -f "Dockerfile-jenkins-test-new-plugin" ]; then 4 | echo "This command must be run from the PR-Testing directory" 5 | exit 1 6 | fi 7 | 8 | HPI="../target/openshift-pipeline.hpi" 9 | 10 | if [ ! -f "$HPI" ]; then 11 | echo "Unable to find HPI artifact (have you run mvn yet?): $HPI" 12 | exit 1 13 | fi 14 | 15 | mkdir -p jpi 16 | 17 | cp -f "$HPI" jpi/openshift-pipeline.jpi 18 | if [ "$?" != "0" ]; then 19 | echo "Unable to copy $HPI" 20 | exit 1 21 | fi 22 | 23 | docker build -f ./Dockerfile-jenkins-test-new-plugin -t openshift/jenkins-plugin-snapshot-test:latest . 24 | if [ "$?" != "0" ]; then 25 | echo "Error building Jenkins snapshot image for plugin testing" 26 | exit 1 27 | fi 28 | 29 | echo "Success. Remember to set USE_SNAPSHOT_JENKINS_IMAGE=1 when running origin extended tests." 30 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Process for cutting release of this plugin 2 | 3 | As noted in this repository's README.md, the documentation and code at [https://github.com/openshift/jenkins-plugin](https://github.com/openshift/jenkins-plugin) always hosts the very latest version, including possibly pre-released versions that are still under test. 4 | The associated repository under the JenkinsCI project, [https://github.com/jenkinsci/openshift-pipeline-plugin](https://github.com/jenkinsci/openshift-pipeline-plugin), is only updated as part of cutting 5 | official releases of this plugin. 6 | 7 | To cut a new release of this plugin, first perform a `git clone` of [https://github.com/jenkinsci/openshift-pipeline-plugin](https://github.com/jenkinsci/openshift-pipeline-plugin), 8 | 9 | ## Set up local repository to cut release: 10 | 11 | 1. From the parent directory you've chosen for you local repository, run `git clone git@github.com:jenkinsci/openshift-pipeline-plugin.git` 12 | 1. Change directories into `openshift-pipeline-plugin`, and run `git remote add upstream git://github.com/openshift/jenkins-plugin` 13 | 1. Then pull the latest changes from [https://github.com/openshift/jenkins-plugin](https://github.com/openshift/jenkins-plugin) with the following: 14 | 15 | ``` 16 | $ git checkout master 17 | $ git fetch upstream 18 | $ git fetch upstream --tags 19 | $ git rebase upstream/master 20 | $ git push origin master 21 | $ git push origin --tags 22 | ``` 23 | 24 | ## Submit the new release to the Jenkins organization 25 | 26 | Assumptions: your Git ID has push access to the two repositories for this plugin; your Jenkins ID (https://wiki.jenkins-ci.org/display/JENKINS/User+Account+on+Jenkins) is listed in https://github.com/jenkins-infra/repository-permissions-updater/blob/master/permissions/plugin-openshift-pipeline.yml. Given these assumptions: 27 | 28 | 1. Then run `mvn release:prepare release:perform` 29 | 1. You'll minimally be prompted for the `release version`, `release tag`, and the `new development version`. Default choices will be provided for each, and the defaults are typically acceptable, so you can just hit the enter key for all three prompts. As an example, if we are currently at v1.0.36, it will provide 1.0.37 for the new `release version` and `release tag`. For the `new development version` it will provide 1.0.38-SNAPSHOT, which is again acceptable. The only time you *might* have to override the default provided is if we currently depend on a SNAPSHOT version of openshift-restclient-java (e.g. `5.3.0-SNAPSHOT`). This occurs when we add new features to openshift-restclient-java, but the eclipse team has not cut a new, official release (which will typically look like `5.3.0-FINAL`). If we are in such a mode, you'll get prompted about moving off the SNAPSHOT version (the default provided would be `5.3.0`), but override this (i.e. type in `5.3.0-SNAPSHOT`). 30 | 1. The `mvn release:prepare release:perform` command will take a few minutes to build the plugin and go through various verifications, followed by a push of the built artifacts up to Jenkins. This typically works without further involvement but has failed for various reasons in the past. If so, to retry with the same release version, you'll need to call `git reset` to back of the two commits created as part of publishing the release, as well as use `git tag` to delete both the local and remote version of the corresponding tag. After deleting the commits and tags, use `git push -f` to update the commits at [https://github.com/jenkinsci/openshift-pipeline-plugin](https://github.com/jenkinsci/openshift-pipeline-plugin). Address whatever issues you have (you might have to solicit help on the Jenkins developer group: https://groups.google.com/forum/#!forum/jenkinsci-dev) and try again. 31 | 1. Run `git push https://github.com/openshift/jenkins-plugin.git master` to upload the 2 commits created for cutting the new release to our upstream, development repository, and get the two repositories back in sync. 32 | 1. Monitor https://updates.jenkins-ci.org/download/plugins/openshift-pipeline/ for the existence of the new version of the plugin. Warning: the link for the new version will show up, but does not mean the `openshift-pipeline.hpi` file is available yet. Click the link to confirm you can download the new version of the plugin. When you can download the latest `openshift-pipeline.hpi` file, the process is complete, and the new release is available. 33 | 34 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Deploys locally the plugin in a pod which has label name=jenkins 4 | # You must be correctly logged in an OpenShift or Kubernetes cluster (KUBECONFIG set or oc login) 5 | pod_name=$( oc get pods -l name=jenkins --output=name | cut -f2 -d/) 6 | plugin_path=/var/lib/jenkins/plugins 7 | plugin_name=$( xmllint --xpath "/*[local-name() = 'project']/*[local-name() = 'artifactId']/text()" pom.xml ) 8 | plugin_dst_extension=jpi 9 | plugin_src_extension=hpi 10 | plugin_full_path=$plugin_path/$plugin_name.$plugin_dst_extension 11 | 12 | local_plugin_path=target/$plugin_name.$plugin_src_extension 13 | remote_plugin_path=$pod_name:$plugin_full_path 14 | remote_plugin_directory=$plugin_path/$plugin_name 15 | 16 | echo "Copying $local_plugin_path into $remote_plugin_path" 17 | oc cp $local_plugin_path $remote_plugin_path 18 | echo "Unzipping $plugin_full_path into $remote_plugin_directory" 19 | oc exec $pod_name -- unzip -o $plugin_full_path -d $remote_plugin_directory 20 | echo "Restarting container" 21 | oc exec $pod_name -- kill 1 22 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/Argument.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import hudson.Extension; 4 | import hudson.model.AbstractDescribableImpl; 5 | import hudson.model.Descriptor; 6 | import hudson.util.FormValidation; 7 | import org.kohsuke.stapler.DataBoundConstructor; 8 | import org.kohsuke.stapler.QueryParameter; 9 | 10 | import java.io.Serializable; 11 | 12 | public class Argument extends AbstractDescribableImpl implements 13 | Serializable { 14 | 15 | protected final String value; 16 | 17 | @DataBoundConstructor 18 | public Argument(String value) { 19 | this.value = value; 20 | } 21 | 22 | public String getValue() { 23 | return value; 24 | } 25 | 26 | @Extension 27 | public static class DescriptorImpl extends Descriptor { 28 | 29 | @Override 30 | public String getDisplayName() { 31 | return "Argument"; 32 | } 33 | 34 | public FormValidation doCheckValue(@QueryParameter String value) { 35 | return FormValidation.validateRequired(value); 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/Common.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import hudson.Extension; 4 | import hudson.model.AbstractDescribableImpl; 5 | import hudson.model.Descriptor; 6 | import org.kohsuke.stapler.DataBoundConstructor; 7 | 8 | /** 9 | * Functionless stub class to establish a path to common *.jelly files (e.g. 10 | * st:include page="cluster.jelly" 11 | * class="com.openshift.jenkins.plugins.pipeline.Common" ) 12 | */ 13 | public class Common extends AbstractDescribableImpl { 14 | 15 | @DataBoundConstructor 16 | public Common() { 17 | } 18 | 19 | @Extension 20 | public static class DescriptorImpl extends Descriptor { 21 | public String getDisplayName() { 22 | return "Common"; 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/ImageStreamRevisionState.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import hudson.scm.SCMRevisionState; 4 | 5 | public class ImageStreamRevisionState extends SCMRevisionState implements 6 | Comparable { 7 | 8 | private final String commitId; 9 | 10 | public ImageStreamRevisionState(String commitId) { 11 | if (commitId == null) 12 | throw new IllegalArgumentException("nulls not allowed"); 13 | this.commitId = commitId.trim(); 14 | } 15 | 16 | @Override 17 | public int hashCode() { 18 | final int prime = 31; 19 | int result = 1; 20 | result = prime * result 21 | + ((commitId == null) ? 0 : commitId.hashCode()); 22 | return result; 23 | } 24 | 25 | @Override 26 | public boolean equals(Object obj) { 27 | if (this == obj) 28 | return true; 29 | if (obj == null) 30 | return false; 31 | if (getClass() != obj.getClass()) 32 | return false; 33 | ImageStreamRevisionState other = (ImageStreamRevisionState) obj; 34 | // remove some code from auto-generated equals since we force commitId 35 | // to be set via constructor 36 | // if (commitId == null) { 37 | // if (other.commitId != null) 38 | // return false; 39 | /* } else */if (!commitId.equals(other.commitId)) 40 | return false; 41 | return true; 42 | } 43 | 44 | @Override 45 | public int compareTo(ImageStreamRevisionState o) { 46 | if (o == null) 47 | return 1; 48 | // constructor enforces commitId to not be null 49 | return this.commitId.compareTo(o.commitId); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "ImageStreamRevisionState [commitId=" + commitId + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/NameValuePair.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import hudson.Extension; 4 | import hudson.model.AbstractDescribableImpl; 5 | import hudson.model.Descriptor; 6 | import hudson.util.FormValidation; 7 | import org.kohsuke.stapler.DataBoundConstructor; 8 | import org.kohsuke.stapler.QueryParameter; 9 | 10 | public class NameValuePair extends AbstractDescribableImpl { 11 | 12 | protected final String name; 13 | protected final String value; 14 | 15 | @DataBoundConstructor 16 | public NameValuePair(String name, String value) { 17 | this.name = name != null ? name.trim() : null; 18 | this.value = value != null ? value.trim() : null; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public String getValue() { 26 | return value; 27 | } 28 | 29 | @Extension 30 | public static class DescriptorImpl extends Descriptor { 31 | public String getDisplayName() { 32 | return "Name/Value Pair"; 33 | } 34 | 35 | public FormValidation doCheckName(@QueryParameter String value) { 36 | return FormValidation.validateRequired(value); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftApiObjHandler.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class OpenShiftApiObjHandler { 7 | // POST https://localhost:8443/apis/extensions/v1beta1/namespaces/test/jobs 8 | // POST https://localhost:8443/oapi/v1/namespaces/test/imagestreams 9 | public final static String api = "/api"; 10 | public final static String oapi = "/oapi"; 11 | public final static String apis = "/apis"; 12 | 13 | public static final Map typeShortcut; 14 | public static final Map apiMap; 15 | static { 16 | // a starter set of API endpoints, which will be updated via calls 17 | // to fetchApiJsonFromGithub(boolean, TaskListener, Map, 18 | // String) 19 | // and importJsonOfApiTypes(boolean, TaskListener, Map, 20 | // String, String) 21 | 22 | // OpenShift API endpoints 23 | apiMap = new HashMap(); 24 | apiMap.put("BuildConfig", new String[] { oapi, "buildconfigs" }); 25 | apiMap.put("Build", new String[] { oapi, "builds" }); 26 | apiMap.put("DeploymentConfigRollback", new String[] { oapi, 27 | "deploymentconfigrollbacks" }); 28 | apiMap.put("DeploymentConfig", 29 | new String[] { oapi, "deploymentconfigs" }); 30 | apiMap.put("ImageStreamMapping", new String[] { oapi, 31 | "imagestreammappings" }); 32 | apiMap.put("ImageStream", new String[] { oapi, "imagestreams" }); 33 | apiMap.put("LocalResourceAccessReview", new String[] { oapi, 34 | "localresourceaccessreviews" }); 35 | apiMap.put("LocalSubjectAccessReview", new String[] { oapi, 36 | "localsubjectaccessreviews" }); 37 | apiMap.put("Policy", new String[] { oapi, "policies" }); 38 | apiMap.put("PolicyBinding", new String[] { oapi, "policybindings" }); 39 | // apiMap.put("Template", new String[]{oapi, "processedtemplates"}); // 40 | // Different from templates? 41 | apiMap.put("ResourceAccessReview", new String[] { oapi, 42 | "resourceaccessreviews" }); 43 | apiMap.put("RoleBinding", new String[] { oapi, "rolebindings" }); 44 | apiMap.put("Role", new String[] { oapi, "roles" }); 45 | apiMap.put("Route", new String[] { oapi, "routes" }); 46 | apiMap.put("SubjectAccessReview", new String[] { oapi, 47 | "subjectaccessreviews" }); 48 | apiMap.put("Template", new String[] { oapi, "templates" }); 49 | 50 | // Kubernetes API endpoints 51 | apiMap.put("Binding", new String[] { api, "bindings" }); 52 | apiMap.put("Endpoint", new String[] { api, "endpoints" }); 53 | apiMap.put("Event", new String[] { api, "events" }); 54 | apiMap.put("LimitRange", new String[] { api, "limitranges" }); 55 | apiMap.put("PersistentVolumeClaim", new String[] { api, 56 | "persistentvolumeclaims" }); 57 | apiMap.put("Pod", new String[] { api, "pods" }); 58 | apiMap.put("PodTemplate", new String[] { api, "podtemplates" }); 59 | apiMap.put("ReplicationController", new String[] { api, 60 | "replicationcontrollers" }); 61 | apiMap.put("ResourceQuota", new String[] { api, "resourcequotas" }); 62 | apiMap.put("Secret", new String[] { api, "secrets" }); 63 | apiMap.put("ServiceAccount", new String[] { api, "serviceaccounts" }); 64 | apiMap.put("Service", new String[] { api, "services" }); 65 | apiMap.put("Job", new String[] { apis, "jobs" }); 66 | 67 | typeShortcut = new HashMap(); 68 | typeShortcut.put("build", "Build"); 69 | typeShortcut.put("bc", "BuildConfig"); 70 | typeShortcut.put("dc", "DeploymentConfig"); 71 | typeShortcut.put("is", "ImageStream"); 72 | typeShortcut.put("istag", "ImageStreamTag"); 73 | typeShortcut.put("route", "Route"); 74 | typeShortcut.put("rc", "ReplicationController"); 75 | typeShortcut.put("secret", "Secret"); 76 | typeShortcut.put("svc", "Service"); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftBasePostAction.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin; 4 | import hudson.FilePath; 5 | import hudson.Launcher; 6 | import hudson.model.AbstractBuild; 7 | import hudson.model.BuildListener; 8 | import hudson.model.Run; 9 | import hudson.model.TaskListener; 10 | import hudson.tasks.BuildStepMonitor; 11 | import hudson.tasks.Recorder; 12 | import jenkins.tasks.SimpleBuildStep; 13 | 14 | import java.io.IOException; 15 | import java.io.Serializable; 16 | 17 | public abstract class OpenShiftBasePostAction extends Recorder implements 18 | SimpleBuildStep, Serializable, IOpenShiftPlugin { 19 | 20 | protected final String apiURL; 21 | protected final String namespace; 22 | protected final String authToken; 23 | protected final String verbose; 24 | protected transient Auth auth; 25 | 26 | public OpenShiftBasePostAction(String apiURL, String namespace, 27 | String authToken, String verbose) { 28 | this.apiURL = apiURL != null ? apiURL.trim() : null; 29 | this.namespace = namespace != null ? namespace.trim() : null; 30 | this.authToken = authToken != null ? authToken.trim() : null; 31 | this.verbose = verbose != null ? verbose.trim() : null; 32 | } 33 | 34 | // generically speaking, Jenkins will always pass in non-null field values. 35 | // However, as we have periodically 36 | // added new fields, jobs created with earlier versions of the plugin get 37 | // null for the new fields. Hence, 38 | // we have introduced the generic convention (even for fields that existed 39 | // in the initial incarnations of the plugin) 40 | // of insuring nulls are not returned for field getters 41 | 42 | public String getApiURL() { 43 | return apiURL; 44 | } 45 | 46 | public String getNamespace() { 47 | return namespace; 48 | } 49 | 50 | public String getAuthToken() { 51 | return authToken; 52 | } 53 | 54 | public String getVerbose() { 55 | return verbose; 56 | } 57 | 58 | @Override 59 | public void setAuth(Auth auth) { 60 | this.auth = auth; 61 | } 62 | 63 | @Override 64 | public Auth getAuth() { 65 | return auth; 66 | } 67 | 68 | @Override 69 | public String getBaseClassName() { 70 | return OpenShiftBasePostAction.class.getName(); 71 | } 72 | 73 | @Override 74 | public BuildStepMonitor getRequiredMonitorService() { 75 | return BuildStepMonitor.NONE; 76 | } 77 | 78 | @Override 79 | public boolean needsToRunAfterFinalized() { 80 | return true; 81 | } 82 | 83 | // this is the workflow plugin path 84 | @Override 85 | public void perform(Run run, FilePath workspace, Launcher launcher, 86 | TaskListener listener) throws InterruptedException, IOException { 87 | this.doIt(run, workspace, launcher, listener); 88 | } 89 | 90 | // this is the classic post build action path 91 | @Override 92 | public boolean perform(AbstractBuild build, Launcher launcher, 93 | BuildListener listener) throws IOException, InterruptedException { 94 | return this.doIt(build, launcher, listener); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftBaseStep.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin; 4 | import hudson.FilePath; 5 | import hudson.Launcher; 6 | import hudson.model.AbstractBuild; 7 | import hudson.model.BuildListener; 8 | import hudson.model.Run; 9 | import hudson.model.TaskListener; 10 | import hudson.tasks.Builder; 11 | import jenkins.tasks.SimpleBuildStep; 12 | 13 | import java.io.IOException; 14 | import java.io.Serializable; 15 | 16 | //import com.openshift.restclient.authorization.TokenAuthorizationStrategy; 17 | 18 | public abstract class OpenShiftBaseStep extends Builder implements 19 | SimpleBuildStep, Serializable, IOpenShiftPlugin { 20 | 21 | protected final String apiURL; 22 | protected final String namespace; 23 | protected final String authToken; 24 | protected final String verbose; 25 | // marked transient so don't serialize these next 2 in the workflow plugin 26 | // flow; constructed on per request basis 27 | // protected transient TokenAuthorizationStrategy bearerToken; 28 | protected transient Auth auth; 29 | 30 | protected OpenShiftBaseStep(String apiURL, String namespace, 31 | String authToken, String verbose) { 32 | this.apiURL = apiURL != null ? apiURL.trim() : null; 33 | this.namespace = namespace != null ? namespace.trim() : null; 34 | this.authToken = authToken != null ? authToken.trim() : null; 35 | this.verbose = verbose != null ? verbose.trim() : null; 36 | } 37 | 38 | // generically speaking, Jenkins will always pass in non-null field values. 39 | // However, as we have periodically 40 | // added new fields, jobs created with earlier versions of the plugin get 41 | // null for the new fields. Hence, 42 | // we have introduced the generic convention (even for fields that existed 43 | // in the initial incarnations of the plugin) 44 | // of insuring nulls are not returned for field getters 45 | 46 | public String getApiURL() { 47 | return apiURL; 48 | } 49 | 50 | public String getNamespace() { 51 | return namespace; 52 | } 53 | 54 | public String getAuthToken() { 55 | return authToken; 56 | } 57 | 58 | public String getVerbose() { 59 | return verbose; 60 | } 61 | 62 | @Override 63 | public void setAuth(Auth auth) { 64 | this.auth = auth; 65 | } 66 | 67 | @Override 68 | public Auth getAuth() { 69 | return auth; 70 | } 71 | 72 | @Override 73 | public String getBaseClassName() { 74 | return OpenShiftBaseStep.class.getName(); 75 | } 76 | 77 | // this is the workflow plugin path 78 | @Override 79 | public void perform(Run run, FilePath workspace, Launcher launcher, 80 | TaskListener listener) throws InterruptedException, IOException { 81 | this.doIt(run, workspace, launcher, listener); 82 | } 83 | 84 | // this is the classic jenkins build step path 85 | @Override 86 | public boolean perform(AbstractBuild build, Launcher launcher, 87 | BuildListener listener) throws IOException, InterruptedException { 88 | return this.doIt(build, launcher, listener); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuildVerifier; 5 | import hudson.Extension; 6 | import hudson.tasks.Builder; 7 | import hudson.util.FormValidation; 8 | import org.kohsuke.stapler.DataBoundConstructor; 9 | import org.kohsuke.stapler.QueryParameter; 10 | 11 | import javax.servlet.ServletException; 12 | import java.io.IOException; 13 | 14 | public class OpenShiftBuildVerifier extends TimedOpenShiftBaseStep implements 15 | IOpenShiftBuildVerifier { 16 | 17 | protected final String bldCfg; 18 | protected final String checkForTriggeredDeployments; 19 | 20 | // Fields in config.jelly must match the parameter names in the 21 | // "DataBoundConstructor" 22 | @DataBoundConstructor 23 | public OpenShiftBuildVerifier(String apiURL, String bldCfg, 24 | String namespace, String authToken, String verbose, 25 | String checkForTriggeredDeployments, String waitTime, 26 | String waitUnit) { 27 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 28 | this.bldCfg = bldCfg != null ? bldCfg.trim() : null; 29 | this.checkForTriggeredDeployments = checkForTriggeredDeployments != null ? checkForTriggeredDeployments 30 | .trim() : null; 31 | } 32 | 33 | // generically speaking, Jenkins will always pass in non-null field values. 34 | // However, as we have periodically 35 | // added new fields, jobs created with earlier versions of the plugin get 36 | // null for the new fields. Hence, 37 | // we have introduced the generic convention (even for fields that existed 38 | // in the initial incarnations of the plugin) 39 | // of insuring nulls are not returned for field getters 40 | 41 | public String getBldCfg() { 42 | return bldCfg; 43 | } 44 | 45 | public String getCheckForTriggeredDeployments() { 46 | return checkForTriggeredDeployments; 47 | } 48 | 49 | // Overridden for better type safety. 50 | // If your plugin doesn't really define any property on Descriptor, 51 | // you don't have to do this. 52 | @Override 53 | public DescriptorImpl getDescriptor() { 54 | return (DescriptorImpl) super.getDescriptor(); 55 | } 56 | 57 | /** 58 | * Descriptor for {@link OpenShiftBuildVerifier}. Used as a singleton. The 59 | * class is marked as public so that it can be accessed from views. 60 | */ 61 | @Extension 62 | // This indicates to Jenkins that this is an implementation of an extension 63 | // point. 64 | public static final class DescriptorImpl extends 65 | TimedBuildStepDescriptor { 66 | 67 | public DescriptorImpl() { 68 | load(); 69 | } 70 | 71 | @Override 72 | protected long getStaticDefaultWaitTime() { 73 | return GlobalConfig.DEFAULT_BUILD_VERIFY_WAIT; 74 | } 75 | 76 | public FormValidation doCheckBldCfg(@QueryParameter String value) 77 | throws IOException, ServletException { 78 | return ParamVerify.doCheckBldCfg(value); 79 | } 80 | 81 | /** 82 | * This human readable name is used in the configuration screen. 83 | */ 84 | public String getDisplayName() { 85 | return DISPLAY_NAME; 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder; 5 | import com.openshift.jenkins.plugins.pipeline.model.ITimedOpenShiftPlugin; 6 | import hudson.Extension; 7 | import hudson.tasks.Builder; 8 | import hudson.util.FormValidation; 9 | import org.kohsuke.stapler.DataBoundConstructor; 10 | import org.kohsuke.stapler.QueryParameter; 11 | 12 | import javax.servlet.ServletException; 13 | import java.io.IOException; 14 | import java.util.List; 15 | 16 | public class OpenShiftBuilder extends TimedOpenShiftBaseStep implements 17 | IOpenShiftBuilder, ITimedOpenShiftPlugin { 18 | 19 | protected final String bldCfg; 20 | protected final String commitID; 21 | protected final String buildName; 22 | protected final String showBuildLogs; 23 | protected final String checkForTriggeredDeployments; 24 | protected final List envVars; 25 | 26 | // Fields in config.jelly must match the parameter names in the 27 | // "DataBoundConstructor" 28 | @DataBoundConstructor 29 | public OpenShiftBuilder(String apiURL, String bldCfg, String namespace, 30 | List env, String authToken, String verbose, 31 | String commitID, String buildName, String showBuildLogs, 32 | String checkForTriggeredDeployments, String waitTime, 33 | String waitUnit) { 34 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 35 | this.bldCfg = bldCfg != null ? bldCfg.trim() : null; 36 | this.envVars = env; 37 | this.commitID = commitID != null ? commitID.trim() : null; 38 | this.buildName = buildName != null ? buildName.trim() : null; 39 | this.showBuildLogs = showBuildLogs != null ? showBuildLogs.trim() 40 | : null; 41 | this.checkForTriggeredDeployments = checkForTriggeredDeployments != null ? checkForTriggeredDeployments 42 | .trim() : null; 43 | } 44 | 45 | // generically speaking, Jenkins will always pass in non-null field values. 46 | // However, as we have periodically 47 | // added new fields, jobs created with earlier versions of the plugin get 48 | // null for the new fields. Hence, 49 | // we have introduced the generic convention (even for fields that existed 50 | // in the initial incarnations of the plugin) 51 | // of insuring nulls are not returned for field getters 52 | 53 | public String getCommitID() { 54 | return commitID; 55 | } 56 | 57 | public String getBuildName() { 58 | return buildName; 59 | } 60 | 61 | public String getShowBuildLogs() { 62 | return showBuildLogs; 63 | } 64 | 65 | public String getBldCfg() { 66 | return bldCfg; 67 | } 68 | 69 | public List getEnv() { 70 | return envVars; 71 | } 72 | 73 | public String getCheckForTriggeredDeployments() { 74 | return checkForTriggeredDeployments; 75 | } 76 | 77 | /** 78 | * Descriptor for {@link OpenShiftBuilder}. Used as a singleton. The class 79 | * is marked as public so that it can be accessed from views. 80 | */ 81 | @Extension 82 | // This indicates to Jenkins that this is an implementation of an extension 83 | // point. 84 | public static final class DescriptorImpl extends 85 | TimedBuildStepDescriptor { 86 | 87 | public FormValidation doCheckBldCfg(@QueryParameter String value) 88 | throws IOException, ServletException { 89 | return ParamVerify.doCheckBldCfg(value); 90 | } 91 | 92 | public String getDisplayName() { 93 | return DISPLAY_NAME; 94 | } 95 | 96 | @Override 97 | protected long getStaticDefaultWaitTime() { 98 | return GlobalConfig.DEFAULT_BUILD_WAIT; 99 | } 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftCreator.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftCreator; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 5 | import hudson.Extension; 6 | import hudson.model.AbstractProject; 7 | import hudson.tasks.BuildStepDescriptor; 8 | import hudson.tasks.Builder; 9 | import hudson.util.FormValidation; 10 | import net.sf.json.JSONObject; 11 | import org.kohsuke.stapler.DataBoundConstructor; 12 | import org.kohsuke.stapler.QueryParameter; 13 | import org.kohsuke.stapler.StaplerRequest; 14 | 15 | import javax.servlet.ServletException; 16 | import java.io.IOException; 17 | 18 | public class OpenShiftCreator extends OpenShiftBaseStep implements 19 | IOpenShiftCreator { 20 | 21 | protected final String jsonyaml; 22 | 23 | // Fields in config.jelly must match the parameter names in the 24 | // "DataBoundConstructor" 25 | @DataBoundConstructor 26 | public OpenShiftCreator(String apiURL, String namespace, String authToken, 27 | String verbose, String jsonyaml) { 28 | super(apiURL, namespace, authToken, verbose); 29 | this.jsonyaml = jsonyaml != null ? jsonyaml.trim() : null; 30 | } 31 | 32 | // generically speaking, Jenkins will always pass in non-null field values. 33 | // However, as we have periodically 34 | // added new fields, jobs created with earlier versions of the plugin get 35 | // null for the new fields. Hence, 36 | // we have introduced the generic convention (even for fields that existed 37 | // in the initial incarnations of the plugin) 38 | // of insuring nulls are not returned for field getters 39 | 40 | public String getJsonyaml() { 41 | return jsonyaml; 42 | } 43 | 44 | /** 45 | * Descriptor for {@link OpenShiftCreator}. Used as a singleton. The class 46 | * is marked as public so that it can be accessed from views. 47 | * 48 | */ 49 | @Extension 50 | // This indicates to Jenkins that this is an implementation of an extension 51 | // point. 52 | public static final class DescriptorImpl extends 53 | BuildStepDescriptor implements IOpenShiftPluginDescriptor { 54 | /** 55 | * To persist global configuration information, simply store it in a 56 | * field and call save(). 57 | * 58 | *

59 | * If you don't want fields to be persisted, use transient. 60 | */ 61 | 62 | /** 63 | * In order to load the persisted global configuration, you have to call 64 | * load() in the constructor. 65 | */ 66 | public DescriptorImpl() { 67 | load(); 68 | } 69 | 70 | public FormValidation doCheckJsonyaml(@QueryParameter String value) 71 | throws IOException, ServletException { 72 | return ParamVerify.doCheckJsonyaml(value); 73 | } 74 | 75 | public boolean isApplicable(Class aClass) { 76 | // Indicates that this builder can be used with all kinds of project 77 | // types 78 | return true; 79 | } 80 | 81 | /** 82 | * This human readable name is used in the configuration screen. 83 | */ 84 | public String getDisplayName() { 85 | return DISPLAY_NAME; 86 | } 87 | 88 | @Override 89 | public boolean configure(StaplerRequest req, JSONObject formData) 90 | throws FormException { 91 | // To persist global configuration information, 92 | // pull info from formData, set appropriate instance field (which 93 | // should have a getter), and call save(). 94 | save(); 95 | return super.configure(req, formData); 96 | } 97 | 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterJsonYaml.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeleterJsonYaml; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 5 | import hudson.Extension; 6 | import hudson.model.AbstractProject; 7 | import hudson.tasks.BuildStepDescriptor; 8 | import hudson.tasks.Builder; 9 | import hudson.util.FormValidation; 10 | import net.sf.json.JSONObject; 11 | import org.kohsuke.stapler.DataBoundConstructor; 12 | import org.kohsuke.stapler.QueryParameter; 13 | import org.kohsuke.stapler.StaplerRequest; 14 | 15 | import javax.servlet.ServletException; 16 | import java.io.IOException; 17 | 18 | public class OpenShiftDeleterJsonYaml extends OpenShiftBaseStep implements 19 | IOpenShiftDeleterJsonYaml { 20 | 21 | protected final String jsonyaml; 22 | 23 | // Fields in config.jelly must match the parameter names in the 24 | // "DataBoundConstructor" 25 | @DataBoundConstructor 26 | public OpenShiftDeleterJsonYaml(String apiURL, String namespace, 27 | String authToken, String verbose, String jsonyaml) { 28 | super(apiURL, namespace, authToken, verbose); 29 | this.jsonyaml = jsonyaml != null ? jsonyaml.trim() : null; 30 | } 31 | 32 | // generically speaking, Jenkins will always pass in non-null field values. 33 | // However, as we have periodically 34 | // added new fields, jobs created with earlier versions of the plugin get 35 | // null for the new fields. Hence, 36 | // we have introduced the generic convention (even for fields that existed 37 | // in the initial incarnations of the plugin) 38 | // of insuring nulls are not returned for field getters 39 | 40 | public String getJsonyaml() { 41 | return jsonyaml; 42 | } 43 | 44 | // Overridden for better type safety. 45 | // If your plugin doesn't really define any property on Descriptor, 46 | // you don't have to do this. 47 | @Override 48 | public DescriptorImpl getDescriptor() { 49 | return (DescriptorImpl) super.getDescriptor(); 50 | } 51 | 52 | /** 53 | * Descriptor for {@link OpenShiftDeleterJsonYaml}. Used as a singleton. The 54 | * class is marked as public so that it can be accessed from views. 55 | * 56 | */ 57 | @Extension 58 | // This indicates to Jenkins that this is an implementation of an extension 59 | // point. 60 | public static final class DescriptorImpl extends 61 | BuildStepDescriptor implements IOpenShiftPluginDescriptor { 62 | /** 63 | * To persist global configuration information, simply store it in a 64 | * field and call save(). 65 | * 66 | *

67 | * If you don't want fields to be persisted, use transient. 68 | */ 69 | 70 | /** 71 | * In order to load the persisted global configuration, you have to call 72 | * load() in the constructor. 73 | */ 74 | public DescriptorImpl() { 75 | load(); 76 | } 77 | 78 | public FormValidation doCheckJsonyaml(@QueryParameter String value) 79 | throws IOException, ServletException { 80 | return ParamVerify.doCheckJsonyaml(value); 81 | } 82 | 83 | public boolean isApplicable(Class aClass) { 84 | // Indicates that this builder can be used with all kinds of project 85 | // types 86 | return true; 87 | } 88 | 89 | /** 90 | * This human readable name is used in the configuration screen. 91 | */ 92 | public String getDisplayName() { 93 | return DISPLAY_NAME; 94 | } 95 | 96 | @Override 97 | public boolean configure(StaplerRequest req, JSONObject formData) 98 | throws FormException { 99 | // To persist global configuration information, 100 | // pull info from formData, set appropriate instance field (which 101 | // should have a getter), and call save(). 102 | save(); 103 | return super.configure(req, formData); 104 | } 105 | 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployer.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeployer; 5 | import hudson.Extension; 6 | import hudson.tasks.Builder; 7 | import hudson.util.FormValidation; 8 | import org.kohsuke.stapler.DataBoundConstructor; 9 | import org.kohsuke.stapler.QueryParameter; 10 | 11 | import javax.servlet.ServletException; 12 | import java.io.IOException; 13 | 14 | public class OpenShiftDeployer extends TimedOpenShiftBaseStep implements 15 | IOpenShiftDeployer { 16 | 17 | protected final String depCfg; 18 | 19 | // Fields in config.jelly must match the parameter names in the 20 | // "DataBoundConstructor" 21 | @DataBoundConstructor 22 | public OpenShiftDeployer(String apiURL, String depCfg, String namespace, 23 | String authToken, String verbose, String waitTime, String waitUnit) { 24 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 25 | this.depCfg = depCfg != null ? depCfg.trim() : null; 26 | } 27 | 28 | public String getDepCfg() { 29 | return depCfg; 30 | } 31 | 32 | /** 33 | * Descriptor for {@link OpenShiftDeployer}. Used as a singleton. The class 34 | * is marked as public so that it can be accessed from views. 35 | */ 36 | @Extension 37 | // This indicates to Jenkins that this is an implementation of an extension 38 | // point. 39 | public static final class DescriptorImpl extends 40 | TimedBuildStepDescriptor { 41 | 42 | public FormValidation doCheckDepCfg(@QueryParameter String value) 43 | throws IOException, ServletException { 44 | return ParamVerify.doCheckDepCfg(value); 45 | } 46 | 47 | /** 48 | * This human readable name is used in the configuration screen. 49 | */ 50 | public String getDisplayName() { 51 | return DISPLAY_NAME; 52 | } 53 | 54 | @Override 55 | protected long getStaticDefaultWaitTime() { 56 | return GlobalConfig.DEFAULT_DEPLOY_WAIT; 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeploymentVerification; 5 | import hudson.Extension; 6 | import hudson.tasks.Builder; 7 | import hudson.util.FormValidation; 8 | import org.kohsuke.stapler.DataBoundConstructor; 9 | import org.kohsuke.stapler.QueryParameter; 10 | 11 | import javax.servlet.ServletException; 12 | import java.io.IOException; 13 | 14 | public class OpenShiftDeploymentVerifier extends TimedOpenShiftBaseStep 15 | implements IOpenShiftDeploymentVerification { 16 | 17 | protected final String depCfg; 18 | protected final String replicaCount; 19 | protected final String verifyReplicaCount; 20 | 21 | // Fields in config.jelly must match the parameter names in the 22 | // "DataBoundConstructor" 23 | @DataBoundConstructor 24 | public OpenShiftDeploymentVerifier(String apiURL, String depCfg, 25 | String namespace, String replicaCount, String authToken, 26 | String verbose, String verifyReplicaCount, String waitTime, 27 | String waitUnit) { 28 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 29 | this.depCfg = depCfg != null ? depCfg.trim() : null; 30 | this.replicaCount = replicaCount != null ? replicaCount.trim() : null; 31 | this.verifyReplicaCount = verifyReplicaCount != null ? verifyReplicaCount 32 | .trim() : null; 33 | } 34 | 35 | public String getDepCfg() { 36 | return depCfg; 37 | } 38 | 39 | public String getReplicaCount() { 40 | return replicaCount; 41 | } 42 | 43 | public String getVerifyReplicaCount() { 44 | return verifyReplicaCount; 45 | } 46 | 47 | /** 48 | * Descriptor for {@link OpenShiftDeploymentVerifier}. Used as a singleton. 49 | * The class is marked as public so that it can be accessed from views. 50 | */ 51 | @Extension 52 | // This indicates to Jenkins that this is an implementation of an extension 53 | // point. 54 | public static final class DescriptorImpl extends 55 | TimedBuildStepDescriptor { 56 | 57 | public FormValidation doCheckDepCfg(@QueryParameter String value) 58 | throws IOException, ServletException { 59 | return ParamVerify.doCheckDepCfg(value); 60 | } 61 | 62 | public FormValidation doCheckReplicaCount(@QueryParameter String value) 63 | throws IOException, ServletException { 64 | return ParamVerify.doCheckReplicaCount(value); 65 | } 66 | 67 | /** 68 | * This human readable name is used in the configuration screen. 69 | */ 70 | public String getDisplayName() { 71 | return DISPLAY_NAME; 72 | } 73 | 74 | @Override 75 | protected long getStaticDefaultWaitTime() { 76 | return GlobalConfig.DEFAULT_DEPLOY_VERIFY_WAIT; 77 | } 78 | 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftExec.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftExec; 6 | import hudson.Extension; 7 | import hudson.tasks.Builder; 8 | import hudson.util.FormValidation; 9 | import org.kohsuke.stapler.DataBoundConstructor; 10 | import org.kohsuke.stapler.QueryParameter; 11 | 12 | import javax.servlet.ServletException; 13 | import java.io.IOException; 14 | import java.util.List; 15 | 16 | public class OpenShiftExec extends TimedOpenShiftBaseStep implements 17 | IOpenShiftExec, IOpenShiftApiObjHandler { 18 | 19 | protected final String pod; 20 | protected final String container; 21 | protected final String command; 22 | protected final List arguments; 23 | 24 | public String getPod() { 25 | return pod; 26 | } 27 | 28 | public String getContainer() { 29 | return container; 30 | } 31 | 32 | public String getCommand() { 33 | return command; 34 | } 35 | 36 | public List getArguments() { 37 | return arguments; 38 | } 39 | 40 | @DataBoundConstructor 41 | public OpenShiftExec(String apiURL, String namespace, String authToken, 42 | String verbose, String pod, String container, String command, 43 | List arguments, String waitTime, String waitUnit) { 44 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 45 | this.pod = pod != null ? pod.trim() : null; 46 | this.container = container != null ? container.trim() : null; 47 | this.command = command != null ? command.trim() : null; 48 | this.arguments = arguments; 49 | } 50 | 51 | @Extension 52 | // This indicates to Jenkins that this is an implementation of an extension 53 | // point. 54 | public static final class DescriptorImpl extends 55 | TimedBuildStepDescriptor { 56 | 57 | public FormValidation doCheckPod(@QueryParameter String value) 58 | throws IOException, ServletException { 59 | return FormValidation.validateRequired(value); 60 | } 61 | 62 | public FormValidation doCheckCommand(@QueryParameter String value) 63 | throws IOException, ServletException { 64 | return FormValidation.validateRequired(value); 65 | } 66 | 67 | public String getDisplayName() { 68 | return DISPLAY_NAME; 69 | } 70 | 71 | @Override 72 | protected long getStaticDefaultWaitTime() { 73 | return GlobalConfig.DEFAULT_EXEC_WAIT; 74 | } 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftItemListener.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import jenkins.model.Jenkins; 4 | import jenkins.model.JenkinsLocationConfiguration; 5 | import hudson.Extension; 6 | import hudson.model.Item; 7 | import hudson.model.listeners.ItemListener; 8 | 9 | @Extension 10 | public class OpenShiftItemListener extends ItemListener { 11 | 12 | public OpenShiftItemListener() { 13 | } 14 | 15 | private void updateRootURLConfig() { 16 | if (Jenkins.getInstance().getRootUrl() != null 17 | && JenkinsLocationConfiguration.get().getUrl() == null) { 18 | JenkinsLocationConfiguration.get().setUrl( 19 | Jenkins.getInstance().getRootUrl()); 20 | } 21 | } 22 | 23 | @Override 24 | public void onCreated(Item item) { 25 | updateRootURLConfig(); 26 | super.onCreated(item); 27 | } 28 | 29 | @Override 30 | public void onCopied(Item src, Item item) { 31 | updateRootURLConfig(); 32 | super.onCopied(src, item); 33 | } 34 | 35 | @Override 36 | public void onLoaded() { 37 | updateRootURLConfig(); 38 | super.onLoaded(); 39 | } 40 | 41 | @Override 42 | public void onDeleted(Item item) { 43 | updateRootURLConfig(); 44 | super.onDeleted(item); 45 | } 46 | 47 | @Override 48 | public void onRenamed(Item item, String oldName, String newName) { 49 | updateRootURLConfig(); 50 | super.onRenamed(item, oldName, newName); 51 | } 52 | 53 | @Override 54 | public void onLocationChanged(Item item, String oldFullName, 55 | String newFullName) { 56 | updateRootURLConfig(); 57 | super.onLocationChanged(item, oldFullName, newFullName); 58 | } 59 | 60 | @Override 61 | public void onUpdated(Item item) { 62 | updateRootURLConfig(); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftScaler; 5 | import hudson.Extension; 6 | import hudson.tasks.Builder; 7 | import hudson.util.FormValidation; 8 | import org.kohsuke.stapler.DataBoundConstructor; 9 | import org.kohsuke.stapler.QueryParameter; 10 | 11 | import javax.servlet.ServletException; 12 | import java.io.IOException; 13 | 14 | public class OpenShiftScaler extends TimedOpenShiftBaseStep implements 15 | IOpenShiftScaler { 16 | 17 | protected final String depCfg; 18 | protected final String replicaCount; 19 | protected final String verifyReplicaCount; 20 | 21 | // Fields in config.jelly must match the parameter names in the 22 | // "DataBoundConstructor" 23 | @DataBoundConstructor 24 | public OpenShiftScaler(String apiURL, String depCfg, String namespace, 25 | String replicaCount, String authToken, String verbose, 26 | String verifyReplicaCount, String waitTime, String waitUnit) { 27 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 28 | this.depCfg = depCfg != null ? depCfg.trim() : null; 29 | this.replicaCount = replicaCount != null ? replicaCount.trim() : null; 30 | this.verifyReplicaCount = verifyReplicaCount != null ? verifyReplicaCount 31 | .trim() : null; 32 | } 33 | 34 | public String getDepCfg() { 35 | return depCfg; 36 | } 37 | 38 | public String getReplicaCount() { 39 | return replicaCount; 40 | } 41 | 42 | public String getVerifyReplicaCount() { 43 | return verifyReplicaCount; 44 | } 45 | 46 | /** 47 | * Descriptor for {@link OpenShiftScaler}. Used as a singleton. The class is 48 | * marked as public so that it can be accessed from views. 49 | */ 50 | @Extension 51 | // This indicates to Jenkins that this is an implementation of an extension 52 | // point. 53 | public static final class DescriptorImpl extends 54 | TimedBuildStepDescriptor { 55 | 56 | public FormValidation doCheckDepCfg(@QueryParameter String value) 57 | throws IOException, ServletException { 58 | return ParamVerify.doCheckDepCfg(value); 59 | } 60 | 61 | public FormValidation doCheckReplicaCount(@QueryParameter String value) 62 | throws IOException, ServletException { 63 | return ParamVerify.doCheckReplicaCountRequired(value); 64 | } 65 | 66 | /** 67 | * This human readable name is used in the configuration screen. 68 | */ 69 | public String getDisplayName() { 70 | return DISPLAY_NAME; 71 | } 72 | 73 | @Override 74 | protected long getStaticDefaultWaitTime() { 75 | return GlobalConfig.DEFAULT_SCALER_WAIT; 76 | } 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftScaler; 6 | import hudson.Extension; 7 | import hudson.tasks.Publisher; 8 | import hudson.util.FormValidation; 9 | import org.kohsuke.stapler.DataBoundConstructor; 10 | import org.kohsuke.stapler.QueryParameter; 11 | 12 | import javax.servlet.ServletException; 13 | import java.io.IOException; 14 | 15 | public class OpenShiftScalerPostAction extends TimedOpenShiftBasePostAction 16 | implements IOpenShiftScaler { 17 | 18 | protected final String depCfg; 19 | protected final String replicaCount; 20 | protected final String verifyReplicaCount; 21 | 22 | // Fields in config.jelly must match the parameter names in the 23 | // "DataBoundConstructor" 24 | @DataBoundConstructor 25 | public OpenShiftScalerPostAction(String apiURL, String depCfg, 26 | String namespace, String replicaCount, String authToken, 27 | String verbose, String verifyReplicaCount, String waitTime, 28 | String waitUnit) { 29 | super(apiURL, namespace, authToken, verbose, waitTime, waitUnit); 30 | this.depCfg = depCfg != null ? depCfg.trim() : null; 31 | this.replicaCount = replicaCount != null ? replicaCount.trim() : null; 32 | this.verifyReplicaCount = verifyReplicaCount != null ? verifyReplicaCount 33 | .trim() : null; 34 | } 35 | 36 | public String getDepCfg() { 37 | return depCfg; 38 | } 39 | 40 | public String getReplicaCount() { 41 | return replicaCount; 42 | } 43 | 44 | public String getVerifyReplicaCount() { 45 | return verifyReplicaCount; 46 | } 47 | 48 | /** 49 | * Descriptor for {@link OpenShiftScalerPostAction}. Used as a singleton. 50 | * The class is marked as public so that it can be accessed from views. 51 | */ 52 | @Extension 53 | // This indicates to Jenkins that this is an implementation of an extension 54 | // point. 55 | public static final class DescriptorImpl extends 56 | TimedBuildStepDescriptor implements 57 | IOpenShiftPluginDescriptor { 58 | 59 | public FormValidation doCheckDepCfg(@QueryParameter String value) 60 | throws IOException, ServletException { 61 | return ParamVerify.doCheckDepCfg(value); 62 | } 63 | 64 | public FormValidation doCheckReplicaCount(@QueryParameter String value) 65 | throws IOException, ServletException { 66 | return ParamVerify.doCheckReplicaCountRequired(value); 67 | } 68 | 69 | public String getDisplayName() { 70 | return DISPLAY_NAME; 71 | } 72 | 73 | @Override 74 | protected long getStaticDefaultWaitTime() { 75 | return GlobalConfig.DEFAULT_SCALER_WAIT; 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftServiceVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftServiceVerifier; 6 | import hudson.Extension; 7 | import hudson.model.AbstractProject; 8 | import hudson.tasks.BuildStepDescriptor; 9 | import hudson.tasks.Builder; 10 | import hudson.util.FormValidation; 11 | import net.sf.json.JSONObject; 12 | import org.kohsuke.stapler.DataBoundConstructor; 13 | import org.kohsuke.stapler.QueryParameter; 14 | import org.kohsuke.stapler.StaplerRequest; 15 | 16 | import javax.servlet.ServletException; 17 | import java.io.IOException; 18 | import java.util.Map; 19 | 20 | public class OpenShiftServiceVerifier extends OpenShiftBaseStep implements 21 | IOpenShiftServiceVerifier { 22 | 23 | protected final String svcName; 24 | protected String retryCount; 25 | 26 | // Fields in config.jelly must match the parameter names in the 27 | // "DataBoundConstructor" 28 | @DataBoundConstructor 29 | public OpenShiftServiceVerifier(String apiURL, String svcName, 30 | String namespace, String authToken, String verbose) { 31 | super(apiURL, namespace, authToken, verbose); 32 | this.svcName = svcName != null ? svcName.trim() : null; 33 | } 34 | 35 | public String getSvcName() { 36 | return svcName; 37 | } 38 | 39 | public String getRetryCount() { 40 | return retryCount; 41 | } 42 | 43 | public String getRetryCount(Map overrides) { 44 | String val = getOverride(getRetryCount(), overrides); 45 | if (val.length() > 0) 46 | return val; 47 | return Integer.toString(getDescriptor().getRetry()); 48 | } 49 | 50 | @Override 51 | public DescriptorImpl getDescriptor() { 52 | return (DescriptorImpl) super.getDescriptor(); 53 | } 54 | 55 | /** 56 | * Descriptor for {@link OpenShiftServiceVerifier}. Used as a singleton. The 57 | * class is marked as public so that it can be accessed from views. 58 | */ 59 | @Extension 60 | // This indicates to Jenkins that this is an implementation of an extension 61 | // point. 62 | public static final class DescriptorImpl extends 63 | BuildStepDescriptor implements IOpenShiftPluginDescriptor { 64 | private int retry = GlobalConfig.DEFAULT_SERVICE_VERIFY_RETRY; 65 | 66 | public DescriptorImpl() { 67 | load(); 68 | } 69 | 70 | public FormValidation doCheckSvcName(@QueryParameter String value) 71 | throws IOException, ServletException { 72 | return ParamVerify.doCheckSvcName(value); 73 | } 74 | 75 | public boolean isApplicable(Class aClass) { 76 | // Indicates that this builder can be used with all kinds of project 77 | // types 78 | return true; 79 | } 80 | 81 | /** 82 | * This human readable name is used in the configuration screen. 83 | */ 84 | public String getDisplayName() { 85 | return DISPLAY_NAME; 86 | } 87 | 88 | public int getRetry() { 89 | return retry; 90 | } 91 | 92 | @Override 93 | public synchronized boolean configure(StaplerRequest req, 94 | JSONObject formData) throws FormException { 95 | retry = formData.getInt("retry"); 96 | save(); 97 | return super.configure(req, formData); 98 | } 99 | 100 | public synchronized int getConfiguredRetryCount() { 101 | return retry; 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/TimedBuildStepDescriptor.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import com.openshift.jenkins.plugins.pipeline.model.ITimedOpenShiftPlugin; 5 | import hudson.model.AbstractProject; 6 | import hudson.model.Describable; 7 | import hudson.tasks.BuildStep; 8 | import hudson.tasks.BuildStepDescriptor; 9 | import net.sf.json.JSONObject; 10 | import org.kohsuke.stapler.StaplerRequest; 11 | 12 | /** 13 | * Extending this descriptor imbues subclasses with a global Jenkins timeout 14 | * setting. 15 | * 16 | * Theory of operation: 1. Each timed operation which exposes a global timeout 17 | * extends this descriptor. 2. The descriptor will persist/restore a global 18 | * wait/waitUnit for the operation type. 3. Classes wishing to share the same 19 | * timeout value (e.g. DSL steps) should access the timeout value through 20 | * GlobalConfig. 4. GlobalConfig will load the correct descriptor to read the 21 | * currently configured timeout value. 5. The host for the global config option 22 | * must have a global.jelly for setting the value from Jenkins Configure. See 23 | * examples like: 24 | * src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec 25 | * /global.jelly 26 | */ 27 | public abstract class TimedBuildStepDescriptor> 28 | extends BuildStepDescriptor implements IOpenShiftPluginDescriptor { 29 | 30 | protected String wait; 31 | protected String waitUnit; 32 | 33 | TimedBuildStepDescriptor() { 34 | load(); 35 | } 36 | 37 | @Override 38 | public synchronized void load() { 39 | super.load(); 40 | if (wait == null || wait.trim().isEmpty()) { 41 | wait = "" + getStaticDefaultWaitTime(); 42 | } 43 | 44 | long w = Long.parseLong(wait); 45 | 46 | if (waitUnit == null || waitUnit.trim().isEmpty()) { 47 | if (w > 1000 48 | && (w 49 | % ITimedOpenShiftPlugin.TimeoutUnit.SECONDS.multiplier == 0)) { 50 | // We are loading a new or an existing config without time units 51 | waitUnit = ITimedOpenShiftPlugin.TimeoutUnit.SECONDS.name; 52 | // Convert existing timeout to seconds 53 | w /= ITimedOpenShiftPlugin.TimeoutUnit.SECONDS.multiplier; 54 | } else { 55 | waitUnit = ITimedOpenShiftPlugin.TimeoutUnit.MILLISECONDS.name; 56 | } 57 | } 58 | 59 | wait = "" + w; 60 | } 61 | 62 | @Override 63 | public boolean isApplicable(Class aClass) { 64 | // Indicates that this builder can be used with all kinds of project 65 | // types 66 | return true; 67 | } 68 | 69 | @Override 70 | public synchronized boolean configure(StaplerRequest req, 71 | JSONObject formData) throws FormException { 72 | wait = formData.getString("wait"); 73 | waitUnit = ITimedOpenShiftPlugin.TimeoutUnit.normalize(formData 74 | .getString("waitUnit")); 75 | if (wait == null || wait.isEmpty()) { 76 | // If someone clears the value, go back to default and use seconds 77 | wait = "" + getStaticDefaultWaitTime() 78 | / ITimedOpenShiftPlugin.TimeoutUnit.SECONDS.multiplier; 79 | waitUnit = ITimedOpenShiftPlugin.TimeoutUnit.SECONDS.name; 80 | } 81 | wait = wait.trim(); 82 | save(); 83 | return true; 84 | } 85 | 86 | public synchronized long getConfiguredDefaultWaitTime() { 87 | ITimedOpenShiftPlugin.TimeoutUnit unit = ITimedOpenShiftPlugin.TimeoutUnit 88 | .getByName(waitUnit); 89 | return unit.toMilliseconds("" + wait, getStaticDefaultWaitTime()); 90 | } 91 | 92 | public synchronized String getWait() { 93 | return wait; 94 | } 95 | 96 | public synchronized String getWaitUnit() { 97 | return waitUnit; 98 | } 99 | 100 | /** 101 | * @return Return the non-configurable default for this build step. This 102 | * will populate the global default wait time for the operation the 103 | * first time Jenkins loads this plugin. Once a global configuration 104 | * with a value exists, this value will no longer be used. However, 105 | * this value will be re-populated if the user clears the global 106 | * timeout form and saves the configuration. 107 | */ 108 | protected abstract long getStaticDefaultWaitTime(); 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/TimedOpenShiftBasePostAction.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.ITimedOpenShiftPlugin; 4 | import jenkins.tasks.SimpleBuildStep; 5 | 6 | import java.io.Serializable; 7 | 8 | public abstract class TimedOpenShiftBasePostAction extends 9 | OpenShiftBasePostAction implements SimpleBuildStep, Serializable, 10 | ITimedOpenShiftPlugin { 11 | 12 | protected final String waitTime; 13 | protected final String waitUnit; 14 | 15 | public TimedOpenShiftBasePostAction(String apiURL, String namespace, 16 | String authToken, String verbose, String waitTime, String waitUnit) { 17 | super(apiURL, namespace, authToken, verbose); 18 | this.waitTime = waitTime != null ? waitTime.trim() : null; 19 | this.waitUnit = waitUnit != null ? waitUnit.trim() : null; 20 | } 21 | 22 | final public String getWaitTime() { 23 | return waitTime; 24 | } 25 | 26 | final public String getWaitUnit() { 27 | return TimeoutUnit.normalize(waitUnit); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/TimedOpenShiftBaseStep.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import com.openshift.jenkins.plugins.pipeline.model.ITimedOpenShiftPlugin; 5 | import hudson.model.AbstractProject; 6 | import hudson.model.Describable; 7 | import hudson.tasks.BuildStep; 8 | import hudson.tasks.BuildStepDescriptor; 9 | import jenkins.tasks.SimpleBuildStep; 10 | import net.sf.json.JSONObject; 11 | import org.kohsuke.stapler.StaplerRequest; 12 | 13 | import java.io.Serializable; 14 | 15 | public abstract class TimedOpenShiftBaseStep extends OpenShiftBaseStep 16 | implements SimpleBuildStep, Serializable, ITimedOpenShiftPlugin { 17 | 18 | protected final String waitTime; 19 | protected final String waitUnit; 20 | 21 | protected TimedOpenShiftBaseStep(String apiURL, String namespace, 22 | String authToken, String verbose, String waitTime, String waitUnit) { 23 | super(apiURL, namespace, authToken, verbose); 24 | this.waitTime = waitTime != null ? waitTime.trim() : null; 25 | this.waitUnit = waitUnit != null ? waitUnit.trim() : null; 26 | } 27 | 28 | final public String getWaitTime() { 29 | return waitTime; 30 | } 31 | 32 | final public String getWaitUnit() { 33 | return TimeoutUnit.normalize(waitUnit); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBaseStep.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import java.io.IOException; 4 | import java.io.Serializable; 5 | 6 | import org.jenkinsci.plugins.workflow.steps.AbstractStepImpl; 7 | import org.kohsuke.stapler.DataBoundSetter; 8 | 9 | import com.openshift.jenkins.plugins.pipeline.Auth; 10 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin; 11 | //import com.openshift.restclient.authorization.TokenAuthorizationStrategy; 12 | 13 | import jenkins.tasks.SimpleBuildStep; 14 | import hudson.FilePath; 15 | import hudson.Launcher; 16 | import hudson.model.AbstractBuild; 17 | import hudson.model.BuildListener; 18 | import hudson.model.Run; 19 | import hudson.model.TaskListener; 20 | 21 | public abstract class OpenShiftBaseStep extends AbstractStepImpl implements 22 | SimpleBuildStep, Serializable, IOpenShiftPlugin { 23 | 24 | protected String apiURL; 25 | protected String namespace; 26 | protected String authToken; 27 | protected String verbose; 28 | // marked transient so don't serialize these next 2 in the workflow plugin 29 | // flow; constructed on per request basis 30 | // protected transient TokenAuthorizationStrategy bearerToken; 31 | protected transient Auth auth; 32 | 33 | protected OpenShiftBaseStep() { 34 | } 35 | 36 | // generically speaking, Jenkins will always pass in non-null field values. 37 | // However, as we have periodically 38 | // added new fields, jobs created with earlier versions of the plugin get 39 | // null for the new fields. Hence, 40 | // we have introduced the generic convention (even for fields that existed 41 | // in the initial incarnations of the plugin) 42 | // of insuring nulls are not returned for field getters 43 | 44 | public String getApiURL() { 45 | return apiURL; 46 | } 47 | 48 | @DataBoundSetter 49 | public void setApiURL(String apiURL) { 50 | this.apiURL = apiURL != null ? apiURL.trim() : null; 51 | } 52 | 53 | public String getNamespace() { 54 | return namespace; 55 | } 56 | 57 | @DataBoundSetter 58 | public void setNamespace(String namespace) { 59 | this.namespace = namespace != null ? namespace.trim() : null; 60 | } 61 | 62 | public String getAuthToken() { 63 | return authToken; 64 | } 65 | 66 | @DataBoundSetter 67 | public void setAuthToken(String authToken) { 68 | this.authToken = authToken != null ? authToken.trim() : null; 69 | } 70 | 71 | public String getVerbose() { 72 | return verbose; 73 | } 74 | 75 | @DataBoundSetter 76 | public void setVerbose(String verbose) { 77 | this.verbose = verbose != null ? verbose.trim() : null; 78 | } 79 | 80 | @Override 81 | public void setAuth(Auth auth) { 82 | this.auth = auth; 83 | } 84 | 85 | @Override 86 | public Auth getAuth() { 87 | return auth; 88 | } 89 | 90 | /* 91 | * @Override public TokenAuthorizationStrategy getToken() { return 92 | * bearerToken; } 93 | * 94 | * @Override public void setToken(TokenAuthorizationStrategy token) { 95 | * this.bearerToken = token; } 96 | */ 97 | @Override 98 | public String getBaseClassName() { 99 | return OpenShiftBaseStep.class.getName(); 100 | } 101 | 102 | // this is the workflow plugin path 103 | @Override 104 | public void perform(Run run, FilePath workspace, Launcher launcher, 105 | TaskListener listener) throws InterruptedException, IOException { 106 | this.doIt(run, workspace, launcher, listener); 107 | } 108 | 109 | // this is the classic jenkins build step path 110 | @Override 111 | public boolean perform(AbstractBuild build, Launcher launcher, 112 | BuildListener listener) throws IOException, InterruptedException { 113 | return this.doIt(build, launcher, listener); 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuildVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuildVerifier; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 6 | import hudson.Extension; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.model.Action; 10 | import hudson.model.BuildListener; 11 | import hudson.tasks.BuildStepMonitor; 12 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 13 | import org.jenkinsci.plugins.workflow.steps.Step; 14 | import org.kohsuke.stapler.DataBoundConstructor; 15 | import org.kohsuke.stapler.DataBoundSetter; 16 | 17 | import java.util.Collection; 18 | import java.util.Map; 19 | 20 | public class OpenShiftBuildVerifier extends TimedOpenShiftBaseStep implements 21 | IOpenShiftBuildVerifier { 22 | 23 | protected final String bldCfg; 24 | protected String checkForTriggeredDeployments; 25 | 26 | @DataBoundConstructor 27 | public OpenShiftBuildVerifier(String bldCfg) { 28 | this.bldCfg = bldCfg != null ? bldCfg.trim() : null; 29 | } 30 | 31 | @Override 32 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 33 | return true; 34 | } 35 | 36 | @Override 37 | public Action getProjectAction(AbstractProject project) { 38 | return null; 39 | } 40 | 41 | @Override 42 | public Collection getProjectActions( 43 | AbstractProject project) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public BuildStepMonitor getRequiredMonitorService() { 49 | return null; 50 | } 51 | 52 | @Override 53 | public String getBldCfg() { 54 | return bldCfg; 55 | } 56 | 57 | @Override 58 | public String getCheckForTriggeredDeployments() { 59 | return checkForTriggeredDeployments; 60 | } 61 | 62 | @DataBoundSetter 63 | public void setCheckForTriggeredDeployments( 64 | String checkForTriggeredDeployments) { 65 | this.checkForTriggeredDeployments = checkForTriggeredDeployments != null ? checkForTriggeredDeployments 66 | .trim() : null; 67 | } 68 | 69 | @Extension 70 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 71 | implements IOpenShiftPluginDescriptor { 72 | 73 | public DescriptorImpl() { 74 | super(OpenShiftBuildVerifierExecution.class); 75 | } 76 | 77 | @Override 78 | public String getFunctionName() { 79 | return "openshiftVerifyBuild"; 80 | } 81 | 82 | @Override 83 | public String getDisplayName() { 84 | return DISPLAY_NAME; 85 | } 86 | 87 | @Override 88 | public Step newInstance(Map arguments) throws Exception { 89 | if (!arguments.containsKey("buildConfig") 90 | && !arguments.containsKey("bldCfg")) 91 | throw new IllegalArgumentException( 92 | "need to specify buildConfig"); 93 | Object bldCfg = arguments.get("buildConfig"); 94 | if (bldCfg == null || bldCfg.toString().trim().length() == 0) 95 | bldCfg = arguments.get("bldCfg"); 96 | if (bldCfg == null || bldCfg.toString().trim().length() == 0) 97 | throw new IllegalArgumentException( 98 | "need to specify buildConfig"); 99 | OpenShiftBuildVerifier step = new OpenShiftBuildVerifier( 100 | bldCfg.toString()); 101 | if (arguments.containsKey("checkForTriggeredDeployments")) { 102 | Object checkForTriggeredDeployments = arguments 103 | .get("checkForTriggeredDeployments"); 104 | if (checkForTriggeredDeployments != null) { 105 | step.setCheckForTriggeredDeployments(checkForTriggeredDeployments 106 | .toString()); 107 | } 108 | } 109 | 110 | ParamVerify.updateTimedDSLBaseStep(arguments, step); 111 | return step; 112 | } 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuildVerifierExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftBuildVerifierExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftBuildVerifier step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilderExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftBuilderExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftBuilder step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftCreator.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import hudson.Extension; 5 | import hudson.model.Action; 6 | import hudson.model.BuildListener; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.tasks.BuildStepMonitor; 10 | 11 | import java.util.Collection; 12 | import java.util.Map; 13 | import java.util.logging.Logger; 14 | 15 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 16 | import org.jenkinsci.plugins.workflow.steps.Step; 17 | import org.kohsuke.stapler.DataBoundConstructor; 18 | 19 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 20 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftCreator; 21 | 22 | public class OpenShiftCreator extends OpenShiftBaseStep implements 23 | IOpenShiftCreator { 24 | 25 | protected final String jsonyaml; 26 | 27 | @DataBoundConstructor 28 | public OpenShiftCreator(String jsonyaml) { 29 | this.jsonyaml = jsonyaml != null ? jsonyaml.trim() : null; 30 | } 31 | 32 | @Override 33 | public String getJsonyaml() { 34 | return jsonyaml; 35 | } 36 | 37 | @Override 38 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 39 | return true; 40 | } 41 | 42 | @Override 43 | public Action getProjectAction(AbstractProject project) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public Collection getProjectActions( 49 | AbstractProject project) { 50 | return null; 51 | } 52 | 53 | @Override 54 | public BuildStepMonitor getRequiredMonitorService() { 55 | return null; 56 | } 57 | 58 | private static final Logger LOGGER = Logger 59 | .getLogger(OpenShiftCreator.class.getName()); 60 | 61 | @Extension 62 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 63 | implements IOpenShiftPluginDescriptor { 64 | 65 | public DescriptorImpl() { 66 | super(OpenShiftCreatorExecution.class); 67 | } 68 | 69 | @Override 70 | public String getFunctionName() { 71 | return "openshiftCreateResource"; 72 | } 73 | 74 | @Override 75 | public String getDisplayName() { 76 | return DISPLAY_NAME; 77 | } 78 | 79 | @Override 80 | public Step newInstance(Map arguments) throws Exception { 81 | Object jsonyaml = arguments.get("yaml"); 82 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 83 | jsonyaml = arguments.get("json"); 84 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 85 | jsonyaml = arguments.get("jsonyaml"); 86 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 87 | throw new IllegalArgumentException( 88 | "need to specify json or yaml"); 89 | OpenShiftCreator step = new OpenShiftCreator(jsonyaml.toString()); 90 | ParamVerify.updateDSLBaseStep(arguments, step); 91 | return step; 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftCreatorExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.Computer; 8 | import hudson.model.Executor; 9 | import hudson.model.Run; 10 | import hudson.model.TaskListener; 11 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 12 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 13 | 14 | import javax.inject.Inject; 15 | 16 | public class OpenShiftCreatorExecution extends 17 | AbstractSynchronousNonBlockingStepExecution { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | @StepContextParameter 22 | private transient TaskListener listener; 23 | @StepContextParameter 24 | private transient Launcher launcher; 25 | @StepContextParameter 26 | private transient EnvVars envVars; 27 | @StepContextParameter 28 | private transient Run runObj; 29 | @StepContextParameter 30 | private transient FilePath filePath; // included as ref of what can be 31 | // included for future use 32 | @StepContextParameter 33 | private transient Executor executor; // included as ref of what can be 34 | // included for future use 35 | @StepContextParameter 36 | private transient Computer computer; // included as ref of what can be 37 | // included for future use 38 | 39 | @Inject 40 | private transient OpenShiftCreator step; 41 | 42 | @Override 43 | protected Void run() throws Exception { 44 | boolean success = step.doItCore(listener, envVars, runObj, null, 45 | launcher); 46 | if (!success) { 47 | throw new AbortException("\"" 48 | + step.getDescriptor().getDisplayName() + "\" failed"); 49 | } 50 | return null; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterJsonYaml.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import hudson.Extension; 5 | import hudson.model.Action; 6 | import hudson.model.BuildListener; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.tasks.BuildStepMonitor; 10 | 11 | import java.util.Collection; 12 | import java.util.Map; 13 | import java.util.logging.Logger; 14 | 15 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 16 | import org.jenkinsci.plugins.workflow.steps.Step; 17 | import org.kohsuke.stapler.DataBoundConstructor; 18 | 19 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 20 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeleterJsonYaml; 21 | 22 | public class OpenShiftDeleterJsonYaml extends OpenShiftBaseStep implements 23 | IOpenShiftDeleterJsonYaml { 24 | 25 | protected final String jsonyaml; 26 | 27 | @DataBoundConstructor 28 | public OpenShiftDeleterJsonYaml(String jsonyaml) { 29 | this.jsonyaml = jsonyaml != null ? jsonyaml.trim() : null; 30 | } 31 | 32 | @Override 33 | public String getJsonyaml() { 34 | return jsonyaml; 35 | } 36 | 37 | @Override 38 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 39 | return true; 40 | } 41 | 42 | @Override 43 | public Action getProjectAction(AbstractProject project) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public Collection getProjectActions( 49 | AbstractProject project) { 50 | return null; 51 | } 52 | 53 | @Override 54 | public BuildStepMonitor getRequiredMonitorService() { 55 | return null; 56 | } 57 | 58 | private static final Logger LOGGER = Logger 59 | .getLogger(OpenShiftDeleterJsonYaml.class.getName()); 60 | 61 | @Extension 62 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 63 | implements IOpenShiftPluginDescriptor { 64 | 65 | public DescriptorImpl() { 66 | super(OpenShiftDeleterJsonYamlExecution.class); 67 | } 68 | 69 | @Override 70 | public String getFunctionName() { 71 | return "openshiftDeleteResourceByJsonYaml"; 72 | } 73 | 74 | @Override 75 | public String getDisplayName() { 76 | return DISPLAY_NAME; 77 | } 78 | 79 | @Override 80 | public Step newInstance(Map arguments) throws Exception { 81 | Object jsonyaml = arguments.get("yaml"); 82 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 83 | jsonyaml = arguments.get("json"); 84 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 85 | jsonyaml = arguments.get("jsonyaml"); 86 | if (jsonyaml == null || jsonyaml.toString().trim().length() == 0) 87 | throw new IllegalArgumentException( 88 | "need to specify json or yaml"); 89 | OpenShiftDeleterJsonYaml step = new OpenShiftDeleterJsonYaml( 90 | jsonyaml.toString()); 91 | ParamVerify.updateDSLBaseStep(arguments, step); 92 | return step; 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterJsonYamlExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftDeleterJsonYamlExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftDeleterJsonYaml step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabels.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import hudson.Extension; 5 | import hudson.model.Action; 6 | import hudson.model.BuildListener; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.tasks.BuildStepMonitor; 10 | 11 | import java.util.Collection; 12 | import java.util.Map; 13 | import java.util.logging.Logger; 14 | 15 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 16 | import org.jenkinsci.plugins.workflow.steps.Step; 17 | import org.kohsuke.stapler.DataBoundConstructor; 18 | 19 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 20 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeleterLabels; 21 | 22 | public class OpenShiftDeleterLabels extends OpenShiftBaseStep implements 23 | IOpenShiftDeleterLabels { 24 | 25 | protected final String types; 26 | protected final String keys; 27 | protected final String values; 28 | 29 | @DataBoundConstructor 30 | public OpenShiftDeleterLabels(String types, String keys, String values) { 31 | this.types = types != null ? types.trim() : null; 32 | this.keys = keys != null ? keys.trim() : null; 33 | this.values = values != null ? values.trim() : null; 34 | } 35 | 36 | public String getTypes() { 37 | return types; 38 | } 39 | 40 | public String getKeys() { 41 | return keys; 42 | } 43 | 44 | public String getValues() { 45 | return values; 46 | } 47 | 48 | @Override 49 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 50 | return true; 51 | } 52 | 53 | @Override 54 | public Action getProjectAction(AbstractProject project) { 55 | return null; 56 | } 57 | 58 | @Override 59 | public Collection getProjectActions( 60 | AbstractProject project) { 61 | return null; 62 | } 63 | 64 | @Override 65 | public BuildStepMonitor getRequiredMonitorService() { 66 | return null; 67 | } 68 | 69 | private static final Logger LOGGER = Logger 70 | .getLogger(OpenShiftDeleterLabels.class.getName()); 71 | 72 | @Extension 73 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 74 | implements IOpenShiftPluginDescriptor { 75 | 76 | public DescriptorImpl() { 77 | super(OpenShiftDeleterLabelsExecution.class); 78 | } 79 | 80 | @Override 81 | public String getFunctionName() { 82 | return "openshiftDeleteResourceByLabels"; 83 | } 84 | 85 | @Override 86 | public String getDisplayName() { 87 | return DISPLAY_NAME; 88 | } 89 | 90 | @Override 91 | public Step newInstance(Map arguments) throws Exception { 92 | if (!arguments.containsKey("types") 93 | || !arguments.containsKey("keys") 94 | || !arguments.containsKey("values")) 95 | throw new IllegalArgumentException( 96 | "need to specify types, keys, and values"); 97 | OpenShiftDeleterLabels step = new OpenShiftDeleterLabels(arguments 98 | .get("types").toString(), arguments.get("keys").toString(), 99 | arguments.get("values").toString()); 100 | ParamVerify.updateDSLBaseStep(arguments, step); 101 | return step; 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabelsExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftDeleterLabelsExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftDeleterLabels step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterList.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 4 | import hudson.Extension; 5 | import hudson.model.Action; 6 | import hudson.model.BuildListener; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.tasks.BuildStepMonitor; 10 | 11 | import java.util.Collection; 12 | import java.util.Map; 13 | import java.util.logging.Logger; 14 | 15 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 16 | import org.jenkinsci.plugins.workflow.steps.Step; 17 | import org.kohsuke.stapler.DataBoundConstructor; 18 | 19 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 20 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeleterList; 21 | 22 | public class OpenShiftDeleterList extends OpenShiftBaseStep implements 23 | IOpenShiftDeleterList { 24 | 25 | protected final String types; 26 | protected final String keys; 27 | 28 | @DataBoundConstructor 29 | public OpenShiftDeleterList(String types, String keys) { 30 | this.types = types != null ? types.trim() : null; 31 | this.keys = keys != null ? keys.trim() : null; 32 | } 33 | 34 | public String getTypes() { 35 | return types; 36 | } 37 | 38 | public String getKeys() { 39 | return keys; 40 | } 41 | 42 | @Override 43 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 44 | return true; 45 | } 46 | 47 | @Override 48 | public Action getProjectAction(AbstractProject project) { 49 | return null; 50 | } 51 | 52 | @Override 53 | public Collection getProjectActions( 54 | AbstractProject project) { 55 | return null; 56 | } 57 | 58 | @Override 59 | public BuildStepMonitor getRequiredMonitorService() { 60 | return null; 61 | } 62 | 63 | private static final Logger LOGGER = Logger 64 | .getLogger(OpenShiftDeleterList.class.getName()); 65 | 66 | @Extension 67 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 68 | implements IOpenShiftPluginDescriptor { 69 | 70 | public DescriptorImpl() { 71 | super(OpenShiftDeleterListExecution.class); 72 | } 73 | 74 | @Override 75 | public String getFunctionName() { 76 | return "openshiftDeleteResourceByKey"; 77 | } 78 | 79 | @Override 80 | public String getDisplayName() { 81 | return DISPLAY_NAME; 82 | } 83 | 84 | @Override 85 | public Step newInstance(Map arguments) throws Exception { 86 | if (!arguments.containsKey("types") 87 | || !arguments.containsKey("keys")) 88 | throw new IllegalArgumentException( 89 | "need to specify types, keys, and values"); 90 | OpenShiftDeleterList step = new OpenShiftDeleterList(arguments.get( 91 | "types").toString(), arguments.get("keys").toString()); 92 | ParamVerify.updateDSLBaseStep(arguments, step); 93 | return step; 94 | } 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterListExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftDeleterListExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftDeleterList step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeployer.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftDeployer; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 6 | import hudson.Extension; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.model.Action; 10 | import hudson.model.BuildListener; 11 | import hudson.tasks.BuildStepMonitor; 12 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 13 | import org.jenkinsci.plugins.workflow.steps.Step; 14 | import org.kohsuke.stapler.DataBoundConstructor; 15 | 16 | import java.util.Collection; 17 | import java.util.Map; 18 | import java.util.logging.Logger; 19 | 20 | public class OpenShiftDeployer extends TimedOpenShiftBaseStep implements 21 | IOpenShiftDeployer { 22 | 23 | protected final String depCfg; 24 | 25 | @DataBoundConstructor 26 | public OpenShiftDeployer(String depCfg) { 27 | this.depCfg = depCfg != null ? depCfg.trim() : null; 28 | } 29 | 30 | public String getDepCfg() { 31 | return depCfg; 32 | } 33 | 34 | @Override 35 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 36 | return true; 37 | } 38 | 39 | @Override 40 | public Action getProjectAction(AbstractProject project) { 41 | return null; 42 | } 43 | 44 | @Override 45 | public Collection getProjectActions( 46 | AbstractProject project) { 47 | return null; 48 | } 49 | 50 | @Override 51 | public BuildStepMonitor getRequiredMonitorService() { 52 | return null; 53 | } 54 | 55 | private static final Logger LOGGER = Logger 56 | .getLogger(OpenShiftDeployer.class.getName()); 57 | 58 | @Extension 59 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 60 | implements IOpenShiftPluginDescriptor { 61 | 62 | public DescriptorImpl() { 63 | super(OpenShiftDeployerExecution.class); 64 | } 65 | 66 | @Override 67 | public String getFunctionName() { 68 | return "openshiftDeploy"; 69 | } 70 | 71 | @Override 72 | public String getDisplayName() { 73 | return DISPLAY_NAME; 74 | } 75 | 76 | @Override 77 | public Step newInstance(Map arguments) throws Exception { 78 | if (!arguments.containsKey("deploymentConfig") 79 | && !arguments.containsKey("depCfg")) 80 | throw new IllegalArgumentException( 81 | "need to specify deploymentConfig"); 82 | Object depCfg = arguments.get("deploymentConfig"); 83 | if (depCfg == null || depCfg.toString().trim().length() == 0) 84 | depCfg = arguments.get("depCfg"); 85 | if (depCfg == null || depCfg.toString().trim().length() == 0) 86 | throw new IllegalArgumentException( 87 | "need to specify deploymentConfig"); 88 | OpenShiftDeployer step = new OpenShiftDeployer(depCfg.toString()); 89 | 90 | ParamVerify.updateTimedDSLBaseStep(arguments, step); 91 | return step; 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeployerExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftDeployerExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftDeployer step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeploymentVerifierExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftDeploymentVerifierExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftDeploymentVerifier step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExecExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.Computer; 8 | import hudson.model.Executor; 9 | import hudson.model.Run; 10 | import hudson.model.TaskListener; 11 | import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted; 12 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 13 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 14 | 15 | import javax.inject.Inject; 16 | import java.io.Serializable; 17 | 18 | public class OpenShiftExecExecution 19 | extends 20 | AbstractSynchronousNonBlockingStepExecution { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | @StepContextParameter 25 | private transient TaskListener listener; 26 | @StepContextParameter 27 | private transient Launcher launcher; 28 | @StepContextParameter 29 | private transient EnvVars envVars; 30 | @StepContextParameter 31 | private transient Run runObj; 32 | @StepContextParameter 33 | private transient FilePath filePath; // included as ref of what can be 34 | // included for future use 35 | @StepContextParameter 36 | private transient Executor executor; // included as ref of what can be 37 | // included for future use 38 | @StepContextParameter 39 | private transient Computer computer; // included as ref of what can be 40 | // included for future use 41 | 42 | @Inject 43 | private transient OpenShiftExec step; 44 | 45 | @Override 46 | protected ExecResult run() throws Exception { 47 | boolean success = step.doItCore(listener, envVars, runObj, null, 48 | launcher); 49 | ExecResult result = step.getExecResult(); 50 | 51 | if (!success) { 52 | // If there is a failure, abort only if there is a timeout. 53 | // Otherwise, return to DSL. 54 | // The DSL script may check for normal errors/failures and retry. 55 | if (result.getError().isEmpty() && result.getFailure().isEmpty()) { 56 | throw new AbortException("\"" 57 | + step.getDescriptor().getDisplayName() + "\" failed"); 58 | } 59 | } 60 | 61 | return result; 62 | } 63 | 64 | public interface ExecResult extends Serializable { 65 | @Whitelisted 66 | String getStdout(); 67 | 68 | @Whitelisted 69 | String getStderr(); 70 | 71 | @Whitelisted 72 | String getError(); 73 | 74 | @Whitelisted 75 | String getFailure(); 76 | } 77 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTaggerExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftImageTaggerExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftImageTagger step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScaler.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 4 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftScaler; 6 | import hudson.Extension; 7 | import hudson.model.AbstractBuild; 8 | import hudson.model.AbstractProject; 9 | import hudson.model.Action; 10 | import hudson.model.BuildListener; 11 | import hudson.tasks.BuildStepMonitor; 12 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 13 | import org.jenkinsci.plugins.workflow.steps.Step; 14 | import org.kohsuke.stapler.DataBoundConstructor; 15 | import org.kohsuke.stapler.DataBoundSetter; 16 | 17 | import java.util.Collection; 18 | import java.util.Map; 19 | import java.util.logging.Logger; 20 | 21 | public class OpenShiftScaler extends TimedOpenShiftBaseStep implements 22 | IOpenShiftScaler { 23 | 24 | protected final String depCfg; 25 | protected final String replicaCount; 26 | protected String verifyReplicaCount; 27 | 28 | @DataBoundConstructor 29 | public OpenShiftScaler(String depCfg, String replicaCount) { 30 | this.depCfg = depCfg != null ? depCfg.trim() : null; 31 | this.replicaCount = replicaCount != null ? replicaCount.trim() : null; 32 | } 33 | 34 | public String getDepCfg() { 35 | return depCfg; 36 | } 37 | 38 | public String getReplicaCount() { 39 | return replicaCount; 40 | } 41 | 42 | public String getVerifyReplicaCount() { 43 | return verifyReplicaCount; 44 | } 45 | 46 | @DataBoundSetter 47 | public void setVerifyReplicaCount(String verifyReplicaCount) { 48 | this.verifyReplicaCount = verifyReplicaCount != null ? verifyReplicaCount 49 | .trim() : null; 50 | } 51 | 52 | @Override 53 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 54 | return true; 55 | } 56 | 57 | @Override 58 | public Action getProjectAction(AbstractProject project) { 59 | return null; 60 | } 61 | 62 | @Override 63 | public Collection getProjectActions( 64 | AbstractProject project) { 65 | return null; 66 | } 67 | 68 | @Override 69 | public BuildStepMonitor getRequiredMonitorService() { 70 | return null; 71 | } 72 | 73 | private static final Logger LOGGER = Logger.getLogger(OpenShiftScaler.class 74 | .getName()); 75 | 76 | @Extension 77 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 78 | implements IOpenShiftPluginDescriptor { 79 | 80 | public DescriptorImpl() { 81 | super(OpenShiftScalerExecution.class); 82 | } 83 | 84 | @Override 85 | public String getFunctionName() { 86 | return "openshiftScale"; 87 | } 88 | 89 | @Override 90 | public String getDisplayName() { 91 | return DISPLAY_NAME; 92 | } 93 | 94 | @Override 95 | public Step newInstance(Map arguments) throws Exception { 96 | if (!arguments.containsKey("deploymentConfig") 97 | && !arguments.containsKey("depCfg")) 98 | throw new IllegalArgumentException( 99 | "need to specify deploymentConfig"); 100 | Object depCfg = arguments.get("deploymentConfig"); 101 | if (depCfg == null || depCfg.toString().trim().length() == 0) 102 | depCfg = arguments.get("depCfg"); 103 | if (depCfg == null || depCfg.toString().trim().length() == 0) 104 | throw new IllegalArgumentException( 105 | "need to specify deploymentConfig"); 106 | if (!arguments.containsKey("replicaCount")) 107 | throw new IllegalArgumentException( 108 | "need to specif replicaCount"); 109 | OpenShiftScaler step = new OpenShiftScaler(depCfg.toString(), 110 | arguments.get("replicaCount").toString()); 111 | 112 | if (arguments.containsKey("verifyReplicaCount")) { 113 | Object verifyReplicaCount = arguments.get("verifyReplicaCount"); 114 | if (verifyReplicaCount != null) 115 | step.setVerifyReplicaCount(verifyReplicaCount.toString()); 116 | } 117 | 118 | ParamVerify.updateTimedDSLBaseStep(arguments, step); 119 | return step; 120 | } 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScalerExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftScalerExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftScaler step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftServiceVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.ParamVerify; 4 | import com.openshift.jenkins.plugins.pipeline.model.GlobalConfig; 5 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPluginDescriptor; 6 | import com.openshift.jenkins.plugins.pipeline.model.IOpenShiftServiceVerifier; 7 | import hudson.Extension; 8 | import hudson.model.AbstractBuild; 9 | import hudson.model.AbstractProject; 10 | import hudson.model.Action; 11 | import hudson.model.BuildListener; 12 | import hudson.tasks.BuildStepMonitor; 13 | import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; 14 | import org.jenkinsci.plugins.workflow.steps.Step; 15 | import org.kohsuke.stapler.DataBoundConstructor; 16 | import org.kohsuke.stapler.DataBoundSetter; 17 | 18 | import java.util.Collection; 19 | import java.util.Map; 20 | import java.util.logging.Logger; 21 | 22 | public class OpenShiftServiceVerifier extends OpenShiftBaseStep implements 23 | IOpenShiftServiceVerifier { 24 | 25 | protected final String svcName; 26 | protected String retryCount; 27 | 28 | @DataBoundConstructor 29 | public OpenShiftServiceVerifier(String svcName) { 30 | this.svcName = svcName != null ? svcName.trim() : null; 31 | } 32 | 33 | public String getSvcName() { 34 | return svcName; 35 | } 36 | 37 | public String getSvcName(Map overrides) { 38 | return getSvcName(); 39 | } 40 | 41 | public String getRetryCount() { 42 | return retryCount; 43 | } 44 | 45 | public String getRetryCount(Map overrides) { 46 | String val = getOverride(getRetryCount(), overrides); 47 | if (val.length() > 0) 48 | return val; 49 | return Integer.toString(GlobalConfig.getServiceVerifyRetry()); 50 | } 51 | 52 | @DataBoundSetter 53 | public void setRetryCount(String retryCount) { 54 | this.retryCount = retryCount != null ? retryCount.trim() : null; 55 | } 56 | 57 | @Override 58 | public boolean prebuild(AbstractBuild build, BuildListener listener) { 59 | return true; 60 | } 61 | 62 | @Override 63 | public Action getProjectAction(AbstractProject project) { 64 | return null; 65 | } 66 | 67 | @Override 68 | public Collection getProjectActions( 69 | AbstractProject project) { 70 | return null; 71 | } 72 | 73 | @Override 74 | public BuildStepMonitor getRequiredMonitorService() { 75 | return null; 76 | } 77 | 78 | private static final Logger LOGGER = Logger 79 | .getLogger(OpenShiftServiceVerifier.class.getName()); 80 | 81 | @Extension 82 | public static class DescriptorImpl extends AbstractStepDescriptorImpl 83 | implements IOpenShiftPluginDescriptor { 84 | 85 | public DescriptorImpl() { 86 | super(OpenShiftServiceVerifierExecution.class); 87 | } 88 | 89 | @Override 90 | public String getFunctionName() { 91 | return "openshiftVerifyService"; 92 | } 93 | 94 | @Override 95 | public String getDisplayName() { 96 | return DISPLAY_NAME; 97 | } 98 | 99 | @Override 100 | public Step newInstance(Map arguments) throws Exception { 101 | if (!arguments.containsKey("serviceName") 102 | && !arguments.containsKey("svcName")) 103 | throw new IllegalArgumentException( 104 | "need to specify serviceName"); 105 | Object svcName = arguments.get("serviceName"); 106 | if (svcName == null || svcName.toString().trim().length() == 0) 107 | svcName = arguments.get("svcName"); 108 | if (svcName == null || svcName.toString().trim().length() == 0) 109 | throw new IllegalArgumentException( 110 | "need to specify serviceName"); 111 | OpenShiftServiceVerifier step = new OpenShiftServiceVerifier( 112 | svcName.toString()); 113 | 114 | if (arguments.containsKey("retryCount")) { 115 | Object retryCount = arguments.get("retryCount"); 116 | if (retryCount != null) 117 | step.setRetryCount(retryCount.toString()); 118 | } 119 | 120 | ParamVerify.updateDSLBaseStep(arguments, step); 121 | return step; 122 | } 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftServiceVerifierExecution.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import hudson.AbortException; 4 | import hudson.EnvVars; 5 | import hudson.FilePath; 6 | import hudson.Launcher; 7 | import hudson.model.TaskListener; 8 | import hudson.model.Computer; 9 | import hudson.model.Executor; 10 | import hudson.model.Run; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution; 15 | import org.jenkinsci.plugins.workflow.steps.StepContextParameter; 16 | 17 | public class OpenShiftServiceVerifierExecution extends 18 | AbstractSynchronousNonBlockingStepExecution { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @StepContextParameter 23 | private transient TaskListener listener; 24 | @StepContextParameter 25 | private transient Launcher launcher; 26 | @StepContextParameter 27 | private transient EnvVars envVars; 28 | @StepContextParameter 29 | private transient Run runObj; 30 | @StepContextParameter 31 | private transient FilePath filePath; // included as ref of what can be 32 | // included for future use 33 | @StepContextParameter 34 | private transient Executor executor; // included as ref of what can be 35 | // included for future use 36 | @StepContextParameter 37 | private transient Computer computer; // included as ref of what can be 38 | // included for future use 39 | 40 | @Inject 41 | private transient OpenShiftServiceVerifier step; 42 | 43 | @Override 44 | protected Void run() throws Exception { 45 | boolean success = step.doItCore(listener, envVars, runObj, null, 46 | launcher); 47 | if (!success) { 48 | throw new AbortException("\"" 49 | + step.getDescriptor().getDisplayName() + "\" failed"); 50 | } 51 | return null; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/TimedOpenShiftBaseStep.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.dsl; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.model.ITimedOpenShiftPlugin; 4 | import org.kohsuke.stapler.DataBoundSetter; 5 | 6 | public abstract class TimedOpenShiftBaseStep extends OpenShiftBaseStep 7 | implements ITimedOpenShiftPlugin { 8 | 9 | protected String waitTime; 10 | 11 | protected String waitUnit; 12 | 13 | final public String getWaitTime() { 14 | return waitTime; 15 | } 16 | 17 | final public String getWaitUnit() { 18 | return TimeoutUnit.normalize(waitUnit); 19 | } 20 | 21 | @DataBoundSetter 22 | final public void setWaitTime(String waitTime) { 23 | this.waitTime = waitTime != null ? waitTime.trim() : null; 24 | } 25 | 26 | @DataBoundSetter 27 | final public void setWaitUnit(String waitUnit) { 28 | this.waitUnit = waitUnit != null ? waitUnit.trim() : null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/GlobalConfig.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.*; 4 | 5 | // this class is storage for Global Jenkins config, accessible via config.jelly and extensions 6 | // to DescriptorImpl extensions to BuildStepDescriptor which we only define in the 7 | // freestyle version of our build steps. They get executed even if no freestyle jobs are defined, 8 | // so no need to define them twice. That said, we store the values in this singleton to allow for easy 9 | // access for the DSL versions of our build steps. 10 | public class GlobalConfig { 11 | 12 | private static final long MINUTE = 60 * 1000; 13 | 14 | public static final long UBER_DEFAULT_WAIT = 5 * MINUTE; 15 | 16 | public static final long DEFAULT_BUILD_WAIT = 15 * MINUTE; 17 | public static final long DEFAULT_BUILD_VERIFY_WAIT = 1 * MINUTE; 18 | 19 | public static final long DEFAULT_DEPLOY_WAIT = 10 * MINUTE; 20 | public static final long DEFAULT_DEPLOY_VERIFY_WAIT = 3 * MINUTE; 21 | 22 | public static final long DEFAULT_SCALER_WAIT = 3 * MINUTE; 23 | public static final int DEFAULT_SERVICE_VERIFY_RETRY = 100; 24 | 25 | public static final long DEFAULT_EXEC_WAIT = 3 * MINUTE; 26 | 27 | public static long getBuildWait() { 28 | return new OpenShiftBuilder.DescriptorImpl() 29 | .getConfiguredDefaultWaitTime(); 30 | } 31 | 32 | public static long getBuildVerifyWait() { 33 | return new OpenShiftBuildVerifier.DescriptorImpl() 34 | .getConfiguredDefaultWaitTime(); 35 | } 36 | 37 | public static long getExecWait() { 38 | return new OpenShiftExec.DescriptorImpl() 39 | .getConfiguredDefaultWaitTime(); 40 | } 41 | 42 | public static long getDeployWait() { 43 | return new OpenShiftDeployer.DescriptorImpl() 44 | .getConfiguredDefaultWaitTime(); 45 | } 46 | 47 | public static long getDeployVerifyWait() { 48 | return new OpenShiftDeploymentVerifier.DescriptorImpl() 49 | .getConfiguredDefaultWaitTime(); 50 | } 51 | 52 | public static long getScalerWait() { 53 | return new OpenShiftScaler.DescriptorImpl() 54 | .getConfiguredDefaultWaitTime(); 55 | } 56 | 57 | public static int getServiceVerifyRetry() { 58 | return new OpenShiftServiceVerifier.DescriptorImpl() 59 | .getConfiguredRetryCount(); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/IOpenShiftDeleterJsonYaml.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import hudson.Launcher; 4 | import hudson.model.TaskListener; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import org.jboss.dmr.ModelNode; 10 | 11 | import com.openshift.jenkins.plugins.pipeline.MessageConstants; 12 | import com.openshift.restclient.IClient; 13 | 14 | public interface IOpenShiftDeleterJsonYaml extends IOpenShiftApiObjHandler { 15 | 16 | final static String DISPLAY_NAME = "Delete OpenShift Resource(s) from JSON or YAML"; 17 | final static String UNDEFINED = "undefined"; 18 | 19 | default String getDisplayName() { 20 | return DISPLAY_NAME; 21 | } 22 | 23 | String getJsonyaml(); 24 | 25 | default String getJsonyaml(Map overrides) { 26 | return getOverride(getJsonyaml(), overrides); 27 | } 28 | 29 | default boolean coreLogic(Launcher launcher, TaskListener listener, 30 | Map overrides) { 31 | boolean chatty = Boolean.parseBoolean(getVerbose(overrides)); 32 | listener.getLogger().println( 33 | String.format(MessageConstants.START_DELETE_OBJS, DISPLAY_NAME, 34 | getNamespace(overrides))); 35 | updateApiTypes(chatty, listener, overrides); 36 | 37 | ModelNode resources = this.hydrateJsonYaml(getJsonyaml(overrides), 38 | chatty ? listener : null); 39 | if (resources == null) { 40 | return false; 41 | } 42 | 43 | // get oc client 44 | IClient client = this.getClient(listener, DISPLAY_NAME, overrides); 45 | 46 | if (client != null) { 47 | // cycle through json and POST to appropriate resource 48 | String kind = resources.get("kind").asString(); 49 | int deletes = 0; 50 | int fails = 0; 51 | if (kind.equalsIgnoreCase("List")) { 52 | List list = resources.get("items").asList(); 53 | for (ModelNode node : list) { 54 | String path = node.get("kind").asString(); 55 | String name = node.get("metadata").get("name").asString(); 56 | String namespace = node.get("metadata").get("namespace") 57 | .asString(); 58 | if (UNDEFINED.equals(namespace)) 59 | namespace = getNamespace(overrides); 60 | 61 | // rc[0] will be successful deletes, rc[1] will be failed 62 | // deletes 63 | int[] rc = new int[2]; 64 | rc = deleteAPIObjs(client, listener, namespace, path, name, 65 | null, chatty); 66 | deletes = deletes + rc[0]; 67 | fails = fails + rc[1]; 68 | 69 | } 70 | } else { 71 | String path = kind; 72 | String name = resources.get("metadata").get("name").asString(); 73 | String namespace = resources.get("metadata").get("namespace") 74 | .asString(); 75 | if (UNDEFINED.equals(namespace)) 76 | namespace = getNamespace(overrides); 77 | 78 | // rc[0] will be successful deletes, rc[1] will be failed 79 | // deletes 80 | int[] rc = new int[2]; 81 | rc = deleteAPIObjs(client, listener, namespace, path, name, 82 | null, chatty); 83 | deletes = deletes + rc[0]; 84 | fails = fails + rc[1]; 85 | 86 | } 87 | 88 | if (fails > 0) { 89 | listener.getLogger().println( 90 | String.format(MessageConstants.EXIT_DELETE_BAD, 91 | DISPLAY_NAME, deletes, fails)); 92 | return false; 93 | } else { 94 | listener.getLogger().println( 95 | String.format(MessageConstants.EXIT_DELETE_GOOD, 96 | DISPLAY_NAME, deletes)); 97 | return true; 98 | } 99 | } 100 | return false; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/IOpenShiftDeleterList.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import hudson.Launcher; 4 | import hudson.model.TaskListener; 5 | 6 | import java.util.Map; 7 | import java.util.Set; 8 | 9 | import com.openshift.jenkins.plugins.pipeline.MessageConstants; 10 | import com.openshift.jenkins.plugins.pipeline.OpenShiftApiObjHandler; 11 | import com.openshift.restclient.IClient; 12 | 13 | public interface IOpenShiftDeleterList extends IOpenShiftApiObjHandler { 14 | 15 | final static String DISPLAY_NAME = "Delete OpenShift Resource(s) by Key"; 16 | 17 | default String getDisplayName() { 18 | return DISPLAY_NAME; 19 | } 20 | 21 | String getKeys(); 22 | 23 | String getTypes(); 24 | 25 | default String getTypes(Map overrides) { 26 | return getOverride(getTypes(), overrides); 27 | } 28 | 29 | default String getKeys(Map overrides) { 30 | return getOverride(getKeys(), overrides); 31 | } 32 | 33 | default boolean coreLogic(Launcher launcher, TaskListener listener, 34 | Map overrides) { 35 | boolean chatty = Boolean.parseBoolean(getVerbose(overrides)); 36 | listener.getLogger().println( 37 | String.format(MessageConstants.START_DELETE_OBJS, DISPLAY_NAME, 38 | getNamespace(overrides))); 39 | 40 | updateApiTypes(chatty, listener, overrides); 41 | 42 | // get oc client 43 | IClient client = this.getClient(listener, DISPLAY_NAME, overrides); 44 | 45 | if (client != null) { 46 | // verify valid type is specified 47 | Set types = OpenShiftApiObjHandler.apiMap.keySet(); 48 | String resourceKind = null; 49 | int deletes = 0; 50 | int fails = 0; 51 | int badType = 0; 52 | String[] inputTypes = getTypes(overrides).split(","); 53 | String[] inputKeys = getKeys(overrides).split(","); 54 | 55 | if (inputTypes.length != inputKeys.length) { 56 | listener.getLogger().println( 57 | String.format( 58 | MessageConstants.EXIT_DELETE_KEY_TYPE_MISMATCH, 59 | inputTypes.length, inputKeys.length)); 60 | return false; 61 | } 62 | 63 | for (int i = 0; i < inputTypes.length; i++) { 64 | if (OpenShiftApiObjHandler.typeShortcut 65 | .containsKey(inputTypes[i])) { 66 | resourceKind = OpenShiftApiObjHandler.typeShortcut 67 | .get(inputTypes[i]); 68 | } else { 69 | for (String type : types) { 70 | 71 | if (type.equalsIgnoreCase(inputTypes[i])) { 72 | resourceKind = type; 73 | break; 74 | } 75 | 76 | } 77 | } 78 | 79 | if (resourceKind == null) { 80 | listener.getLogger().println( 81 | String.format(MessageConstants.TYPE_NOT_SUPPORTED, 82 | inputTypes[i])); 83 | badType++; 84 | continue; 85 | } 86 | 87 | // rc[0] will be successful deletes, rc[1] will be failed 88 | // deletes 89 | int[] rc = new int[2]; 90 | rc = deleteAPIObjs(client, listener, getNamespace(overrides), 91 | resourceKind, inputKeys[i], null, chatty); 92 | deletes = deletes + rc[0]; 93 | fails = fails + rc[1]; 94 | } 95 | 96 | if (fails == 0 && badType == 0) { 97 | listener.getLogger().println( 98 | String.format(MessageConstants.EXIT_DELETE_GOOD, 99 | DISPLAY_NAME, deletes)); 100 | return true; 101 | } else { 102 | listener.getLogger().println( 103 | String.format(MessageConstants.EXIT_DELETE_BAD, 104 | DISPLAY_NAME, deletes, fails + badType)); 105 | } 106 | } 107 | return false; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/IOpenShiftParameterOverrides.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import java.util.Map; 4 | 5 | public interface IOpenShiftParameterOverrides { 6 | 7 | default String pruneKey(String key) { 8 | if (key == null) 9 | key = ""; 10 | if (key.startsWith("$")) 11 | return key.substring(1, key.length()).trim(); 12 | return key.trim(); 13 | } 14 | 15 | default String getOverride(String key, Map overrides) { 16 | String val = pruneKey(key); 17 | // try override when the key is the entire parameter ... we don't just 18 | // use 19 | // replaceMacro cause we also support PARM with $ or ${} 20 | if (overrides != null && overrides.containsKey(val)) { 21 | val = overrides.get(val); 22 | } else { 23 | // see if it is a mix used key (i.e. myapp-${VERSION}) or ${val} 24 | String tmp = hudson.Util.replaceMacro(key, overrides); 25 | if (tmp != null && tmp.length() > 0) 26 | val = tmp; 27 | } 28 | return val; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/IOpenShiftServiceVerifier.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import com.openshift.jenkins.plugins.pipeline.MessageConstants; 4 | import com.openshift.restclient.IClient; 5 | import com.openshift.restclient.ResourceKind; 6 | import com.openshift.restclient.model.IService; 7 | import hudson.Launcher; 8 | import hudson.model.TaskListener; 9 | 10 | import java.io.IOException; 11 | import java.net.InetSocketAddress; 12 | import java.net.Socket; 13 | import java.util.Map; 14 | 15 | public interface IOpenShiftServiceVerifier extends IOpenShiftPlugin { 16 | String DISPLAY_NAME = "Verify OpenShift Service"; 17 | 18 | default String getDisplayName() { 19 | return DISPLAY_NAME; 20 | } 21 | 22 | String getSvcName(); 23 | 24 | String getRetryCount(); 25 | 26 | String getRetryCount(Map overrides); 27 | 28 | default String getSvcName(Map overrides) { 29 | return getOverride(getSvcName(), overrides); 30 | } 31 | 32 | default boolean coreLogic(Launcher launcher, TaskListener listener, 33 | Map overrides) { 34 | boolean chatty = Boolean.parseBoolean(getVerbose(overrides)); 35 | listener.getLogger().println( 36 | String.format(MessageConstants.START_SERVICE_VERIFY, 37 | DISPLAY_NAME, getSvcName(overrides), 38 | getNamespace(overrides))); 39 | 40 | // get oc client 41 | IClient client = this.getClient(listener, DISPLAY_NAME, overrides); 42 | String spec = null; 43 | 44 | if (client != null) { 45 | // get Service 46 | IService svc = client.get(ResourceKind.SERVICE, 47 | getSvcName(overrides), getNamespace(overrides)); 48 | String ip = svc.getClusterIP(); 49 | int port = svc.getPort(); 50 | spec = ip + ":" + port; 51 | int tryCount = 0; 52 | if (chatty) 53 | listener.getLogger().println( 54 | "\nOpenShiftServiceVerifier retry " 55 | + getRetryCount(overrides)); 56 | listener.getLogger().println( 57 | String.format(MessageConstants.SERVICE_CONNECTING, spec)); 58 | while (tryCount < Integer.parseInt(getRetryCount(overrides))) { 59 | tryCount++; 60 | if (chatty) 61 | listener.getLogger().println( 62 | "\nOpenShiftServiceVerifier attempt connect to " 63 | + spec + " attempt " + tryCount); 64 | InetSocketAddress address = new InetSocketAddress(ip, port); 65 | Socket socket = null; 66 | try { 67 | socket = new Socket(); 68 | socket.connect(address, 2500); 69 | listener.getLogger().println( 70 | String.format( 71 | MessageConstants.EXIT_SERVICE_VERIFY_GOOD, 72 | DISPLAY_NAME, spec)); 73 | return true; 74 | } catch (IOException e) { 75 | if (chatty) 76 | e.printStackTrace(listener.getLogger()); 77 | try { 78 | Thread.sleep(2500); 79 | } catch (InterruptedException e1) { 80 | } 81 | } finally { 82 | try { 83 | socket.close(); 84 | } catch (IOException e) { 85 | if (chatty) 86 | e.printStackTrace(listener.getLogger()); 87 | } 88 | } 89 | } 90 | 91 | } else { 92 | return false; 93 | } 94 | 95 | listener.getLogger().println( 96 | String.format(MessageConstants.EXIT_SERVICE_VERIFY_BAD, 97 | DISPLAY_NAME, spec)); 98 | 99 | return false; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/openshift/jenkins/plugins/pipeline/model/ITimedOpenShiftPlugin.java: -------------------------------------------------------------------------------- 1 | package com.openshift.jenkins.plugins.pipeline.model; 2 | 3 | import hudson.model.TaskListener; 4 | 5 | import java.util.Map; 6 | 7 | public interface ITimedOpenShiftPlugin extends IOpenShiftPlugin { 8 | 9 | enum TimeoutUnit { 10 | MILLISECONDS("milli", 1), SECONDS("sec", 1000), MINUTES("min", 11 | 1000 * 60); 12 | 13 | public final String name; 14 | public final long multiplier; 15 | 16 | TimeoutUnit(String name, long multiplier) { 17 | this.name = name; 18 | this.multiplier = multiplier; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return name; 24 | } 25 | 26 | public boolean matches(String value) { 27 | if (value == null || value.trim().isEmpty()) { 28 | return false; 29 | } 30 | return name.equalsIgnoreCase(value); 31 | } 32 | 33 | public static TimeoutUnit getByName(String unit) { 34 | if (unit == null || unit.trim().isEmpty()) { 35 | // If units are not specified, fallback to millis for backwards 36 | // compatibility. 37 | unit = "milli"; 38 | } 39 | 40 | unit = unit.trim(); 41 | 42 | for (TimeoutUnit tu : TimeoutUnit.values()) { 43 | if (tu.name.equalsIgnoreCase(unit)) { 44 | return tu; 45 | } 46 | } 47 | 48 | throw new IllegalArgumentException("Unexpected time unit name: " 49 | + unit); 50 | } 51 | 52 | public static String normalize(String value) { 53 | if (value == null || value.trim().isEmpty()) { 54 | // Default to milliseconds for backwards compatibility 55 | return MILLISECONDS.toString(); 56 | } else { 57 | return value.trim().toString(); 58 | } 59 | } 60 | 61 | public long toMilliseconds(String value, long def) { 62 | if (value == null || value.trim().isEmpty()) { 63 | return def; 64 | } 65 | long l = Long.parseLong(value); 66 | l *= multiplier; 67 | return l; 68 | } 69 | 70 | } 71 | 72 | String getWaitTime(); 73 | 74 | String getWaitUnit(); 75 | 76 | long getGlobalTimeoutConfiguration(); 77 | 78 | default long getTimeout(TaskListener listener, boolean chatty, 79 | Map overrides) { 80 | long global = getGlobalTimeoutConfiguration(); 81 | 82 | /** 83 | * We allow user to specify variable names for timeout values, so check 84 | * overrides map. 85 | */ 86 | String field = getOverride(getWaitTime(), overrides); 87 | TimeoutUnit unit = TimeoutUnit.getByName(getWaitUnit()); 88 | long chosen = unit.toMilliseconds(field, global); 89 | 90 | if (chatty) { 91 | listener.getLogger().println( 92 | "Found global job type timeout configuration: " + global 93 | + " milliseconds"); 94 | if (field == null || field.trim().isEmpty()) { 95 | listener.getLogger().println( 96 | "No local timeout configured for this step"); 97 | } else { 98 | listener.getLogger().println( 99 | "Local step timeout configuration: " + field + " " 100 | + unit); 101 | } 102 | } 103 | 104 | listener.getLogger().println( 105 | "Operation will timeout after " + chosen + " milliseconds"); 106 | return chosen; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Argument/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

8 | 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Argument/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Argument/help-value.html: -------------------------------------------------------------------------------- 1 |
2 | The value for the environment variable. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Common/cluster.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Common/global-wait.jelly: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Common/verbose-wait.jelly: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/Common/verbose.jelly: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/NameValuePair/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 |
14 |
15 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/NameValuePair/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/NameValuePair/help-name.html: -------------------------------------------------------------------------------- 1 |
2 | The name of the environment variable to set. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/NameValuePair/help-value.html: -------------------------------------------------------------------------------- 1 |
2 | The value for the environment variable. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildCanceller/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildCanceller/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildCanceller/help-bldCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get bc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildVerifier/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildVerifier/help-bldCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get bc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuildVerifier/help-checkForTriggeredDeployments.html: -------------------------------------------------------------------------------- 1 |
2 | This flag is the toggle for turning on or off the verification that any deployments triggered by this build's output fired. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-bldCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get bc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-buildName.html: -------------------------------------------------------------------------------- 1 |
2 | The value here is what 3 | you supply with the --from-build option when invoking the OpenShift `oc start-build` command. 4 | It allows you to point to OpenShift build to a previously run build, and run another build 5 | with exactly the same source and destination metadata. If you do 6 | not supply a value, the plugin will generate a new OpenShift build based on the Build Configuration 7 | referenced. 8 |
9 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-checkForTriggeredDeployments.html: -------------------------------------------------------------------------------- 1 |
2 | This flag is the toggle for turning on or off the verification that any deployments triggered by this build's output fired. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-commitID.html: -------------------------------------------------------------------------------- 1 |
2 | The value here is what 3 | you supply with the --commit option when invoking the OpenShift `oc start-build` command. 4 | It allows you to point the OpenShift build to a specific commit hash from the git-log of the 5 | source repository. If you do 6 | not supply a value, the plugin assumes the latest version from the source repository should 7 | be used. 8 |
9 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-env.html: -------------------------------------------------------------------------------- 1 |
2 | Specify a list of environment variables to include in the build (see `oc start-build -e ...`). 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftBuilder/help-showBuildLogs.html: -------------------------------------------------------------------------------- 1 |
2 | Indicates whether the build logs get dumped to the console of the Jenkins build. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftCreator/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftCreator/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftCreator/help-jsonyaml.html: -------------------------------------------------------------------------------- 1 |
2 | The JSON or YAML formatted text that conforms to the schema for defining the various OpenShift resources. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterJsonYaml/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterJsonYaml/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterJsonYaml/help-jsonyaml.html: -------------------------------------------------------------------------------- 1 |
2 | The JSON or YAML formatted text that conforms to the schema for defining the various OpenShift resources. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterLabels/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterLabels/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterLabels/help-keys.html: -------------------------------------------------------------------------------- 1 |
2 | The comma separated list of keys of the labels in the API objects to delete. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterLabels/help-types.html: -------------------------------------------------------------------------------- 1 |
2 | The comma separated list of types of API objects to delete, where those objects have labels corresponding to the specified key/value pairs. See https://docs.openshift.org/latest/rest_api/index.html for the supported types. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterLabels/help-values.html: -------------------------------------------------------------------------------- 1 |
2 | The comma separated list of values of the labels in the API objects to delete. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterList/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterList/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterList/help-keys.html: -------------------------------------------------------------------------------- 1 |
2 | The comma separated list of keys of the API objects to delete. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeleterList/help-types.html: -------------------------------------------------------------------------------- 1 |
2 | The comma separated list of types of API objects to delete. See https://docs.openshift.org/latest/rest_api/index.html for the supported types. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployCanceller/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployCanceller/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployCanceller/help-depCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get dc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployer/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployer/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeployer/help-depCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get dc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier/help-depCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get dc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier/help-replicaCount.html: -------------------------------------------------------------------------------- 1 |
2 | This optional field's value represents the number expected running pods for the deployment for the DeploymentConfig specified. 3 | If no value is specified it will work the number of running pods against the desired replica count in the DeploymentConfig. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftDeploymentVerifier/help-verifyReplicaCount.html: -------------------------------------------------------------------------------- 1 |
2 | This flag is the toggle for turning on or off the verification that the specified replica count for the deployment has been reached. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/help-arguments.html: -------------------------------------------------------------------------------- 1 |
2 | Specify a list of arguments to pass to the command. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/help-command.html: -------------------------------------------------------------------------------- 1 |
2 | The name of the command to execute. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/help-container.html: -------------------------------------------------------------------------------- 1 |
2 | The container in which to execute a command. If not specified, the first container in the pod will be used. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftExec/help-pod.html: -------------------------------------------------------------------------------- 1 |
2 | The pod in which to execute a command. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageStreams/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageStreams/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageStreams/help-imageStreamName.html: -------------------------------------------------------------------------------- 1 |
2 | The name of the ImageStream is what shows up in the NAME column if 3 | you dump all the ImageStream's with the `oc get is` command invocation. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageStreams/help-tag.html: -------------------------------------------------------------------------------- 1 |
2 | The specific image tag within the ImageStream to monitor. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-alias.html: -------------------------------------------------------------------------------- 1 |
2 | This flag is the equivalent of the `--alias` option for the `oc tag` command. When false, the destination tag type is "ImageStreamImage", and when true, the destination tag type is "ImageStreamTag". 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-destinationAuthToken.html: -------------------------------------------------------------------------------- 1 |
2 | The value here is what 3 | you supply with the --token option when invoking the OpenShift `oc` command. If you do 4 | not supply a value, the plugin will assume it is running in the OpenShift Jenkins 5 | image and attempt to load the kubernetes service account token stored in that image. 6 |
7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-destinationNamespace.html: -------------------------------------------------------------------------------- 1 |
2 | The value here should match the value from the output from `oc project` if you created the resources related to this task from the command line. 3 | If nothing is specified, the plugin will inspect the PROJECT_NAME environment variable. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-prodStream.html: -------------------------------------------------------------------------------- 1 |
2 | One or more ImageStream names in a comma delimited list. If multiple 3 | streams and multiple destination tags are specified, the two lists 4 | must contain the same number of elements. 5 |
6 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-prodTag.html: -------------------------------------------------------------------------------- 1 |
2 | One or more tag names in a comma delimited list. If multiple 3 | streams and multiple destination tags are specified, the two lists 4 | must contain the same number of elements. 5 |
6 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-testStream.html: -------------------------------------------------------------------------------- 1 |
2 | The name of the ImageStream for the existing tag. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger/help-testTag.html: -------------------------------------------------------------------------------- 1 |
2 | The name of the existing tag, or an actual, existing image ID. The image referenced will have the new tag applied to it. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler/help-depCfg.html: -------------------------------------------------------------------------------- 1 |
2 | If you run `oc get dc` for the project 3 | listed in "nameSpace", that is the value you want to put here. 4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler/help-replicaCount.html: -------------------------------------------------------------------------------- 1 |
2 | The value here should be the number of started pods desired for the deployment specified. It is the 3 | equivalent of the value supplied to --replicas with an `oc scale` command invocation. This is a required parameter. 4 | If an integer is not specified here, this build step can not be added to the job. 5 | Note: specifying a 0 is allowed, and means you do not want any pods for the specified deployment config running. 6 |
7 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScaler/help-verifyReplicaCount.html: -------------------------------------------------------------------------------- 1 |
2 | This flag is the toggle for turning on or off the verification that the specified replica count for the deployment has been reached. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction/config.jelly: -------------------------------------------------------------------------------- 1 | ../OpenShiftScaler/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction/global.jelly: -------------------------------------------------------------------------------- 1 | ../OpenShiftScaler/global.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction/help-depCfg.html: -------------------------------------------------------------------------------- 1 | ../OpenShiftScaler/help-depCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction/help-replicaCount.html: -------------------------------------------------------------------------------- 1 | ../OpenShiftScaler/help-replicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftScalerPostAction/help-verifyReplicaCount.html: -------------------------------------------------------------------------------- 1 | ../OpenShiftScaler/help-verifyReplicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftServiceVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftServiceVerifier/global.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/OpenShiftServiceVerifier/help-svcName.html: -------------------------------------------------------------------------------- 1 |
2 | The equivalent to the name supplied to a `oc get service` command line invocation. 3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuildVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuildVerifier/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuildVerifier/help-bldCfg.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuildVerifier/help-bldCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuildVerifier/help-checkForTriggeredDeployments.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuildVerifier/help-checkForTriggeredDeployments.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-bldCfg.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-bldCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-buildName.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-buildName.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-checkForTriggeredDeployments.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-checkForTriggeredDeployments.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-commitID.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-commitID.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-env.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-env.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftBuilder/help-showBuildLogs.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftBuilder/help-showBuildLogs.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftCreator/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftCreator/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftCreator/help-jsonyaml.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftCreator/help-jsonyaml.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterJsonYaml/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterJsonYaml/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterJsonYaml/help-jsonyaml.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterJsonYaml/help-jsonyaml.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabels/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterLabels/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabels/help-keys.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterLabels/help-keys.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabels/help-types.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterLabels/help-types.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterLabels/help-values.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterLabels/help-values.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterList/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterList/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterList/help-keys.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterList/help-keys.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeleterList/help-types.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeleterList/help-types.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeployer/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeployer/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeployer/help-depCfg.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeployer/help-depCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeploymentVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeploymentVerifier/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeploymentVerifier/help-depCfg.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeploymentVerifier/help-depCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeploymentVerifier/help-replicaCount.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeploymentVerifier/help-replicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftDeploymentVerifier/help-verifyReplicaCount.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftDeploymentVerifier/help-verifyReplicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftExec/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec/help-arguments.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftExec/help-arguments.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec/help-command.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftExec/help-command.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec/help-container.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftExec/help-container.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec/help-pod.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftExec/help-pod.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageStreams/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageStreams/help-name.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageStreams/help-imageStreamName.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageStreams/help-tag.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageStreams/help-tag.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-alias.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-alias.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-destStream.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-prodStream.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-destTag.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-prodTag.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-destinationAuthToken.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-destinationAuthToken.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-destinationNamespace.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-destinationNamespace.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-srcStream.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-testStream.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftImageTagger/help-srcTag.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftImageTagger/help-testTag.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScaler/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftScaler/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScaler/help-depCfg.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftScaler/help-depCfg.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScaler/help-replicaCount.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftScaler/help-replicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftScaler/help-verifyReplicaCount.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftScaler/help-verifyReplicaCount.html -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftServiceVerifier/config.jelly: -------------------------------------------------------------------------------- 1 | ../../OpenShiftServiceVerifier/config.jelly -------------------------------------------------------------------------------- /src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftServiceVerifier/help-svcName.html: -------------------------------------------------------------------------------- 1 | ../../OpenShiftServiceVerifier/help-svcName.html -------------------------------------------------------------------------------- /src/main/resources/index.jelly: -------------------------------------------------------------------------------- 1 | 2 | 5 |
6 | This plugin facilitates the construction of jobs, pipelines, and workflows that operate on a Kubernetes based OpenShift server. 7 |
8 | -------------------------------------------------------------------------------- /src/main/webapp/help-apiURL.html: -------------------------------------------------------------------------------- 1 |
2 | The URI for the OpenShift cluster API server. If nothing 3 | is specified, the KUBERNETES_SERVICE_HOST environment variable will be used. 4 | If that environment variable is not set, the plugin will attempt to connect 5 | to "https://openshift.default.svc.cluster.local". 6 |
7 | -------------------------------------------------------------------------------- /src/main/webapp/help-authToken.html: -------------------------------------------------------------------------------- 1 |
2 | The authorization token to use for this operation. If you do 3 | not supply a value, the plugin will assume it is running in the OpenShift Jenkins 4 | image and attempt to load the kubernetes service account token stored in that image. 5 |
6 | -------------------------------------------------------------------------------- /src/main/webapp/help-namespace.html: -------------------------------------------------------------------------------- 1 |
2 | The OpenShift project/namespace on which to operate. If nothing is specified, the PROJECT_NAME environment variable 3 | will be used. 4 |
5 | -------------------------------------------------------------------------------- /src/main/webapp/help-verbose.html: -------------------------------------------------------------------------------- 1 |
2 | Enables verbose logging. 3 |
4 | -------------------------------------------------------------------------------- /src/main/webapp/help-waitTime.html: -------------------------------------------------------------------------------- 1 |
2 | The maximum amount of time to wait for this operation to complete. 3 |
4 | -------------------------------------------------------------------------------- /src/main/webapp/help-waitUnit.html: -------------------------------------------------------------------------------- 1 |
2 | The time unit of the timeout value. 3 |
4 | --------------------------------------------------------------------------------