Skip to content

Commit

Permalink
chore: remove references to jvm-build-service
Browse files Browse the repository at this point in the history
- jvm-build-service is currently not being used by anyone
- It is going to undergo major breaking changes and is going to be
  removed for now until the changes are done
- Current tests are probably going to be useless due to the rewrite
  • Loading branch information
tnevrlka committed Dec 19, 2024
1 parent 20c1bfc commit f8af801
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 732 deletions.
84 changes: 0 additions & 84 deletions magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,90 +428,6 @@ func setRequiredEnvVars() error {
envVarPrefix = "INTEGRATION_SERVICE"
imageTagSuffix = "integration-service-image"
testSuiteLabel = "integration-service"
case strings.Contains(jobName, "jvm-build-service"):
envVarPrefix = "JVM_BUILD_SERVICE"
imageTagSuffix = "jvm-build-service-image"
testSuiteLabel = "jvm-build-service"
// Since CI requires to have default values for dependency images
// (https://github.com/openshift/release/blob/master/ci-operator/step-registry/redhat-appstudio/e2e/redhat-appstudio-e2e-ref.yaml#L15)
// we cannot let these env vars to have identical names in CI as those env vars used in tests
// e.g. JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE, otherwise those images they are referencing wouldn't
// be always relevant for tests and tests would be failing
os.Setenv(fmt.Sprintf("%s_REQPROCESSOR_IMAGE", envVarPrefix), os.Getenv("CI_JBS_REQPROCESSOR_IMAGE"))
os.Setenv(fmt.Sprintf("%s_CACHE_IMAGE", envVarPrefix), os.Getenv("CI_JBS_CACHE_IMAGE"))

klog.Infof("going to override default Tekton bundle s2i-java task for the purpose of testing jvm-build-service PR")
var err error
var tektonObj runtime.Object

tag := fmt.Sprintf("%d-%s", time.Now().Unix(), util.GenerateRandomString(4))
quayOrg := utils.GetEnv(constants.DEFAULT_QUAY_ORG_ENV, constants.DefaultQuayOrg)
newS2iJavaTaskImg := strings.ReplaceAll(constants.DefaultImagePushRepo, constants.DefaultQuayOrg, quayOrg)
var newS2iJavaTaskRef, _ = name.ParseReference(fmt.Sprintf("%s:task-bundle-%s", newS2iJavaTaskImg, tag))
newJavaBuilderPipelineImg := strings.ReplaceAll(constants.DefaultImagePushRepo, constants.DefaultQuayOrg, quayOrg)
var newJavaBuilderPipelineRef, _ = name.ParseReference(fmt.Sprintf("%s:pipeline-bundle-%s", newJavaBuilderPipelineImg, tag))
var newReqprocessorImage = os.Getenv("JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE")
var newTaskYaml, newPipelineYaml []byte

if err = utils.CreateDockerConfigFile(os.Getenv("QUAY_TOKEN")); err != nil {
return fmt.Errorf("failed to create docker config file: %+v", err)
}
// Since we do not include java builder in the default pipelines list, it's not possible
// to use GetDefaultPipelineBundleRef and get it from build pipeline config Config Map.
// Fallback to the latest dev version for now.
defaultBundleRef := "quay.io/konflux-ci/tekton-catalog/pipeline-java-builder:devel"
if tektonObj, err = tekton.ExtractTektonObjectFromBundle(defaultBundleRef, "pipeline", "java-builder"); err != nil {
return fmt.Errorf("failed to extract the Tekton Pipeline from bundle: %+v", err)
}
javaPipelineObj := tektonObj.(*tektonapi.Pipeline)

var currentS2iJavaTaskRef string
for _, t := range javaPipelineObj.PipelineSpec().Tasks {
params := t.TaskRef.Params
var lastBundle *tektonapi.Param
s2iTask := false
for i, param := range params {
if param.Name == "bundle" {
lastBundle = &t.TaskRef.Params[i]
} else if param.Name == "name" && param.Value.StringVal == "s2i-java" {
s2iTask = true
}
}
if s2iTask {
currentS2iJavaTaskRef = lastBundle.Value.StringVal
klog.Infof("Found current task ref %s", currentS2iJavaTaskRef)
lastBundle.Value = *tektonapi.NewStructuredValues(newS2iJavaTaskRef.String())
break
}
}
if tektonObj, err = tekton.ExtractTektonObjectFromBundle(currentS2iJavaTaskRef, "task", "s2i-java"); err != nil {
return fmt.Errorf("failed to extract the Tekton Task from bundle: %+v", err)
}
taskObj := tektonObj.(*tektonapi.Task)

for i, s := range taskObj.Spec.Steps {
if s.Name == "analyse-dependencies-java-sbom" {
taskObj.Spec.Steps[i].Image = newReqprocessorImage
}
}

if newTaskYaml, err = yaml.Marshal(taskObj); err != nil {
return fmt.Errorf("error when marshalling a new task to YAML: %v", err)
}
if newPipelineYaml, err = yaml.Marshal(javaPipelineObj); err != nil {
return fmt.Errorf("error when marshalling a new pipeline to YAML: %v", err)
}

keychain := authn.NewMultiKeychain(authn.DefaultKeychain)
authOption := remoteimg.WithAuthFromKeychain(keychain)

if err = tekton.BuildAndPushTektonBundle(newTaskYaml, newS2iJavaTaskRef, authOption); err != nil {
return fmt.Errorf("error when building/pushing a tekton task bundle: %v", err)
}
if err = tekton.BuildAndPushTektonBundle(newPipelineYaml, newJavaBuilderPipelineRef, authOption); err != nil {
return fmt.Errorf("error when building/pushing a tekton pipeline bundle: %v", err)
}
os.Setenv(constants.CUSTOM_JAVA_PIPELINE_BUILD_BUNDLE_ENV, newJavaBuilderPipelineRef.String())
case strings.Contains(jobName, "build-service"):
requiresSprayProxyRegistering = true
envVarPrefix = "BUILD_SERVICE"
Expand Down
2 changes: 1 addition & 1 deletion magefiles/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/magefile/mage/sh"
)

