0
votes

I have 2 freestyle Jenkins jobs say Job A (upstream) and Job B(downstream). I want to send editable email after Job B completes. Also, I want to use the Job Name, Build number and status of Job A in the email content and subject. Can anyone help me with this?

I have tried using the post-build step: "Trigger Parameterized Build on Other Projects" and used Predefined parameters as :

UPSTREAM_BUILD_NUMBER=$BUILD_ID UPSTREAM_JOB_NAME=$JOB_NAME

screenshot for parameters

In Job B, In the email body I am using: $UPSTREAM_JOB_NAME with Build number- $UPSTREAM_BUILD_NUMBER completed. Please find the test result attached.

But in the email I am getting exact same sentence "$UPSTREAM_JOB_NAME with Build number- $UPSTREAM_BUILD_NUMBER completed. Please find the test result attached." whereas I was expecting something like "JOB A with Build number- 123 completed. Please find the test result attached."

I don't understand if I am following correct steps.

1

1 Answers

0
votes

Replace $BUILD_ID by ${BUILD_NUMBER} and $JOB_NAME by ${JOB_NAME}

Example:

UPSTREAM_BUILD_NUMBER=${BUILD_NUMBER}, UPSTREAM_JOB_NAME=${JOB_NAME}