当前位置: 首页>>代码示例>>Java>>正文


Java WorkflowJob.getProperty方法代码示例

本文整理汇总了Java中org.jenkinsci.plugins.workflow.job.WorkflowJob.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowJob.getProperty方法的具体用法?Java WorkflowJob.getProperty怎么用?Java WorkflowJob.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jenkinsci.plugins.workflow.job.WorkflowJob的用法示例。


在下文中一共展示了WorkflowJob.getProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeBuildConfigToJobMap

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
static synchronized void initializeBuildConfigToJobMap() {
    if (buildConfigToJobMap == null) {
        List<WorkflowJob> jobs = Jenkins.getActiveInstance().getAllItems(
                WorkflowJob.class);
        buildConfigToJobMap = new ConcurrentHashMap<>(jobs.size());
        for (WorkflowJob job : jobs) {
            BuildConfigProjectProperty buildConfigProjectProperty = job
                    .getProperty(BuildConfigProjectProperty.class);
            if (buildConfigProjectProperty == null) {
                continue;
            }
            String bcUid = buildConfigProjectProperty.getUid();
            if (isNotBlank(bcUid)) {
                buildConfigToJobMap.put(bcUid, job);
            }
        }
    }
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:19,代码来源:BuildConfigToJobMap.java

示例2: maybeScheduleNext

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
public static void maybeScheduleNext(WorkflowJob job) {
	BuildConfigProjectProperty bcp = job.getProperty(BuildConfigProjectProperty.class);
	if (bcp == null) {
		return;
	}

	List<Build> builds = getAuthenticatedOpenShiftClient().builds().inNamespace(bcp.getNamespace())
			.withField(OPENSHIFT_BUILD_STATUS_FIELD, BuildPhases.NEW)
			.withLabel(OPENSHIFT_LABELS_BUILD_CONFIG_NAME, bcp.getName()).list().getItems();
	handleBuildList(job, builds, bcp);
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:12,代码来源:JenkinsUtils.java

示例3: buildConfigProjectForJob

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
/**
 * Returns the mapping of the jenkins workflow job to a qualified namespace and
 * BuildConfig name
 */
private BuildConfigProjectProperty buildConfigProjectForJob(WorkflowJob job) {

	BuildConfigProjectProperty property = job.getProperty(BuildConfigProjectProperty.class);

	if (property != null) {
		if (StringUtils.isNotBlank(property.getNamespace()) && StringUtils.isNotBlank(property.getName())) {
			logger.info("Found BuildConfigProjectProperty for namespace: " + property.getNamespace() + " name: "
					+ property.getName());
			return property;
		}
	}

	String patternRegex = this.jobNamePattern;
	String jobName = JenkinsUtils.getFullJobName(job);
	if (StringUtils.isNotEmpty(jobName) && StringUtils.isNotEmpty(patternRegex) && jobName.matches(patternRegex)) {
		String buildConfigName = OpenShiftUtils
				.convertNameToValidResourceName(JenkinsUtils.getBuildConfigName(job));

		// we will update the uuid when we create the BC
		String uuid = null;

		// TODO what to do for the resourceVersion?
		String resourceVersion = null;
		String buildRunPolicy = "Serial";
		for (String namespace : namespaces) {
			logger.info("Creating BuildConfigProjectProperty for namespace: " + namespace + " name: "
					+ buildConfigName);
			if (property != null) {
				property.setNamespace(namespace);
				property.setName(buildConfigName);
				if (!StringUtils.isNotBlank(property.getBuildRunPolicy())) {
					property.setBuildRunPolicy(buildRunPolicy);
				}
				return property;
			} else {
				return new BuildConfigProjectProperty(namespace, buildConfigName, uuid, resourceVersion,
						buildRunPolicy);
			}
		}

	}
	return null;
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:48,代码来源:PipelineJobListener.java

示例4: shouldSchedule

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Override
public boolean shouldSchedule(Queue.Task p, List<Action> actions) {
    if (p instanceof WorkflowJob && !isOpenShiftBuildCause(actions)) {
        WorkflowJob wj = (WorkflowJob) p;
        BuildConfigProjectProperty buildConfigProjectProperty = wj
                .getProperty(BuildConfigProjectProperty.class);
        if (buildConfigProjectProperty != null
                && StringUtils.isNotBlank(buildConfigProjectProperty
                        .getNamespace())
                && StringUtils.isNotBlank(buildConfigProjectProperty
                        .getName())) {

            String namespace = buildConfigProjectProperty.getNamespace();
            String jobURL = joinPaths(
                    getJenkinsURL(getAuthenticatedOpenShiftClient(),
                            namespace), wj.getUrl());

            Build ret = getAuthenticatedOpenShiftClient()
                    .buildConfigs()
                    .inNamespace(namespace)
                    .withName(buildConfigProjectProperty.getName())
                    .instantiate(
                            new BuildRequestBuilder()
                                    .withNewMetadata()
                                    .withName(
                                            buildConfigProjectProperty
                                                    .getName())
                                    .and()
                                    .addNewTriggeredBy()
                                    .withMessage(
                                            "Triggered by Jenkins job at "
                                                    + jobURL).and().build());

            ParametersAction params = dumpParams(actions);
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("ParametersAction: " + params.toString());
            }
            if (params != null && ret != null)
                BuildToActionMapper.addParameterAction(ret.getMetadata()
                        .getName(), params);

            CauseAction cause = dumpCause(actions);
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("get CauseAction: " + cause.getDisplayName());
                for (Cause c : cause.getCauses()) {
                    LOGGER.fine("Cause: " + c.getShortDescription());
                }
            }
            if (cause != null && ret != null)
                BuildToActionMapper.addCauseAction(ret.getMetadata()
                        .getName(), cause);

            return false;
        }
    }

    return true;
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:59,代码来源:BuildDecisionHandler.java


注:本文中的org.jenkinsci.plugins.workflow.job.WorkflowJob.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。