Skip to content

Commit 387e388

Browse files
STONEBLD-1578 Store Tekton results on DependencyBuild object
1 parent 4d510fc commit 387e388

File tree

127 files changed

+721
-13919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+721
-13919
lines changed

.github/workflows/go-ci.yaml

-14
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,6 @@ jobs:
6868
run: make test
6969
- name: Codecov
7070
uses: codecov/codecov-action@v3
71-
envtests:
72-
name: Golang envtest integration tests
73-
runs-on: ubuntu-latest
74-
steps:
75-
- name: Check out code
76-
uses: actions/checkout@v3
77-
- name: Install Go
78-
uses: actions/setup-go@v3
79-
with:
80-
go-version-file: ./go.mod
81-
- name: Build
82-
run: make build
83-
- name: Test
84-
run: make e2etest
8571
security_scan:
8672
name: Security scan
8773
runs-on: ubuntu-latest

Makefile

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ vet: ## Run go vet against code.
2424
test: fmt vet ## Run tests.
2525
go test -v ./pkg/... -coverprofile cover.out
2626

27-
e2etest: fmt vet envtest ## Run tests.
28-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -count 1 -v ./test/...
29-
3027
openshift-e2e:
3128
KUBERNETES_CONFIG=${KUBECONFIG} go test -count 1 -tags normal -timeout 120m -v ./openshift-with-appstudio-test/...
3229

deploy/crds/base/jvmbuildservice.io_dependencybuilds.yaml

+122-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,111 @@ spec:
6868
type: object
6969
status:
7070
properties:
71+
buildAttempts:
72+
items:
73+
properties:
74+
build:
75+
properties:
76+
complete:
77+
type: boolean
78+
diagnosticDockerFile:
79+
type: string
80+
pipelineName:
81+
type: string
82+
results:
83+
properties:
84+
gavs:
85+
description: The produced GAVs
86+
items:
87+
type: string
88+
type: array
89+
hermeticBuildImage:
90+
description: The hermetic build image produced by the
91+
build
92+
type: string
93+
image:
94+
description: the image resulting from the run
95+
type: string
96+
imageDigest:
97+
type: string
98+
pipelineResults:
99+
description: The Tekton results
100+
properties:
101+
logs:
102+
type: string
103+
record:
104+
type: string
105+
result:
106+
type: string
107+
type: object
108+
verified:
109+
description: If the resulting image was verified
110+
type: boolean
111+
required:
112+
- imageDigest
113+
type: object
114+
succeeded:
115+
type: boolean
116+
required:
117+
- complete
118+
- pipelineName
119+
type: object
120+
buildRecipe:
121+
properties:
122+
additionalDownloads:
123+
items:
124+
properties:
125+
binaryPath:
126+
type: string
127+
fileName:
128+
type: string
129+
packageName:
130+
type: string
131+
sha256:
132+
type: string
133+
type:
134+
type: string
135+
uri:
136+
type: string
137+
required:
138+
- type
139+
type: object
140+
type: array
141+
additionalMemory:
142+
type: integer
143+
allowedDifferences:
144+
items:
145+
type: string
146+
type: array
147+
commandLine:
148+
items:
149+
type: string
150+
type: array
151+
disableSubmodules:
152+
type: boolean
153+
enforceVersion:
154+
type: string
155+
image:
156+
type: string
157+
javaVersion:
158+
type: string
159+
pipeline:
160+
type: string
161+
postBuildScript:
162+
type: string
163+
preBuildScript:
164+
type: string
165+
repositories:
166+
items:
167+
type: string
168+
type: array
169+
tool:
170+
type: string
171+
toolVersion:
172+
type: string
173+
type: object
174+
type: object
175+
type: array
71176
commitTime:
72177
format: int64
73178
type: integer
@@ -158,7 +263,7 @@ spec:
158263
type: array
159264
currentBuildRecipe:
160265
description: BuildRecipe the current build recipe. If build is done
161-
then this recipe was used to get to the current state
266+
then this recipe was used to get to the current state Deprecated
162267
properties:
163268
additionalDownloads:
164269
items:
@@ -217,12 +322,25 @@ spec:
217322
type: string
218323
type: array
219324
diagnosticDockerFiles:
325+
description: Deprecated
220326
items:
221327
type: string
222328
type: array
329+
discoveryPipelineResults:
330+
description: A representation of the Tekton Results records for a
331+
pipeline
332+
properties:
333+
logs:
334+
type: string
335+
record:
336+
type: string
337+
result:
338+
type: string
339+
type: object
223340
failedBuildRecipes:
224341
description: FailedBuildRecipes recipes that resulted in a failure
225342
if the current state is failed this may include the current BuildRecipe
343+
Deprecated
226344
items:
227345
properties:
228346
additionalDownloads:
@@ -280,7 +398,10 @@ spec:
280398
type: array
281399
failedVerification:
282400
type: boolean
401+
hermetic:
402+
type: boolean
283403
lastCompletedBuildPipelineRun:
404+
description: Deprecated
284405
type: string
285406
message:
286407
type: string

