コード例 #1
0
  // required for to write the deployment properties back to Jenkins environment variables.
  @Override
  public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {

    int counter = 1;

    for (Deployment deployment : deployments) {
      // change counter to string and append be for build environment
      String strCounter = "BE_" + Integer.toString(counter);
      variables.putAll(deployment.getDeploymentComponents(strCounter));
      counter++;
    }
  }
コード例 #2
0
  protected boolean doTearDown() throws IOException, InterruptedException {
    boolean result = true;

    List<Deployment> reversedList = new ArrayList<Deployment>(deployments);
    Collections.reverse(reversedList);

    for (Deployment deployment : reversedList) {
      // automatically delete the stack?
      result = result && deployment.Destroy();
    }

    return result;
  }
コード例 #3
0
  @Override
  public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
      throws IOException, InterruptedException {

    EnvVars env = build.getEnvironment(listener);
    env.overrideAll(build.getBuildVariables());
    EnvVariableResolver helper = new EnvVariableResolver(build, listener);

    boolean success = true;

    int counter = 1;
    for (PluginParam param : params) {

      // resolve build vars in request params
      List<RequestParam> rparamResolved = new ArrayList<RequestParam>();
      ;

      for (RequestParam rparam : param.getRequestParams()) {
        String rparamString =
            helper.replaceBuildParamWithValue(rparam.getRequestParam().toString());
        rparamResolved.add(new RequestParam(rparamString));
      }

      // Resolve any environment variables in the parameters
      PluginParam fparam =
          new PluginParam(
              helper.replaceBuildParamWithValue(param.getServerUrl()),
              helper.replaceBuildParamWithValue(param.getUserName()),
              helper.replaceBuildParamWithValue(param.getPassword()),
              helper.replaceBuildParamWithValue(param.getTenant()),
              helper.replaceBuildParamWithValue(param.getBluePrintName()),
              param.isWaitExec(),
              param.getRequestTemplate(),
              rparamResolved);

      final Deployment deployment = newDeployment(listener.getLogger(), fparam);

      if (deployment.Create()) {
        this.deployments.add(deployment);
        // change counter to string and append be for build environment
        String strCounter = Integer.toString(counter) + "be";
        env.putAll(deployment.getDeploymentComponents(strCounter));
        counter++;
      } else {
        build.setResult(Result.FAILURE);
        success = false;
        break;
      }

      if (!success) {
        doTearDown();
        return null;
      }
    }
    return new Environment() {
      @Override
      public boolean tearDown(AbstractBuild build, BuildListener listener)
          throws IOException, InterruptedException {

        return doTearDown();
      }
    };
  }