Skip to content

Commit 45cfdaf

Browse files
committed
Remove non-container build support
1 parent aac3799 commit 45cfdaf

File tree

14 files changed

+79
-216
lines changed

14 files changed

+79
-216
lines changed

README.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ The following environment variables are configurable and may be set by the user
3434
| GIT_DEPLOY_TOKEN | Authentication token
3535
| GIT_DEPLOY_URL | The URL for the Git service (GitHub/GitLab are supported) to archive the sources
3636
| GIT_DISABLE_SSL_VERIFICATION | Whether to disable SSL verification for Git archival service communication
37-
| JBS_CONTAINER_BUILD | Use Konflux tasks to build using containers (default: `true`)
3837
| JBS_QUAY_IMAGE_CONTROLLER | The name for the operator image repository. Defaults to `hacbs-jvm-controller`.
3938
| JBS_QUAY_IMAGE_TAG | The tag for the images (defaults to `dev`)
4039
| JBS_QUAY_ORG | JBS images are pulled by default from the `QUAY_USERNAME` organization. This may be overridden by changing this

deploy/base-development.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ fi
3333
if [ -z "$JBS_S3_SYNC_ENABLED" ]; then
3434
export JBS_S3_SYNC_ENABLED=false
3535
fi
36-
if [ -z "$JBS_CONTAINER_BUILDS" ]; then
37-
export JBS_CONTAINER_BUILDS=true
38-
fi
3936
if [ -z "$JBS_MAX_MEMORY" ]; then
4037
export JBS_MAX_MEMORY=4096
4138
fi
@@ -81,7 +78,6 @@ ${GIT_DEPLOY_TOKEN}
8178
${GIT_DEPLOY_URL}
8279
${GIT_DISABLE_SSL_VERIFICATION}
8380
${JBS_BUILD_IMAGE_SECRET}
84-
${JBS_CONTAINER_BUILDS}
8581
${JBS_GIT_CREDENTIALS}
8682
${JBS_QUAY_IMAGE_CONTROLLER}
8783
${JBS_QUAY_IMAGE_TAG}

deploy/base/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: jvm-build-config
66
spec:
77
enableRebuilds: true
8-
containerBuilds: ${JBS_CONTAINER_BUILDS}
98
mavenBaseLocations:
109
maven-repository-300-jboss: "https://repository.jboss.org/nexus/content/groups/public/"
1110
maven-repository-301-confluent: "https://packages.confluent.io/maven"

deploy/crds/base/jvmbuildservice.io_jbsconfigs.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ spec:
9292
workerThreads:
9393
type: string
9494
type: object
95-
containerBuilds:
96-
description: Whether to use a standard build pipeline or build in
97-
a Docker container via buildah.
98-
type: boolean
9995
enableRebuilds:
10096
type: boolean
10197
gitSourceArchive:

java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_jbsconfigs.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ spec:
9292
workerThreads:
9393
type: string
9494
type: object
95-
containerBuilds:
96-
description: Whether to use a standard build pipeline or build in
97-
a Docker container via buildah.
98-
type: boolean
9995
enableRebuilds:
10096
type: boolean
10197
gitSourceArchive:

