|
4 | 4 |
|
5 | 5 | import java.io.IOException;
|
6 | 6 | import java.nio.charset.StandardCharsets;
|
| 7 | +import java.nio.file.Path; |
7 | 8 | import java.util.HashMap;
|
8 | 9 | import java.util.Map;
|
| 10 | +import java.util.Optional; |
9 | 11 |
|
10 | 12 | import jakarta.enterprise.context.RequestScoped;
|
11 | 13 | import jakarta.inject.Inject;
|
12 | 14 |
|
| 15 | +import org.apache.commons.io.FileUtils; |
13 | 16 | import org.apache.commons.io.IOUtils;
|
14 | 17 | import org.apache.commons.text.StringSubstitutor;
|
15 | 18 | import org.eclipse.microprofile.config.ConfigProvider;
|
| 19 | +import org.eclipse.microprofile.config.inject.ConfigProperty; |
16 | 20 | import org.eclipse.microprofile.rest.client.inject.RestClient;
|
17 | 21 | import org.slf4j.Logger;
|
18 | 22 | import org.slf4j.LoggerFactory;
|
@@ -56,6 +60,9 @@ public class Driver {
|
56 | 60 | @Setter
|
57 | 61 | private String processor = "quay.io/redhat-user-workloads-stage/pnc-devel-tenant/pnc";
|
58 | 62 |
|
| 63 | + @ConfigProperty(name = "build-driver.pipeline") |
| 64 | + Optional<String> customPipeline; |
| 65 | + |
59 | 66 | public void create(BuildRequest buildRequest) {
|
60 | 67 | IndyTokenResponseDTO tokenResponseDTO = new IndyTokenResponseDTO(accessToken);
|
61 | 68 |
|
@@ -86,8 +93,12 @@ public void create(BuildRequest buildRequest) {
|
86 | 93 |
|
87 | 94 | String pipeline = "";
|
88 | 95 | try {
|
89 |
| - pipeline = IOUtils.resourceToString("pipeline.yaml", StandardCharsets.UTF_8, |
90 |
| - Thread.currentThread().getContextClassLoader()); |
| 96 | + if (customPipeline.isEmpty()) { |
| 97 | + pipeline = IOUtils.resourceToString("pipeline.yaml", StandardCharsets.UTF_8, |
| 98 | + Thread.currentThread().getContextClassLoader()); |
| 99 | + } else { |
| 100 | + pipeline = FileUtils.readFileToString(Path.of(customPipeline.get()).toFile(), StandardCharsets.UTF_8); |
| 101 | + } |
91 | 102 | } catch (IOException e) {
|
92 | 103 | // TODO: process
|
93 | 104 | }
|
|
0 commit comments