Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 1285-: SendMail task was failing to execute successfully #1286

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

sudhishmk
Copy link
Contributor

@sudhishmk sudhishmk commented Jun 30, 2024

Changes to fix sendmail task issue -: SendMail task was failing to execute successfully

Submitter Checklist

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

  • Follows the authoring recommendations
  • Includes docs (if user facing)
  • Includes tests (for new tasks or changed functionality)
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Commit messages follow commit message best practices
  • 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
  • Complies with Catalog Organization TEP, see example. Note An issue has been filed to automate this validation
    • File path follows <kind>/<name>/<version>/name.yaml

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

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

    • Has mandatory metadata.annotations tekton.dev/pipelines.minVersion

    • 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.

Copy link

linux-foundation-easycla bot commented Jun 30, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sudhishmk / name: Sudhish Nair (ab8f5fa)

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 30, 2024
@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..9f56ca9 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..1327dfe 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

@tekton-robot
Copy link

Catlin Output
FILE: task/sendmail/0.2/sendmail.yaml
ERROR: Resource path is invalid; expected path: task/sendmail/0.1/sendmail.yaml

@sudhishmk
Copy link
Contributor Author

/assign @akihikokuroda

@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..9f56ca9 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..31f2536 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: Messaging
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

@sudhishmk sudhishmk requested a review from vdemeester July 4, 2024 11:47
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

Can you squash the commits to one and change the subject in PR and commit?

@khrm
Copy link
Contributor

khrm commented Jul 4, 2024

You have to change the email in git using: git config --global user.email or add the newer email to Github profile as secondary/primary for easy-cla

@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..9f56ca9 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..31f2536 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: Messaging
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

@sudhishmk sudhishmk changed the title FIx for Issue 1285 Fix for Issue 1285-: SendMail task was failing to execute successfully Jul 4, 2024
@vinamra28
Copy link
Member

@sudhishmk, can you please fix the CLA?

@sudhishmk
Copy link
Contributor Author

/easycla

@sudhishmk
Copy link
Contributor Author

sudhishmk commented Jul 15, 2024

@sudhishmk, can you please fix the CLA?

@vinamra28 Done

@sudhishmk sudhishmk closed this Jul 16, 2024
@sudhishmk sudhishmk reopened this Jul 16, 2024
@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..9f56ca9 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..31f2536 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: Messaging
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

Copy link
Member

@vinamra28 vinamra28 left a comment

Choose a reason for hiding this comment

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

hi @sudhishmk, apologies for seeing this late. Can you please take a look at following reviews. Can probably merge after this

task/sendmail/0.2/sendmail.yaml Outdated Show resolved Hide resolved
task/sendmail/0.2/sendmail.yaml Outdated Show resolved Hide resolved
task/sendmail/0.2/sendmail.yaml Outdated Show resolved Hide resolved
@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..1762993 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
@@ -60,7 +60,7 @@ The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/pp
 This TaskRun runs the Task to send an email to the receivers via the SMTP server.
 
 ```
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: TaskRun
 metadata:
   name: mail-taskrun
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..5e8c460 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -1,9 +1,9 @@
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: Messaging
@@ -32,7 +32,7 @@ spec:
     description: recipient email addresses (space delimited list)
   steps:
   - name: send
-    image: docker.io/library/python:3.8-alpine@sha256:e11bbd37d4371894e954421b85dbe8dd4eb7198d7cb4ed144ab529f19f57c3f1 #tag: 3.8-alpine
+    image: docker.io/library/python:3.12-alpine@sha256:c2f41e6a5a67bc39b95be3988dd19fbd05d1b82375c46d9826c592cca014d4de #tag: 3.12-alpine
     script: |
       #!/usr/bin/env python3
       import smtplib, ssl, os
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

@vinamra28
Copy link
Member

also can you please squash the commits once all the comments are addressed?

@tekton-robot
Copy link

Catlin Output
FILE: task/conftest/0.2/conftest.yaml
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 15:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 16:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 15: syntax error: unexpected redirection

@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..1762993 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
@@ -60,7 +60,7 @@ The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/pp
 This TaskRun runs the Task to send an email to the receivers via the SMTP server.
 
 ```
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: TaskRun
 metadata:
   name: mail-taskrun
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..9c59010 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -1,11 +1,11 @@
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
-    tekton.dev/pipelines.minVersion: "0.12.1"
+    tekton.dev/pipelines.minVersion: "0.50.0"
     tekton.dev/categories: Messaging
     tekton.dev/tags: mail
     tekton.dev/displayName: "send mail"
