Skip to content

Commit bb0ad7d

Browse files
authored
Merge pull request #2340 from ruhan1/main-uploadlog
Upload build log to Bifrost
2 parents 600a81d + 3e1dc84 commit bb0ad7d

File tree

5 files changed

+63
-13
lines changed

5 files changed

+63
-13
lines changed

deploy/pipeline/mw-pipeline-v0.1.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ spec:
7272
- name: NOTIFICATION_CONTEXT
7373
type: string
7474
default: ""
75+
- name: BIFROST_URL
76+
type: string
77+
default: ""
7578
workspaces:
7679
- name: source
7780
description: Workspace containing the source code
@@ -195,7 +198,7 @@ spec:
195198
- name: url
196199
value: https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/refs/heads/main/deploy/tasks/buildah-oci-ta.yaml
197200

198-
- name: maven-deployment
201+
- name: push-results
199202
runAfter:
200203
- buildah-oci-ta
201204
params:
@@ -209,11 +212,15 @@ spec:
209212
value: $(params.MVN_REPO_DEPLOY_URL)
210213
- name: ACCESS_TOKEN
211214
value: $(params.ACCESS_TOKEN)
215+
- name: BUILD_ID
216+
value: $(params.BUILD_ID)
217+
- name: BIFROST_URL
218+
value: $(params.BIFROST_URL)
212219
taskRef:
213220
resolver: http
214221
params:
215222
- name: url
216-
value: https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/refs/heads/main/deploy/tasks/maven-deployment.yaml
223+
value: https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/refs/heads/main/deploy/tasks/push-results.yaml
217224

218225
finally:
219226
- name: notification

deploy/tasks/maven-deployment.yaml renamed to deploy/tasks/push-results.yaml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
build.appstudio.redhat.com/build_type: docker
1212
spec:
1313
description: |-
14-
Takes a OCI archive and deploys the result
14+
Takes a OCI archive and deploys the result and uploads log to Bifrost
1515
params:
1616
- name: IMAGE_URL
1717
description: Reference to the OCI archive
@@ -39,6 +39,13 @@ spec:
3939
description: Access token for OAuth.
4040
type: string
4141
default: ""
42+
- name: BUILD_ID
43+
type: string
44+
default: ""
45+
- name: BIFROST_URL
46+
description: bifrost url to upload log
47+
type: string
48+
default: ""
4249
- name: PNC_KONFLUX_TOOLING_IMAGE
4350
description: Name of the tooling image.
4451
type: string
@@ -80,7 +87,7 @@ spec:
8087
value: $(params.IMAGE_DIGEST)
8188
- name: IMAGE_URL
8289
value: $(params.IMAGE_URL)
83-
- name: deploy
90+
- name: upload-artifacts
8491
image: $(params.PNC_KONFLUX_TOOLING_IMAGE)
8592
securityContext:
8693
runAsUser: 0
@@ -114,3 +121,39 @@ spec:
114121
update-ca-trust
115122
fi
116123
/opt/jboss/container/java/run/run-java.sh $@
124+
- name: upload-log
125+
image: $(params.PNC_KONFLUX_TOOLING_IMAGE)
126+
securityContext:
127+
runAsUser: 0
128+
computeResources:
129+
limits:
130+
cpu: 300m
131+
memory: 512Mi
132+
requests:
133+
cpu: 10m
134+
memory: 512Mi
135+
volumeMounts:
136+
- mountPath: /mnt/trusted-ca
137+
name: trusted-ca
138+
readOnly: true
139+
env:
140+
- name: ACCESS_TOKEN
141+
value: $(params.ACCESS_TOKEN)
142+
args:
143+
- upload-log
144+
- --file=/var/workdir/log/build.log
145+
- --bifrost-url=$(params.BIFROST_URL)
146+
- --process-context=$(params.BUILD_ID)
147+
- --process-context-variant=""
148+
- --tmp=false
149+
- --request-context=""
150+
script: |
151+
#!/bin/bash
152+
set -e
153+
ca_bundle=/mnt/trusted-ca/ca-bundle.crt
154+
if [ -f "$ca_bundle" ]; then
155+
echo "INFO: Using mounted CA bundle: $ca_bundle"
156+
cp -vf $ca_bundle /etc/pki/ca-trust/source/anchors
157+
update-ca-trust
158+
fi
159+
/opt/jboss/container/java/run/run-java.sh $@

pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ const (
5050
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
5151
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build-git.yaml"
5252
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/buildah-oci-ta.yaml"
53-
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
53+
KonfluxDeployDefinitions = "https://raw.githubusercontent.com/ruhan1/jvm-build-service/main-uploadlog/deploy/tasks/push-results.yaml"
5454
)

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
PreBuildGitTaskName = "pre-build-git"
3232
BuildTaskName = "build"
3333
PostBuildTaskName = "post-build"
34-
DeployTaskName = "deploy"
34+
UploadTaskName = "upload-artifacts"
3535

3636
DomainProxyImage = "quay.io/redhat-user-workloads/konflux-jbs-pnc-tenant/domain-proxy:latest"
3737
PNCKonfluxToolingImage = "quay.io/redhat-user-workloads/konflux-jbs-pnc-tenant/konflux-tooling:latest"
@@ -74,7 +74,7 @@ func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcess
7474
Name: "url",
7575
Value: tektonpipeline.ParamValue{
7676
Type: tektonpipeline.ParamTypeString,
77-
StringVal: v1alpha1.KonfluxMavenDeployDefinitions,
77+
StringVal: v1alpha1.KonfluxDeployDefinitions,
7878
},
7979
},
8080
},
@@ -83,7 +83,7 @@ func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcess
8383
Params: []tektonpipeline.ParamSpec{{Name: PipelineResultImageDigest, Type: tektonpipeline.ParamTypeString}},
8484
Tasks: []tektonpipeline.PipelineTask{
8585
{
86-
Name: DeployTaskName,
86+
Name: UploadTaskName,
8787
TaskRef: &tektonpipeline.TaskRef{
8888
// Can't specify name and resolver as they clash.
8989
ResolverRef: resolver,
@@ -723,14 +723,14 @@ use-archive oci:$URL@$AARCHIVE=%s`, orasOptions, registryArgsWithDefaults(jbsCon
723723
Name: "url",
724724
Value: tektonpipeline.ParamValue{
725725
Type: tektonpipeline.ParamTypeString,
726-
StringVal: v1alpha1.KonfluxMavenDeployDefinitions,
726+
StringVal: v1alpha1.KonfluxDeployDefinitions,
727727
},
728728
},
729729
},
730730
}
731731
ps.Tasks = append([]tektonpipeline.PipelineTask{
732732
{
733-
Name: DeployTaskName,
733+
Name: UploadTaskName,
734734
RunAfter: append(runAfterBuild, PostBuildTaskName),
735735
// Don't need to specify WorkspacePipelineTaskBinding as the deploy task is using
736736
// an independent volume.

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
626626

627627
trueBool := true
628628
pr.Spec.TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec{{
629-
PipelineTaskName: DeployTaskName,
629+
PipelineTaskName: UploadTaskName,
630630
PodTemplate: &pod.Template{
631631
Env: []v1.EnvVar{
632632
{
@@ -1452,11 +1452,11 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
14521452
}
14531453
}
14541454
if jbsConfig.Annotations != nil && jbsConfig.Annotations[jbsconfig.CITests] == "true" {
1455-
log.Info(fmt.Sprintf("Configuring resources for %#v", DeployTaskName))
1455+
log.Info(fmt.Sprintf("Configuring resources for %#v", UploadTaskName))
14561456
podMem, _ := resource.ParseQuantity("1024Mi")
14571457
podCPU, _ := resource.ParseQuantity("250m")
14581458
pr.Spec.TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec{{
1459-
PipelineTaskName: DeployTaskName,
1459+
PipelineTaskName: UploadTaskName,
14601460
ComputeResources: &v1.ResourceRequirements{
14611461
Requests: v1.ResourceList{"memory": podMem, "cpu": podCPU},
14621462
Limits: v1.ResourceList{"memory": podMem, "cpu": podCPU},

0 commit comments

Comments
 (0)