public void perform()

in src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java [194:267]


    public void perform(@Nonnull Run<?,?> build, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException {
        this.logger = listener.getLogger();
        envVars = build.getEnvironment(listener);
        final boolean buildFailed = build.getResult() == Result.FAILURE;
        if (buildFailed) {
            logger.println("Skipping CodeDeploy publisher as build failed");
            return;
        }

        final AWSClients aws;
        if ("awsAccessKey".equals(credentials)) {
            if (StringUtils.isEmpty(this.awsAccessKey) && StringUtils.isEmpty(this.awsSecretKey)) {
                aws = AWSClients.fromDefaultCredentialChain(
                        this.region,
                        this.proxyHost,
                        this.proxyPort);
            } else {
                aws = AWSClients.fromBasicCredentials(
                        this.region,
                        this.awsAccessKey,
                        this.awsSecretKey,
                        this.proxyHost,
                        this.proxyPort);
            }
        } else {
            aws = AWSClients.fromIAMRole(
                this.region,
                this.iamRoleArn,
                this.getDescriptor().getExternalId(),
                this.proxyHost,
                this.proxyPort);
        }

        boolean success = false;

        try {

            verifyCodeDeployApplication(aws);

            final String projectName = build.getDisplayName();
            if (workspace == null) {
                throw new IllegalArgumentException("No workspace present for the build.");
            }

            RevisionLocation revisionLocation;

            if (!StringUtils.isEmpty(this.githubRepository) && !StringUtils.isEmpty(this.githubCommitId)) {
              revisionLocation = createFromGitHub();
            } else {
              final FilePath sourceDirectory = getSourceDirectory(workspace);
              revisionLocation = zipAndUpload(aws, projectName, sourceDirectory);
            }

            registerRevision(aws, revisionLocation);
            if ("onlyRevision".equals(deploymentMethod)){
              success = true;
            } else {

              String deploymentId = createDeployment(aws, revisionLocation);

              success = waitForDeployment(aws, deploymentId);
            }

        } catch (Exception e) {

            this.logger.println("Failed CodeDeploy post-build step; exception follows.");
            this.logger.println(e.getMessage());
            e.printStackTrace(this.logger);
        }

        if (!success) {
            throw new AbortException();
        }
    }