go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ go 1.19
44

55
require (
66
github.com/go-logr/logr v1.2.4
7-
github.com/onsi/ginkgo v1.16.5
87
github.com/onsi/gomega v1.27.8
9-
github.com/openshift/api v0.0.0-20220912161038-458ad9ca9ca5
8+
github.com/openshift/api v0.0.0-20220912161038-458ad9ca9ca5 // indirect
109
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142
1110
github.com/prometheus/client_golang v1.16.0
1211
github.com/prometheus/client_model v0.4.0
@@ -75,7 +74,6 @@ require (
7574
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7675
github.com/modern-go/reflect2 v1.0.2 // indirect
7776
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
78-
github.com/nxadm/tail v1.4.8 // indirect
7977
github.com/opencontainers/go-digest v1.0.0 // indirect
8078
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
8179
github.com/pkg/errors v0.9.1 // indirect
@@ -108,7 +106,6 @@ require (
108106
google.golang.org/grpc v1.55.0 // indirect
109107
google.golang.org/protobuf v1.31.0 // indirect
110108
gopkg.in/inf.v0 v0.9.1 // indirect
111-
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
112109
gopkg.in/yaml.v2 v2.4.0 // indirect
113110
gopkg.in/yaml.v3 v3.0.1 // indirect
114111
gotest.tools/v3 v3.1.0 // indirect

go.sum

-7
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/
195195
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
196196
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
197197
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
198-
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
199198
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
200199
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
201200
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -402,15 +401,12 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW
402401
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
403402
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
404403
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
405-
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
406-
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
407404
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
408405
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
409406
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
410407
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
411408
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
412409
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
413-
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
414410
github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss=
415411
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
416412
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -743,7 +739,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
743739
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
744740
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
745741
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
746-
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
747742
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
748743
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
749744
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -839,7 +834,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u
839834
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
840835
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
841836
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
842-
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
843837
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
844838
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
845839
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
@@ -988,7 +982,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
988982
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
989983
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
990984
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
991-
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
992985
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
993986
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
994987
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

java-components/cli/src/main/java/io/github/redhatappstudio/jvmbuild/cli/builds/BuildDiagnosticCommand.java

+6-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.io.IOException;
55
import java.nio.file.Files;
66
import java.nio.file.Paths;
7-
import java.util.List;
87
import java.util.Map;
98

109
import com.redhat.hacbs.resources.model.v1alpha1.ArtifactBuild;
@@ -75,25 +74,17 @@ public void run() {
7574
"Selected build: " + theBuild.getMetadata().getName() + " of " + theBuild.getSpec().getScm().getScmURL() + ':' +
7675
theBuild.getSpec().getVersion() + '\n');
7776

78-
List<String> dockerFiles = theBuild.getStatus().getDiagnosticDockerFiles();
79-
int failed = (theBuild.getStatus().getFailedBuildRecipes() == null ? 0
80-
: theBuild.getStatus().getFailedBuildRecipes().size());
81-
int succeedMarker = dockerFiles.size() == failed ? -1 : dockerFiles.size() - 1;
77+
var builds = theBuild.getStatus().getBuildAttempts();
8278
try {
83-
for (int i = 0; i < dockerFiles.size(); i++) {
79+
for (var i : builds) {
8480
String fileName;
8581
String javaVersion;
8682
String tagName;
87-
if (i == succeedMarker) {
88-
javaVersion = theBuild.getStatus()
89-
.getCurrentBuildRecipe()
90-
.getJavaVersion();
83+
if (Boolean.TRUE.equals(i.getBuild().getSucceeded())) {
84+
javaVersion = i.getBuildRecipe().getJavaVersion();
9185
tagName = name + ".succeed.jdk" + javaVersion;
9286
} else {
93-
javaVersion = theBuild.getStatus()
94-
.getFailedBuildRecipes()
95-
.get(i)
96-
.getJavaVersion();
87+
javaVersion = i.getBuildRecipe().getJavaVersion();
9788
tagName = name + ".failed.jdk" + javaVersion;
9889
}
9990
fileName = "Dockerfile." + tagName;
@@ -108,7 +99,7 @@ public void run() {
10899
podman run -it %s|@
109100
""".formatted(javaVersion, fileName, tagName, tagName)));
110101
Files.writeString(Paths.get(targetDirectory.toString(), fileName),
111-
dockerFiles.get(i));
102+
i.getBuild().getDiagnosticDockerFile());
112103
}
113104
} catch (IOException e) {
114105
throw new RuntimeException("Failed to write Dockerfile", e);

0 commit comments

Comments
 (0)