Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/minikube-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ while ! oc get pods -n tekton-pipelines | grep tekton-pipelines-webhook | grep "
done
#we need to make sure the tekton webhook has its rules installed
kubectl wait --for=jsonpath='{.webhooks[0].rules}' --timeout=300s mutatingwebhookconfigurations.admissionregistration.k8s.io webhook.pipeline.tekton.dev
kubectl patch cm feature-flags -n tekton-pipelines -p '{"data":{"enable-api-fields":"alpha"}}'
echo -e "\033[0;32mTekton controller is running\033[0m"

#CRDS are sometimes racey
Expand Down
1 change: 1 addition & 0 deletions deploy/openshift-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ oc apply -f ${DIR}/base/pipelines/openshift-pipelines-subscription.yaml
waitFor "oc get ns openshift-pipelines"
waitFor "oc get pods -n openshift-pipelines | grep tekton-pipelines-controller | grep Running"
waitFor "oc get mutatingwebhookconfigurations.admissionregistration.k8s.io webhook.pipeline.tekton.dev -o yaml | grep rules"
oc patch tektonconfigs.operator.tekton.dev config --type=merge -p '{"spec":{"pipeline":{"enable-api-fields":"alpha"}}}'
echo "Tekton controller is running"

oc create ns jvm-build-service || true
Expand Down
2 changes: 2 additions & 0 deletions deploy/openshift-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fi
DIR=`dirname $0`
$DIR/base-development.sh $1

kubectl patch tektonconfigs.operator.tekton.dev config --type=merge -p '{"spec":{"pipeline":{"enable-api-fields":"alpha"}}}'

if [ "$deploy_maven_repo" = true ]; then
export REPOSILITE_IMAGE=$(sed -n 's/^FROM //p' $DIR/../openshift-with-appstudio-test/e2e/Dockerfile.reposilite)
kubectl delete -f $DIR/maven-repo.yaml --ignore-not-found
Expand Down
11 changes: 0 additions & 11 deletions deploy/tasks/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ spec:
hours, days, and weeks, respectively.
type: string
default: ""
- name: CACHE_URL
type: string
description: For JBS, URL of the cache.
default: ""
- name: PREFETCH_INPUT
description: In case it is not empty, the prefetched content should
be made available to the build.
Expand Down Expand Up @@ -245,8 +241,6 @@ spec:
env:
- name: COMMIT_SHA
value: $(params.COMMIT_SHA)
- name: CACHE_URL
value: $(params.CACHE_URL)
script: |
#!/bin/bash
set -e
Expand Down Expand Up @@ -398,11 +392,6 @@ spec:
done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;)
fi
# TODO: Rename to JBS_CACHE_URL?
if [ -n "$CACHE_URL" ]; then
BUILDAH_ARGS+=("--build-arg=CACHE_URL=$CACHE_URL")
fi
unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I've removed my original changes, this file is now out of date and either needs deleting or updating again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now removed it in this PR to make things clearer.

$VOLUME_MOUNTS \
"${BUILDAH_ARGS[@]}" \
Expand Down
5 changes: 0 additions & 5 deletions pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const (
ConfigArtifactCacheIOThreadsDefault = "4"
ConfigArtifactCacheWorkerThreadsDefault = "50"
ConfigArtifactCacheStorageDefault = "10Gi"

KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/PODTEMPLATE/deploy/tasks/pre-build.yaml"
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/buildah-oci-ta.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/PODTEMPLATE/deploy/tasks/maven-deployment.yaml"
)

type JBSConfigSpec struct {
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ type SystemConfigList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []SystemConfig `json:"items"`
}

const (
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
)
20 changes: 10 additions & 10 deletions pkg/reconciler/dependencybuild/buildrecipeyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
PreBuildTaskName = "pre-build"
BuildTaskName = "build"
PostBuildTaskName = "post-build"
TagTaskName = "tag"
DeployTaskName = "deploy"
)

//go:embed scripts/maven-build.sh
Expand Down Expand Up @@ -61,7 +61,7 @@ var buildEntryScript string
//go:embed scripts/Dockerfile.build-trusted-artifacts
var buildTrustedArtifacts string