const quayPrefixesToDeleteRegexp = "rhtap[-_]demo|happy-path|multi-platform|ex-registry|gitlab|build-e2e|build-templates|byoc|user1|spi|release-|integration|jvm|stat-rep|nbe|stack|rs[-_]demos|push-pyxis"
const quayPrefixesToDeleteRegexp = "rhtap[-_]demo|happy-path|multi-platform|ex-registry|gitlab|build-e2e|build-templates|byoc|user1|spi|release-|integration|stat-rep|nbe|stack|rs[-_]demos|push-pyxis"

func getRemoteAndBranchNameFromPRLink(url string) (remote, branchName string, err error) {
ghRes := &GithubPRInfo{}
Expand Down
2 changes: 0 additions & 2 deletions pkg/clients/jvmbuildservice/OWNERS

This file was deleted.

18 changes: 0 additions & 18 deletions pkg/clients/jvmbuildservice/artifact_builds.go

This file was deleted.

37 changes: 0 additions & 37 deletions pkg/clients/jvmbuildservice/caches.go

This file was deleted.

15 changes: 0 additions & 15 deletions pkg/clients/jvmbuildservice/controller.go

This file was deleted.

18 changes: 0 additions & 18 deletions pkg/clients/jvmbuildservice/dependency_builds.go

This file was deleted.

70 changes: 0 additions & 70 deletions pkg/clients/jvmbuildservice/jbs_configs.go

This file was deleted.

13 changes: 0 additions & 13 deletions pkg/clients/jvmbuildservice/rebuilt_artifacts.go

This file was deleted.

6 changes: 0 additions & 6 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const (
// Managed workspace for release pipelines tests
RELEASE_MANAGED_WORKSPACE_ENV = "RELEASE_MANAGED_WORKSPACE"

// Bundle ref for overriding the default Java build bundle specified in BuildPipelineConfigConfigMapYamlURL
CUSTOM_JAVA_PIPELINE_BUILD_BUNDLE_ENV string = "CUSTOM_JAVA_PIPELINE_BUILD_BUNDLE"

// Bundle ref for a buildah-remote build
CUSTOM_BUILDAH_REMOTE_PIPELINE_BUILD_BUNDLE_ENV string = "CUSTOM_BUILDAH_REMOTE_PIPELINE_BUILD_BUNDLE"

Expand Down Expand Up @@ -167,9 +164,6 @@ const (
QuayRepositorySecretName = "quay-repository"
QuayRepositorySecretNamespace = "e2e-secrets"

JVMBuildImageSecretName = "jvm-build-image-secrets"
JBSConfigName = "jvm-build-config"

BuildPipelineConfigConfigMapYamlURL = "https://raw.githubusercontent.com/redhat-appstudio/infra-deployments/main/components/build-service/base/build-pipeline-config/build-pipeline-config.yaml"

DefaultImagePushRepo = "quay.io/" + DefaultQuayOrg + "/test-images"
Expand Down
37 changes: 14 additions & 23 deletions pkg/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/konflux-ci/e2e-tests/pkg/clients/has"
"github.com/konflux-ci/e2e-tests/pkg/clients/imagecontroller"
"github.com/konflux-ci/e2e-tests/pkg/clients/integration"
"github.com/konflux-ci/e2e-tests/pkg/clients/jvmbuildservice"
kubeCl "github.com/konflux-ci/e2e-tests/pkg/clients/kubernetes"
"github.com/konflux-ci/e2e-tests/pkg/clients/release"
"github.com/konflux-ci/e2e-tests/pkg/clients/tekton"
Expand All @@ -25,14 +24,13 @@ import (
)

type ControllerHub struct {
HasController *has.HasController
CommonController *common.SuiteController
TektonController *tekton.TektonController
GitOpsController *gitops.GitopsController
ReleaseController *release.ReleaseController
IntegrationController *integration.IntegrationController
JvmbuildserviceController *jvmbuildservice.JvmbuildserviceController
ImageController *imagecontroller.ImageController
HasController *has.HasController
CommonController *common.SuiteController
TektonController *tekton.TektonController
GitOpsController *gitops.GitopsController
ReleaseController *release.ReleaseController
IntegrationController *integration.IntegrationController
ImageController *imagecontroller.ImageController
}

type Framework struct {
Expand Down Expand Up @@ -201,26 +199,19 @@ func InitControllerHub(cc *kubeCl.CustomClient) (*ControllerHub, error) {
return nil, err
}

// Initialize JVM Build Service Controller
jvmbuildserviceController, err := jvmbuildservice.NewSuiteController(cc)
if err != nil {
return nil, err
}

// Initialize Image Controller
imageController, err := imagecontroller.NewSuiteController(cc)
if err != nil {
return nil, err
}

return &ControllerHub{
HasController: hasController,
CommonController: commonCtrl,
TektonController: tektonController,
GitOpsController: gitopsController,
ReleaseController: releaseController,
IntegrationController: integrationController,
JvmbuildserviceController: jvmbuildserviceController,
ImageController: imageController,
HasController: hasController,
CommonController: commonCtrl,
TektonController: tektonController,
GitOpsController: gitopsController,
ReleaseController: releaseController,
IntegrationController: integrationController,
ImageController: imageController,
}, nil
}
Loading

0 comments on commit f8af801

Please sign in to comment.