catalog icon indicating copy to clipboard operation
catalog copied to clipboard

Add maven command path to maven task

Open mosuke5 opened this issue 1 year ago • 4 comments

Changes

In version v0.3, the path for the mvn command was set to /usr/bin/mvn. In this setup, it wasn't possible to switch to a different mvn container image or to utilize the mvnw located within the application's repository. By introducing MAVEN_COMMAND, users are now able to execute any mvn command of their choice. Additionally, with this change, the default value for MAVEN_COMMAND is /usr/bin/mvn, ensuring compatibility with v0.3.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • [x] Follows the authoring recommendations
  • [x] Includes docs (if user facing)
  • [x] Includes tests (for new tasks or changed functionality)
  • [x] Meets the Tekton contributor standards (including functionality, content, code)
  • [x] Commit messages follow commit message best practices
  • [x] Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • [x] Complies with Catalog Organization TEP, see example. Note An issue has been filed to automate this validation
    • [x] File path follows <kind>/<name>/<version>/name.yaml

    • [x] Has README.md at <kind>/<name>/<version>/README.md

    • [x] Has mandatory metadata.labels - app.kubernetes.io/version the same as the <version> of the resource

    • [x] Has mandatory metadata.annotations tekton.dev/pipelines.minVersion

    • [x] mandatory spec.description follows the convention

        ```
      
        spec:
          description: >-
            one line summary of the resource
      
            Paragraph(s) to describe the resource.
        ```
      

See the contribution guide for more details.

mosuke5 avatar Oct 13 '23 01:10 mosuke5

Hi @mosuke5. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Oct 13 '23 01:10 tekton-robot

Diff between version 0.3 and 0.4
diff --git a/task/maven/0.3/README.md b/task/maven/0.4/README.md
index bd09885..90af923 100644
--- a/task/maven/0.3/README.md
+++ b/task/maven/0.4/README.md
@@ -11,6 +11,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/maven/0.3/ra
 ## Parameters
 
 - **MAVEN_IMAGE**: The base image for maven (_default_: `gcr.io/cloud-builders/mvn`)
+- **MAVEN_COMMAND**: Maven command to execute, you could use the maven wrapper over here (_default_: `/usr/bin/mvn`)
 - **GOALS**: Maven `goals` to be executed
 - **MAVEN_MIRROR_URL**: Maven mirror url (to be inserted into ~/.m2/settings.xml)
 - **SERVER_USER**: Username to authenticate to the server (to be inserted into ~/.m2/settings.xml)
diff --git a/task/maven/0.3/maven.yaml b/task/maven/0.4/maven.yaml
index d78758a..45afbf8 100644
--- a/task/maven/0.3/maven.yaml
+++ b/task/maven/0.4/maven.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: maven
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.17.0"
     tekton.dev/categories: Build Tools
@@ -28,6 +28,10 @@ spec:
       type: string
       description: Maven base image
       default: gcr.io/cloud-builders/mvn@sha256:57523fc43394d6d9d2414ee8d1c85ed7a13460cbb268c3cd16d28cfb3859e641 #tag: latest
+    - name: MAVEN_COMMAND
+      description: Maven command to execute, you could use the maven wrapper over here.
+      type: string
+      default: "/usr/bin/mvn"
     - name: GOALS
       description: maven goals to run
       type: array
@@ -77,7 +81,7 @@ spec:
       default: "."
   steps:
     - name: mvn-settings
-      image: registry.access.redhat.com/ubi8/ubi-minimal:8.2
+      image: registry.access.redhat.com/ubi8/ubi-minimal:8.8
       script: |
         #!/usr/bin/env bash
 
@@ -146,7 +150,7 @@ spec:
     - name: mvn-goals
       image: $(params.MAVEN_IMAGE)
       workingDir: $(workspaces.source.path)/$(params.CONTEXT_DIR)
-      command: ["/usr/bin/mvn"]
+      command: ["$(params.MAVEN_COMMAND)"]
       args:
         - -s
         - $(workspaces.maven-settings.path)/settings.xml

tekton-robot avatar Oct 13 '23 01:10 tekton-robot

Catlin Output
FILE: task/maven/0.4/maven.yaml
HINT : Task: tekton.dev/v1beta1 - name: "maven" is missing a readable display name annotation("tekton.dev/displayName")
WARN : Step "mvn-settings" references "$(params.PROXY_HOST)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
WARN : Step "mvn-goals" uses image "$(params.MAVEN_IMAGE)" that contains variables; skipping validation

tekton-robot avatar Oct 13 '23 01:10 tekton-robot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vinamra28

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

tekton-robot avatar Nov 06 '23 17:11 tekton-robot