openshift-with-appstudio-test/e2e/util.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ func setupConfig(t *testing.T, namespace string) *testArgs {
295295
Name: v1alpha1.JBSConfigName,
296296
},
297297
Spec: v1alpha1.JBSConfigSpec{
298-
EnableRebuilds: true,
299-
ContainerBuilds: true,
298+
EnableRebuilds: true,
300299
MavenBaseLocations: map[string]string{
301300
"maven-repository-300-jboss": "https://repository.jboss.org/nexus/content/groups/public/",
302301
"maven-repository-301-confluent": "https://packages.confluent.io/maven",
@@ -1070,7 +1069,6 @@ func setupMinikube(t *testing.T, namespace string) *testArgs {
10701069
},
10711070
Spec: v1alpha1.JBSConfigSpec{
10721071
EnableRebuilds: true,
1073-
ContainerBuilds: true,
10741072
AdditionalRecipes: []string{"https://github.com/jvm-build-service-test-data/recipe-repo"},
10751073
BuildSettings: v1alpha1.BuildSettings{
10761074
BuildRequestMemory: "512Mi",

pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ type JBSConfigSpec struct {
5454
GitSourceArchive GitSourceArchive `json:"gitSourceArchive,omitempty"`
5555
CacheSettings CacheSettings `json:"cacheSettings,omitempty"`
5656
BuildSettings BuildSettings `json:"buildSettings,omitempty"`
57-
58-
// Whether to use a standard build pipeline or build in a Docker container via buildah.
59-
ContainerBuilds bool `json:"containerBuilds,omitempty"`
6057
}
6158

6259
type ImageRegistrySpec struct {

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 58 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
333333
return nil, "", "", "", err
334334
}
335335

336-
createBuildScript := createBuildScript(build)
337336
pipelineParams := []tektonpipeline.ParamSpec{
338337
{Name: PipelineBuildId, Type: tektonpipeline.ParamTypeString},
339338
{Name: PipelineParamScmUrl, Type: tektonpipeline.ParamTypeString},
@@ -383,7 +382,7 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
383382
Requests: v1.ResourceList{"memory": limits.defaultRequestMemory, "cpu": limits.defaultRequestCPU},
384383
Limits: v1.ResourceList{"memory": limits.defaultRequestMemory, "cpu": limits.defaultLimitCPU},
385384
},
386-
Script: gitScript + "\n" + createBuildScript,
385+
Script: gitScript,
387386
Env: []v1.EnvVar{
388387
{Name: PipelineParamCacheUrl, Value: "$(params." + PipelineParamCacheUrl + ")"},
389388
{Name: "GIT_TOKEN", ValueFrom: &v1.EnvVarSource{SecretKeyRef: &v1.SecretKeySelector{LocalObjectReference: v1.LocalObjectReference{Name: v1alpha1.GitSecretName}, Key: v1alpha1.GitSecretTokenKey, Optional: &trueBool}}},
@@ -447,172 +446,80 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
447446
}
448447
}
449448

450-
if jbsConfig.Spec.ContainerBuilds {
451-
// Note - its also possible to refer to a remote pipeline ref as well as a task.
452-
resolver := tektonpipeline.ResolverRef{
453-
// We can use either a http or git resolver. Using http as avoids cloning an entire repository.
454-
Resolver: "http",
455-
Params: []tektonpipeline.Param{
456-
{
457-
Name: "url",
458-
Value: tektonpipeline.ParamValue{
459-
Type: tektonpipeline.ParamTypeString,
460-
StringVal: v1alpha1.KonfluxBuildDefinitions,
461-
},
462-
},
463-
},
464-
}
465-
466-
ps.Tasks = append([]tektonpipeline.PipelineTask{
449+
// Note - its also possible to refer to a remote pipeline ref as well as a task.
450+
resolver := tektonpipeline.ResolverRef{
451+
// We can use either a http or git resolver. Using http as avoids cloning an entire repository.
452+
Resolver: "http",
453+
Params: []tektonpipeline.Param{
467454
{
468-
Name: BuildTaskName,
469-
RunAfter: runAfter,
470-
TaskRef: &tektonpipeline.TaskRef{
471-
// Can't specify name and resolver as they clash.
472-
ResolverRef: resolver,
473-
},
474-
Timeout: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
475-
Params: []tektonpipeline.Param{
476-
{
477-
Name: "DOCKERFILE",
478-
Value: tektonpipeline.ParamValue{
479-
Type: tektonpipeline.ParamTypeString,
480-
StringVal: ".jbs/Containerfile"},
481-
},
482-
{
483-
Name: "IMAGE",
484-
Value: tektonpipeline.ParamValue{
485-
Type: tektonpipeline.ParamTypeString,
486-
StringVal: registryArgsWithDefaults(jbsConfig, buildId)},
487-
},
488-
{
489-
Name: "SOURCE_ARTIFACT",
490-
Value: tektonpipeline.ParamValue{
491-
Type: tektonpipeline.ParamTypeString,
492-
StringVal: preBuildImage,
493-
},
494-
},
495-
{
496-
Name: "ORAS_OPTIONS",
497-
Value: tektonpipeline.ParamValue{
498-
Type: tektonpipeline.ParamTypeString,
499-
StringVal: orasOptions,
500-
},
501-
},
502-
{
503-
Name: "TLSVERIFY",
504-
Value: tektonpipeline.ParamValue{
505-
Type: tektonpipeline.ParamTypeString,
506-
StringVal: tlsVerify,
507-
},
508-
},
455+
Name: "url",
456+
Value: tektonpipeline.ParamValue{
457+
Type: tektonpipeline.ParamTypeString,
458+
StringVal: v1alpha1.KonfluxBuildDefinitions,
509459
},
460+
},
461+
},
462+
}
510463

511-
// TODO: ### How to pass build-settings/tls information to buildah task?
512-
// Note - buildah-oci-ta task has no defined workspace
513-
//Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{
514-
// //{Name: WorkspaceBuildSettings, Workspace: WorkspaceBuildSettings},
515-
// {Name: WorkspaceSource, Workspace: WorkspaceSource},
516-
// //{Name: WorkspaceTls, Workspace: WorkspaceTls},
517-
//},
518-
}}, ps.Tasks...)
519-
520-
// Results for https://github.com/konflux-ci/build-definitions/tree/main/task/buildah-oci-ta/0.2
521-
// IMAGE_DIGEST
522-
// IMAGE_URL
523-
ps.Results = append(ps.Results, tektonpipeline.PipelineResult{Name: PipelineResultImage, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: "$(tasks." + BuildTaskName + ".results." + PipelineResultImage + ")"}})
524-
ps.Results = append(ps.Results, tektonpipeline.PipelineResult{Name: PipelineResultImageDigest, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: "$(tasks." + BuildTaskName + ".results." + PipelineResultImageDigest + ")"}})
525-
} else {
526-
buildTask := tektonpipeline.TaskSpec{
527-
Workspaces: []tektonpipeline.WorkspaceDeclaration{{Name: WorkspaceBuildSettings}, {Name: WorkspaceSource, MountPath: WorkspaceMount}, {Name: WorkspaceTls}},
528-
Params: append(pipelineParams, tektonpipeline.ParamSpec{Name: PipelineResultPreBuildImageDigest, Type: tektonpipeline.ParamTypeString}),
529-
Results: []tektonpipeline.TaskResult{
530-
{Name: PipelineResultImage},
531-
{Name: PipelineResultImageDigest},
464+
ps.Tasks = append([]tektonpipeline.PipelineTask{
465+
{
466+
Name: BuildTaskName,
467+
RunAfter: runAfter,
468+
TaskRef: &tektonpipeline.TaskRef{
469+
// Can't specify name and resolver as they clash.
470+
ResolverRef: resolver,
532471
},
533-
Steps: []tektonpipeline.Step{
472+
Timeout: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
473+
Params: []tektonpipeline.Param{
534474
{
535-
Name: "restore-pre-build-source",
536-
Image: strings.TrimSpace(strings.Split(buildTrustedArtifacts, "FROM")[1]),
537-
ImagePullPolicy: v1.PullIfNotPresent,
538-
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
539-
Env: secretVariables,
540-
Script: fmt.Sprintf(`echo "Restoring source to workspace : $(workspaces.source.path)"
541-
export ORAS_OPTIONS="%s"
542-
use-archive $(params.%s)=$(workspaces.source.path)/source
543-
mv $(workspaces.source.path)/source/.jbs/build.sh $(workspaces.source.path)`, orasOptions, PipelineResultPreBuildImageDigest),
475+
Name: "DOCKERFILE",
476+
Value: tektonpipeline.ParamValue{
477+
Type: tektonpipeline.ParamTypeString,
478+
StringVal: ".jbs/Containerfile"},
544479
},
545480
{
546-
Timeout: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
547-
Name: "build",
548-
Image: recipe.Image,
549-
ImagePullPolicy: pullPolicy,
550-
WorkingDir: "$(workspaces." + WorkspaceSource + ".path)/source",
551-
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
552-
Env: append(toolEnv, v1.EnvVar{Name: PipelineParamCacheUrl, Value: "$(params." + PipelineParamCacheUrl + ")"}),
553-
ComputeResources: v1.ResourceRequirements{
554-
Requests: v1.ResourceList{"memory": limits.buildRequestMemory, "cpu": limits.buildRequestCPU},
555-
Limits: v1.ResourceList{"memory": limits.buildRequestMemory, "cpu": limits.buildLimitCPU},
556-
},
557-
Args: []string{"$(params.GOALS[*])"},
558-
Script: "$(workspaces." + WorkspaceSource + ".path)/build.sh \"$@\"",
481+
Name: "IMAGE",
482+
Value: tektonpipeline.ParamValue{
483+
Type: tektonpipeline.ParamTypeString,
484+
StringVal: registryArgsWithDefaults(jbsConfig, buildId)},
559485
},
560486
{
561-
Name: "deploy-ant-artifacts",
562-
Image: buildRequestProcessorImage,
563-
ImagePullPolicy: pullPolicy,
564-
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
565-
Env: secretVariables,
566-
ComputeResources: v1.ResourceRequirements{
567-
Requests: v1.ResourceList{"memory": limits.defaultBuildRequestMemory, "cpu": limits.defaultRequestCPU},
568-
Limits: v1.ResourceList{"memory": limits.defaultBuildRequestMemory, "cpu": limits.defaultLimitCPU},
487+
Name: "SOURCE_ARTIFACT",
488+
Value: tektonpipeline.ParamValue{
489+
Type: tektonpipeline.ParamTypeString,
490+
StringVal: preBuildImage,
569491
},
570-
Script: artifactbuild.InstallKeystoreIntoBuildRequestProcessor(copyArtifactsArgs),
571492
},
572-
// Store post-build artifacts here using oras to match container build
573493
{
574-
Name: "store-post-build-artifacts",
575-
Image: strings.TrimSpace(strings.Split(buildTrustedArtifacts, "FROM")[1]),
576-
ImagePullPolicy: v1.PullIfNotPresent,
577-
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
578-
Env: secretVariables,
579-
Script: fmt.Sprintf(`echo "Creating post-build-image archive"
580-
export ORAS_OPTIONS="%s --image-spec=v1.0 --artifact-type application/vnd.oci.image.config.v1+json --no-tty --format=json"
581-
IMGURL=%s
582-
create-archive --store $IMGURL /tmp/artifacts=$(workspaces.source.path)/artifacts | tee /tmp/oras-create.json
583-
IMGDIGEST=$(cat /tmp/oras-create.json | grep -Ev '(Prepared artifact|Artifacts created)' | jq -r '.digest')
584-
echo "Storing IMGURL $IMGURL and IMGDIGEST $IMGDIGEST"
585-
echo -n "$IMGURL" >> $(results.%s.path)
586-
echo -n "$IMGDIGEST" >> $(results.%s.path)
587-
`, orasOptions, registryArgsWithDefaults(jbsConfig, buildId+"-artifacts"), PipelineResultImage, PipelineResultImageDigest),
494+
Name: "ORAS_OPTIONS",
495+
Value: tektonpipeline.ParamValue{
496+
Type: tektonpipeline.ParamTypeString,
497+
StringVal: orasOptions,
498+
},
588499
},
589-
}}
590-
591-
pipelineTask := []tektonpipeline.PipelineTask{{
592-
Name: BuildTaskName,
593-
RunAfter: runAfter,
594-
TaskSpec: &tektonpipeline.EmbeddedTask{
595-
TaskSpec: buildTask,
596-
},
597-
Timeout: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
598-
Params: []tektonpipeline.Param{
599500
{
600-
Name: PipelineResultPreBuildImageDigest,
601-
Value: tektonpipeline.ParamValue{Type: tektonpipeline.ParamTypeString, StringVal: preBuildImage},
501+
Name: "TLSVERIFY",
502+
Value: tektonpipeline.ParamValue{
503+
Type: tektonpipeline.ParamTypeString,
504+
StringVal: tlsVerify,
505+
},
602506
},
603507
},
604-
Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{
605-
{Name: WorkspaceBuildSettings, Workspace: WorkspaceBuildSettings},
606-
{Name: WorkspaceSource, Workspace: WorkspaceSource},
607-
{Name: WorkspaceTls, Workspace: WorkspaceTls},
608-
},
609-
}}
610-
ps.Tasks = append(pipelineTask, ps.Tasks...)
611508

612-
for _, i := range buildTask.Results {
613-
ps.Results = append(ps.Results, tektonpipeline.PipelineResult{Name: i.Name, Description: i.Description, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: "$(tasks." + BuildTaskName + ".results." + i.Name + ")"}})
614-
}
615-
}
509+
// TODO: ### How to pass build-settings/tls information to buildah task?
510+
// Note - buildah-oci-ta task has no defined workspace
511+
//Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{
512+
// //{Name: WorkspaceBuildSettings, Workspace: WorkspaceBuildSettings},
513+
// {Name: WorkspaceSource, Workspace: WorkspaceSource},
514+
// //{Name: WorkspaceTls, Workspace: WorkspaceTls},
515+
//},
516+
}}, ps.Tasks...)
517+
518+
// Results for https://github.com/konflux-ci/build-definitions/tree/main/task/buildah-oci-ta/0.2
519+
// IMAGE_DIGEST
520+
// IMAGE_URL
521+
ps.Results = append(ps.Results, tektonpipeline.PipelineResult{Name: PipelineResultImage, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: "$(tasks." + BuildTaskName + ".results." + PipelineResultImage + ")"}})
522+
ps.Results = append(ps.Results, tektonpipeline.PipelineResult{Name: PipelineResultImageDigest, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: "$(tasks." + BuildTaskName + ".results." + PipelineResultImageDigest + ")"}})
616523

617524
postBuildTask := tektonpipeline.TaskSpec{
618525
Workspaces: []tektonpipeline.WorkspaceDeclaration{{Name: WorkspaceBuildSettings}, {Name: WorkspaceSource, MountPath: WorkspaceMount}, {Name: WorkspaceTls}},
@@ -724,14 +631,6 @@ func secretVariables(jbsConfig *v1alpha1.JBSConfig) []v1.EnvVar {
724631
return secretVariables
725632
}
726633

727-
func createBuildScript(build string) string {
728-
ret := "tee $(workspaces." + WorkspaceSource + ".path)/build.sh <<'RHTAPEOF'\n"
729-
ret += build
730-
ret += "\nRHTAPEOF\n"
731-
ret += "chmod +x $(workspaces." + WorkspaceSource + ".path)/build.sh\n"
732-
return ret
733-
}
734-
735634
func createKonfluxScripts(containerfile string, konfluxScript string) string {
736635
ret := "mkdir -p $(workspaces." + WorkspaceSource + ".path)/source/.jbs\n"
737636
ret += "tee $(workspaces." + WorkspaceSource + ".path)/source/.jbs/Containerfile <<'RHTAPEOF'\n"
@@ -858,7 +757,6 @@ func pipelineBuildCommands(imageId string, db *v1alpha1.DependencyBuild, jbsConf
858757
// Setting ORAS_OPTIONS to ensure the archive is compatible with jib (for OCIRepositoryClient).
859758
preBuildImageArgs := fmt.Sprintf(`echo "Creating pre-build-image archive"
860759
export ORAS_OPTIONS="%s --image-spec=v1.0 --artifact-type application/vnd.oci.image.config.v1+json"
861-
cp $(workspaces.source.path)/build.sh $(workspaces.source.path)/source/.jbs
862760
create-archive --store %s $(results.%s.path)=$(workspaces.source.path)/source
863761
`, orasOptions, registryArgsWithDefaults(jbsConfig, preBuildImageTag), PipelineResultPreBuildImageDigest)
864762

@@ -877,9 +775,6 @@ create-archive --store %s $(results.%s.path)=$(workspaces.source.path)/source
877775
"--scm-uri=" + db.Spec.ScmInfo.SCMURL,
878776
"--scm-commit=" + db.Spec.ScmInfo.CommitHash,
879777
}
880-
if !jbsConfig.Spec.ContainerBuilds {
881-
deployArgs = append(deployArgs, "--build-info-path=$(workspaces.source.path)/build-info")
882-
}
883778

884779
konfluxArgs := []string{
885780
"deploy-pre-build-source",

0 commit comments

Comments
 (0)