public static Task getTask()

in karavan-web/karavan-cli/src/main/java/org/apache/camel/karavan/cli/resources/KaravanTekton.java [34:79]


    public static Task getTask(KaravanCommand config, String runtime) {
        String taskName = Constants.TASK_DEV + runtime;
        String buildImage = config.getBaseBuilderImage();
        String script = getScript(config, runtime);

        return new TaskBuilder()
                .withNewMetadata()
                .withName(taskName)
                .withNamespace(config.getNamespace())
                .withLabels(ResourceUtils.getLabels(taskName, config.getVersion(), Map.of()))
                .endMetadata()
                .withNewSpec()
                .withParams(new ParamSpecBuilder().withName("project").withType("string").withDescription("ProjectId").build())
                .withSteps(
                        new StepBuilder().withName("karavan-build-deploy")
                                .withScript(script)
                                .withImage(buildImage + ":" + config.getVersion())
                                .withImagePullPolicy("Always")
                                .withEnv(
                                        new EnvVarBuilder().withName("GIT_REPOSITORY").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-repository").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_USERNAME").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-username").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_PASSWORD").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-password").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_BRANCH").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-branch").and().build()).build(),
                                        new EnvVarBuilder().withName("IMAGE_REGISTRY").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("image-registry").withOptional(true).and().build()).build(),
                                        new EnvVarBuilder().withName("IMAGE_GROUP").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("image-group").withOptional(true).and().build()).build(),
                                        new EnvVarBuilder().withName("IMAGE_REGISTRY_USERNAME").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("image-registry-username").withOptional(true).and().build()).build(),
                                        new EnvVarBuilder().withName("IMAGE_REGISTRY_PASSWORD").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("image-registry-password").withOptional(true).and().build()).build()
                                )
                                .build()
                )
                .withWorkspaces(
                        new WorkspaceDeclaration("Maven Settings", "/karavan-config-map", Constants.PVC_MAVEN_SETTINGS, false, false),
                        new WorkspaceDeclaration("Maven Cache", "/root/.m2", Constants.PVC_M2_CACHE, false, false),
                        new WorkspaceDeclaration("JBang Cache", "/jbang/.jbang/cache", Constants.PVC_JBANG_CACHE, false, false)
                )
                .endSpec()
                .build();
    }