public void publishArtifacts(List<ArtifactPlan> artifactPlans, EnvironmentVariableContext environmentVariableContext) {
        final File pluggableArtifactFolder = publishPluggableArtifacts(artifactPlans, environmentVariableContext);
        try {
            final List<ArtifactPlan> mergedPlans = artifactPlanFilter.getBuiltInMergedArtifactPlans(artifactPlans);

            if (isMetadataFolderEmpty(pluggableArtifactFolder)) {
                LOGGER.info("Pluggable metadata folder is empty.");
            } else if (pluggableArtifactFolder != null) {
                mergedPlans.add(0, new ArtifactPlan(ArtifactPlanType.file, format("%s%s*", pluggableArtifactFolder.getName(), File.separator), PLUGGABLE_ARTIFACT_METADATA_FOLDER));
            }

            for (ArtifactPlan artifactPlan : mergedPlans) {
                try {
                    artifactPlan.publishBuiltInArtifacts(goPublisher, workingDirectory);
                } catch (Exception e) {
                    failedArtifact.add(artifactPlan);
                }
            }

            if (!failedArtifact.isEmpty()) {
                StringBuilder builder = new StringBuilder();
                for (ArtifactPlan artifactPlan : failedArtifact) {
                    artifactPlan.printArtifactInfo(builder);
                }
                throw new RuntimeException(format("[%s] Uploading finished. Failed to upload %s.", PRODUCT_NAME, builder));
            }
        } finally {
            FileUtils.deleteQuietly(pluggableArtifactFolder);
        }
    }
@Test
    public void shouldContinueWithOtherPluginWhenPublishArtifactCallFailsForOnePlugin() {
        final ArtifactStore s3ArtifactStore = new ArtifactStore("s3", "cd.go.s3", create("access_key", false, "some-key"));
        final ArtifactStore dockerArtifactStore = new ArtifactStore("docker", "cd.go.docker", create("registry-url", false, "docker.io"));
        final ArtifactStores artifactStores = new ArtifactStores(s3ArtifactStore, dockerArtifactStore);
        final ArtifactPlan s3ArtifactPlan = new ArtifactPlan(new PluggableArtifactConfig("installers", "s3", create("Baz", true, "Car")));
        final ArtifactPlan dockerArtifactPlan = new ArtifactPlan(new PluggableArtifactConfig("test-reports", "docker", create("junit", false, "junit.xml")));

        when(artifactExtension.publishArtifact(eq("cd.go.s3"), eq(s3ArtifactPlan), eq(s3ArtifactStore), anyString(), eq(env)))
                .thenThrow(new RuntimeException("Interaction with plugin `cd.go.s3` failed."));
        when(artifactExtension.publishArtifact(eq("cd.go.docker"), eq(dockerArtifactPlan), eq(dockerArtifactStore), anyString(), eq(env)))
                .thenReturn(new PublishArtifactResponse(Collections.singletonMap("tag", "10.12.0")));

        assertThatThrownBy(() -> new ArtifactsPublisher(publisher, artifactExtension, artifactStores, registry, workingFolder)
                    .publishArtifacts(Arrays.asList(s3ArtifactPlan, dockerArtifactPlan), env))
            .hasMessageContaining("[go] Uploading finished. Failed to upload [installers].");
            assertThat(uploadedPluggableMetadataFiles(publisher.publishedFiles())).containsExactly("cd.go.docker.json");
            assertThat(publisher.getMessage()).contains("[go] Interaction with plugin `cd.go.s3` failed");
    }