0

Iam able to generate URL of .txt/.exe placed in AWS from this command --

sh  "aws s3 presign s3://awsexamplebucket/test2.txt"

Iam already mailing few things in jenkins pipeline about status of build,etc. How I can add generated above URL in mailing part? Working in multibranch jenkins pipeline.Generated URL i can see in build console but how this can be sent across automated mail. Thanks for help.

chehsunliu
  • 1,046
  • 1
  • 8
  • 18

1 Answers1

0

If above sh command only gives you the generated url then you can store that url in variable and use it in email part or anywhere else.

String getUrlmake sure you define this before the pipeline syntax.

getUrl = sh(script: "aws s3 presign s3://awsexamplebucket/test2.txt", returnStdout: true)

and use that getUrl anywhere like this $getUrl

Dashrath Mundkar
  • 5,514
  • 2
  • 22
  • 35
  • That's perfectly the way Iam using, and it's working.Thanks for the answer. I used def getUrl instead String; and tried in one line like, def getUrl = sh(script: "aws s3 presign s3://awsexamplebucket/test2.txt", returnStdout: true) – harshit srivastava Oct 05 '21 at 03:40
  • Thanks, please help on this also. https://stackoverflow.com/questions/69078392/i-need-to-change-one-flag-in-a-file-through-jenkinsfile-pipeline – harshit srivastava Oct 05 '21 at 04:03