func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcessorImage string, orasOptions string) (*tektonpipeline.PipelineSpec, error) {
func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcessorImage string) (*tektonpipeline.PipelineSpec, error) {
// Original deploy pipeline used to run maven deployment and also tag the images using 'oras tag'
// with the SHA256 encoded sum of the GAVs.
resolver := tektonpipeline.ResolverRef{
Expand All @@ -81,7 +81,7 @@ func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcess
Params: []tektonpipeline.ParamSpec{{Name: PipelineResultImageDigest, Type: tektonpipeline.ParamTypeString}},
Tasks: []tektonpipeline.PipelineTask{
{
Name: TagTaskName,
Name: DeployTaskName,
TaskRef: &tektonpipeline.TaskRef{
// Can't specify name and resolver as they clash.
ResolverRef: resolver,
Expand Down Expand Up @@ -527,13 +527,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
StringVal: tlsVerify,
},
},
//{
// Name: "BUILD_ARGS",
// Value: tektonpipeline.ParamValue{
// Type: tektonpipeline.ParamTypeArray,
// ArrayVal: []string{"CACHE_URL=" + cacheUrl},
// },
//},
{
Name: "BUILD_ARGS",
Value: tektonpipeline.ParamValue{
Type: tektonpipeline.ParamTypeArray,
ArrayVal: []string{"CACHE_URL=" + cacheUrl},
},
},
},

// TODO: ### How to pass build-settings/tls information to buildah task?
Expand Down
25 changes: 24 additions & 1 deletion pkg/reconciler/dependencybuild/dependencybuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
},
}},
}
// TODO: ### Enclose this within an annotation to denote test CI system in use?
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
PodTemplate: &pod.Template{
Env: []v1.EnvVar{
Expand All @@ -646,6 +647,17 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
},
},
}
// TODO: ### Enclose this within an annotation to denote test CI system in use?
Copy link
Collaborator Author

@rnc rnc Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really we only need to limit the task resources on CI due to the fact that minikube and the e2e can't allocate the CPU/memory that the buildah-oci-ta task specifies by default. I think I could create another annotation to represent the CI tests being used in order to wrap this block...
( I guess I could do it in this PR ... ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest commit has wrapped them in a new annotation.

podMemR, _ := resource.ParseQuantity("1792Mi")
podMemL, _ := resource.ParseQuantity("3584Mi")
podCPU, _ := resource.ParseQuantity("500m")
pr.Spec.TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec{{
PipelineTaskName: BuildTaskName,
ComputeResources: &v1.ResourceRequirements{
Requests: v1.ResourceList{"memory": podMemR, "cpu": podCPU},
Limits: v1.ResourceList{"memory": podMemL, "cpu": podCPU},
},
}}

if !jbsConfig.Spec.CacheSettings.DisableTLS {
pr.Spec.Workspaces = append(pr.Spec.Workspaces, tektonpipeline.WorkspaceBinding{Name: "tls", ConfigMap: &v1.ConfigMapVolumeSource{LocalObjectReference: v1.LocalObjectReference{Name: v1alpha1.TlsConfigMapName}}})
Expand Down Expand Up @@ -1424,7 +1436,7 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
Pipeline: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
Tasks: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout},
}
pr.Spec.PipelineSpec, err = createDeployPipelineSpec(jbsConfig, buildRequestProcessorImage, orasOptions)
pr.Spec.PipelineSpec, err = createDeployPipelineSpec(jbsConfig, buildRequestProcessorImage)
if err != nil {
return reconcile.Result{}, err
}
Expand All @@ -1438,6 +1450,7 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
pr.Spec.Workspaces = append(pr.Spec.Workspaces, tektonpipeline.WorkspaceBinding{Name: "tls", EmptyDir: &v1.EmptyDirVolumeSource{}})
}
pr.Spec.Timeouts = &tektonpipeline.TimeoutFields{Pipeline: &v12.Duration{Duration: time.Hour * v1alpha1.DefaultTimeout}}
// TODO: ### Enclose this within an annotation to denote test CI system in use? Could inline orasOptions then as well?
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
PodTemplate: &pod.Template{
Env: []v1.EnvVar{
Expand All @@ -1448,6 +1461,16 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
},
},
}
// TODO: ### Enclose this within an annotation to denote test CI system in use?
podMem, _ := resource.ParseQuantity("1024Mi")
podCPU, _ := resource.ParseQuantity("250m")
pr.Spec.TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec{{
PipelineTaskName: DeployTaskName,
ComputeResources: &v1.ResourceRequirements{
Requests: v1.ResourceList{"memory": podMem, "cpu": podCPU},
Limits: v1.ResourceList{"memory": podMem, "cpu": podCPU},
},
}}

if err := controllerutil.SetOwnerReference(db, &pr, r.scheme); err != nil {
return reconcile.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/jbsconfig/jbsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

const (
TlsServiceName = v1alpha1.CacheDeploymentName + "-tls"
TestRegistry = "jvmbuildservice.io/test-registry"
TestRegistry = "jvmbuildservice.io/test-registry" // Denote using an insecure registry in GitHub Actions
RetryTimeAnnotations = "jvmbuildservice.io/retry-time"
RetryTimestampAnnotations = "jvmbuildservice.io/retry-timestamp"
)
Expand Down