I am using email ext plugin my Jenkins pipeline job like this::::::
emailext body: "(body: ${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}", to: '<some emailid>'
Its working but not getting any email from Jenkins.
but output is showing sending to ---> what i gave [to] option...
Pls help me out
TIA
Related
I have tried to use ManualValidation task in my pipeline but it did not passed because it is not installed from the market place but, when I go on the page on the market place I can not find any extension for manual validation on pipeline. Can someone provide me with information about this?
My azure-pipeline.yml looks like this:
trigger:
main
jobs:
job: waitForValidation
displayName: Wait for external validation
pool: server
timeoutInMinutes: 4320
steps:
task: ManualValidation#0
timeoutInMinutes: 1440
inputs:
notifyUsers: |
myemail#name.com
instructions: 'Please validate the build configuration and resume'
onTimeout: 'resume'
A task is missing. The pipeline references a task called 'ManualValidation'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com.
Context: performing Android instrumentation (UI) tests with Azure Pipelines.
There are 2 jobs: one does the testing (launches an emulator and runs the tests), and the other job reports an error, if the previous job fails for some reason.
I have the following simple setup in my Azure Pipelines:
jobs:
- job: SmokeTesting
displayName: Smoke testing
timeoutInMinutes: 60
pool:
vmImage: 'macOS-latest'
steps:
- script: meta/scripts.sh launch_avd
displayName: Launch AVD
workingDirectory: ''
- task: Gradle#2
displayName: Run smoke tests
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
publishJUnitResults: true
tasks: ':app:connectedAndroidTest'
- job: ReportFailure
displayName: Report failure
dependsOn:
- SmokeTesting
condition: or(failed(), canceled())
steps:
- script: meta/scripts.sh report_smoke_tests_error
workingDirectory: ''
env:
BUILD_ID: $(Build.BuildId)
It all works as expected: if there is an error, the second job is run. In this case, the log in Azure Pipelines Web contains very useful information, that I would like to have access to in the second job:
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> No version of NDK matched the requested version 22.0.7026061. Versions available locally: 18.1.5063045, 21.3.6528147, 21.3.6528147
How do I get "What went wrong" message in my second job?
My idea is to use multi-stage variable to record the message in the first job, and then use it in the second one. Unfortunately, I haven't figured out how to get this message in the first place.
As a workaround, you can use the Build Timeline api to get detailed build information. The api response contains the property issues, you can check the results there if there is an errors.
https://dev.azure.com/{org}/{pro}/_apis/build/builds/3838/timeline/?api-version=6.0
If the issues does not contain the error message you want, you can retrieve the content related to Gradle#2 task in the response body. Obtain the log url according to the property log.
By calling this log url, you can get the log of Gradle#2 task, and then parse the log to get the desired message.
I am running some automated tests using concourse ci pipeline. My requirement is to mark the build as failed if any of the tests failed and email the results. Is there a way to do this in concourse? The email feature is working fine, but the build passes even with the test failures.
Under the assumption that the exit code is correct you will need to use the on failure step on concourse and add that to your job, it will look something like this
jobs:
- name: myBuild
plan:
- get: your-repo
passed: []
trigger: false
- task: run-tests
file: runMyTestsTask.yml
on_failure:
- put: send-an-email
params:
subject_text: "Your email subect i.e Failed Build"
body_text: "Your message when the build has failed"
on_success:
put: push-my-build
## Define your additional resources here
resources:
- name: send-an-email
type: email
source:
smtp:
host: smtp.example.com
port: "587" # this must be a string
username: a-user
password: my-password
from: build-system#example.com
to: [ "dev-team#example.com", "product#example.net" ] #optional if `params.additional_recipient` is specified
resource_types:
- name: email
type: docker-image
source:
repository: pcfseceng/email-resource
Additionally if you need to output some relevant information about the build, you can do so by including some environment vars that will wrap the concourse metadata and you can include that into the body of the email message, for more details on how to do this, please refer to documentation of the email resource here: https://github.com/pivotal-cf/email-resource.
If you're running JMeter in command-line non-GUI mode your command needs to return non-zero exit status code
Even if there are failures in your test the JMeter process has 0 exit code therefore any CI system will treat the execution as successful:
If you're looking for a JMeter-only solution you can add a JSR223 Assertion to your Test Plan and put the following code into "Script" area:
if (!prev.isSuccessful()) {
props.put('failure', 'true')
}
Then add tearDown Thread Group to your Test Plan and put JSR223 Sampler there with the following code:
if (props.get('failure').equals('true')) {
System.exit(1)
}
if any Sampler in the JSR223 Assertion Scope fails - the whole JMeter process will finish with exit code 1 which is treated as error by any upstream processing system.
Another option is considering using Taurus tool as the wrapper for your JMeter test, Taurus provides flexible pass/fail criteria subsystem which allows you possibility to define thresholds for considering test successful or not. If the thresholds are exceeded - Taurus will return non-zero exit code which should be "understood" by the concourse (or whatever else software)
I want to create a jira issue with the Jenkins Jira Steps plugin in my jenkins pipeline with groovy and I have the following code in a stage:
def buildIssue = [fields: [project: [key: 'OLSSCHED'],
summary: 'test',
issuetype: [id: '10102']]]
def response = jiraNewIssue issue: buildIssue
echo response.successful.toString()
echo response.data.toString()
The issuetype only requires the field 'summary' and also only shows the field 'summary' when creating it interactively in Jira.
But I get an error message when trying to create it via Jenkins pipeline stating the following:
Error Message: {"errorMessages":[],"errors":{"description":"Field
'description' cannot be set. It is not on the appropriate screen, or
unknown."}}
I am not trying to the set description field. Does anyone know if the plugin internally tries to set this field? Or why does it throw such an error?
I am using Prepare, Run and Publish analysis tasks in VSTS to run the SonarQube analysis and publish the results to build summary. First two steps execute successfully but the 'Publish Analysis' task fails because it is not able to fetch the task for analysis ID. I get the following error message:
Could not fetch task for ID 'AWE9-wu8-fbfJflhFQ3-'
VSTS Publish Analysis Task Log:
2018-01-28T18:15:28.1037139Z ##[debug][SQ] Waiting for task 'AWE9-wu8-fbfJflhFQ3-' to complete.
2018-01-28T18:15:28.1037139Z ##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AWE9-wu8-fbfJflhFQ3-"}"
2018-01-28T18:15:28.1047138Z ##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AWE9-wu8-fbfJflhFQ3-'
2018-01-28T18:15:28.1047138Z ##[debug]task result: Failed
2018-01-28T18:15:28.1047138Z ##[error][SQ] Could not fetch task for ID 'AWE9-wu8-fbfJflhFQ3-'
2018-01-28T18:15:28.1047138Z ##[debug]Processed: ##vso[task.issue type=error;][SQ] Could not fetch task for ID 'AWE9-wu8-fbfJflhFQ3-'
2018-01-28T18:15:28.1047138Z ##[debug]Processed: ##vso[task.complete result=Failed;][SQ] Could not fetch task for ID 'AWE9-wu8-fbfJflhFQ3-'
2018-01-28T18:15:28.3907147Z ##[section]Finishing: Publish Analysis Result
I was seeing the exact same problem as Vignesh. Running SonarQube 6.7.1 and latest version of VSTS SonarQube extension.
I found out what the problem was; it's in the SonarQube VSTS Extensions (Prepare, Analyse & Publish).
The SonarQube extension uses basic authentication to communicate with the SonarQube API endpoint, and uses the token as username, and password as null.
The npm package 'request' (at least latest version 2.83.0), does not allow null passwords and returns 'auth() received invalid user or password'.
To fix it, the password should be set to an empty string instead.
Until the VSTS plugin is fixed by SonarSource, you can workaround the issue by manually editing the extension on your VSTS build machine. The file to edit is: <build location>\_tasks\SonarQubePublish_291ed61f-1ee4-45d3-b1b0-bf822d9095ef\4.0.0\common\helpers\request.js
Add a new row after row 22:
options.auth.pass = "";
The endresult should be something like:
var options = {
auth: endpoint.auth
};
if (query) {
options.qs = query;
options.useQuerystring = true;
}
options.auth.pass = "";
request.get(__assign({ method: 'GET', baseUrl: endpoint.url, uri: path, json: true }, options), function (error, response, body) {
I give no guarantees, but this worked for me.
We are using the TFS extension in version 4.0.1 and the failure is still there.
2018-02-07T10:34:41.7065486Z ##[debug][SQ] Waiting for task 'AWFv1Mcg5obW39zt_5IE' to complete.
2018-02-07T10:34:41.7065486Z ##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AWFv1Mcdgfdg39zt_5IE"}"
2018-02-07T10:34:41.7690509Z ##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AWFv1Mcdgfdg39zt_5IE'
2018-02-07T10:34:41.7690509Z ##[debug]task result: Failed
2018-02-07T10:34:41.7690509Z ##[error][SQ] Could not fetch task for ID 'AWFv1Mcdgfdg39zt_5IE'
2018-02-07T10:34:41.7690509Z ##[debug]Processed: ##vso[task.issue type=error;][SQ] Could not fetch task for ID 'AWFv1Mcdgfdg39zt_5IE'
2018-02-07T10:34:41.7690509Z ##[debug]Processed: ##vso[task.complete result=Failed;][SQ] Could not fetch task for ID 'AWFv1Mcdgfdg39zt_5IE'
See screenshot here
This was indeed caused by passing a null password to the request library.
A fix have been deployed (version 4.0.1 of the SonarQube extension, version 4.0.1 of the publish task). See https://jira.sonarsource.com/browse/VSTS-134