@@ -32,7 +32,7 @@ spec:
     description: recipient email addresses (space delimited list)
   steps:
   - name: send
-    image: docker.io/library/python:3.8-alpine@sha256:e11bbd37d4371894e954421b85dbe8dd4eb7198d7cb4ed144ab529f19f57c3f1 #tag: 3.8-alpine
+    image: docker.io/library/python:3.12-alpine@sha256:c2f41e6a5a67bc39b95be3988dd19fbd05d1b82375c46d9826c592cca014d4de #tag: 3.12-alpine
     script: |
       #!/usr/bin/env python3
       import smtplib, ssl, os
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

.
Fix for issue-1285 Send mail task was failing to complete
@tekton-robot
Copy link

Diff between version 0.1 and 0.2
diff --git a/task/sendmail/0.1/README.md b/task/sendmail/0.2/README.md
index aafe880..1762993 100644
--- a/task/sendmail/0.1/README.md
+++ b/task/sendmail/0.2/README.md
@@ -5,7 +5,7 @@ This task sends a simple email to receivers via SMTP server
 ## Install the Task and create a secret
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.1/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/sendmail/0.2/raw
 ```
 
 Create a secret that has the SMTP server information
@@ -60,7 +60,7 @@ The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/pp
 This TaskRun runs the Task to send an email to the receivers via the SMTP server.
 
 ```
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: TaskRun
 metadata:
   name: mail-taskrun
diff --git a/task/sendmail/0.1/sendmail.yaml b/task/sendmail/0.2/sendmail.yaml
index b512852..9c59010 100644
--- a/task/sendmail/0.1/sendmail.yaml
+++ b/task/sendmail/0.2/sendmail.yaml
@@ -1,11 +1,11 @@
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
 kind: Task
 metadata:
   name: sendmail
   labels:
-    app.kubernetes.io/version: "0.1"
+    app.kubernetes.io/version: "0.2"
   annotations:
-    tekton.dev/pipelines.minVersion: "0.12.1"
+    tekton.dev/pipelines.minVersion: "0.50.0"
     tekton.dev/categories: Messaging
     tekton.dev/tags: mail
     tekton.dev/displayName: "send mail"
@@ -32,7 +32,7 @@ spec:
     description: recipient email addresses (space delimited list)
   steps:
   - name: send
-    image: docker.io/library/python:3.8-alpine@sha256:e11bbd37d4371894e954421b85dbe8dd4eb7198d7cb4ed144ab529f19f57c3f1 #tag: 3.8-alpine
+    image: docker.io/library/python:3.12-alpine@sha256:c2f41e6a5a67bc39b95be3988dd19fbd05d1b82375c46d9826c592cca014d4de #tag: 3.12-alpine
     script: |
       #!/usr/bin/env python3
       import smtplib, ssl, os
@@ -53,8 +53,11 @@ spec:
       if tls == 'True':
           context = ssl.create_default_context()
           server = smtplib.SMTP_SSL(smtp_server, port, context=context)
+          server.ehlo()
       else:
           server = smtplib.SMTP(smtp_server, port)
+          server.ehlo()
+          server.starttls()
       if password != '':
           server.login(user, password)
       for receiver in [item for item in receiver_emails.split(' ') if item]:

@sudhishmk
Copy link
Contributor Author

also can you please squash the commits once all the comments are addressed?

Done

Copy link
Member

@vinamra28 vinamra28 left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2024
@tekton-robot
Copy link

[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 tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 20, 2024
@tekton-robot tekton-robot merged commit a8c2c4d into tektoncd:main Aug 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants