@Override protected void doPerform(Run<?, ?> run, TaskLogger taskLogger, ChartRepo chartRepo) throws ServiceException { taskLogger.info("Deploying chart [" + getChartName() + "] into namespace: " + getNamespace() ); final String runName = (run != null) ? run.toString() : "<NO-RUN>"; Map<String, String> label = Collections.singletonMap(JENKINS_JOB, StringUtils.deleteWhitespace(runName).replace('#', '_') ); final Chart chart = deploymentService.deployChart(getKubeName(), getNamespace(), chartRepo, chartName, label); taskLogger.info("Chart [" + chartName + "] deployed"); if (deleteChartWhenFinished && run instanceof FreeStyleBuild) { taskLogger.info("Chart [" + chartName + "] will be deleted at the end of the run"); final DeployChartCleanup chartCleanup = new DeployChartCleanup(this, getNamespace(), chart, taskLogger); ((FreeStyleBuild) run).getEnvironments().add(0, chartCleanup); } }