I have two jenkins jobs - JobA(upstream) and JobB(downstream). JobA generates the artifact TestReport.zip. I want to take TestReport.zip artifact in JobB and send it as an attachment in an email sent from JobB. I tried copy artifact plug in, but no luck. Can somebody please help with some steps how to do it?
Are you facing issue to passing TestReport.zip to Job B or facing issue to send email from Job B. I am assuming, you are facing issue to pass artifact to job B. As copy artifact plugin you tried and not worked, there is some alternative, you can try. So if both job A and Job B are running from same jenkins slave, then you can store artifact in some common place from where Job B can also access that and Job B can copy that from own workspace and initiate email using that as attachment. Please refer this article on how to pass parameter from one job to another.
https://itisatechiesworld.wordpress.com/jenkins-related-articles/jenkins-configuration/jenkins-passing-a-parameter-from-one-job-to-another/
Related
We recently moved Java(TestNG) to C#.Net (NUnit). Sametime migrated to Jenkins to Team-city. Currently we are facing some challenges while we configuring the new build pipeline in Team-City.
Scenario 1: Our project has multiple branches, we generally pull code from different Git-branches then trigger the automation.
In Jenkins we used to create build-parameter(list), when user try to execute the Job, he/she select the branch-name from the list (build-parameters), then git will pull code user selected branch then trigger execution.
Can you please help how to implement a similar process in Team-City?
How to configure the default value in the list parameter?
Scenario 2: In Jenkins build-parameter use used to pass to (TestNG.xml). eg: browser, environment. When the user select browser and environment from build parameters, when execution trigger TestNG pull those values and initiate the regression.
How should create build parameters (browser, envi.) and pass those
values to NUnit/ config file?
Thanks
Raghu
PactSwift:
we are unable to generate pact file while running on real time device, so we planned to generate pact file using CI.
Please share the information about how to generate and push the Pact file using CI.
The steps for the consumer pipeline are like this:
run consumer tests. You should know the exact command here
Make sure you understand where are pacts are located after the tests run
use PactBroker CLI to publish pacts to the broker: pact-broker publish ...
Make sure you know here: pact broker URL, the way how to call it (auth)
That's a first part, when provider part is ready ready about can-i-deploy and there is more
I'm unable to run the Docker Compose task on Azure DevOps and every solution I've looked up online, either makes no sense, or does not work for my scenario.
The job output for the failure is:
This is a very simple process, artifacts are copied to a folder during build, and the docker-compose.yml and .dockerfile is added to this directory, which then needs to be run.
One article explained that if you add your docker-compose.yml to the same folder as the files the image will be hosting and the .dockerfile, that it might cause the daemon to fall over and generate this generic error, so I've added a .dockerignore file, but this issues persists.
I'm using a Hosted Agent - Ubuntu-18.04.
My task looks like this:
steps:
- task: DockerCompose#0
displayName: 'Run a Docker Compose command'
inputs:
azureSubscription: 'Test Dev Ops'
azureContainerRegistry: '{"loginServer":"testdevops.azurecr.io", "id" : "/subscriptions/{subscription_key}/resourceGroups/Test.Devops/providers/Microsoft.ContainerRegistry/registries/testdevops"}'
dockerComposeFile: '$(System.DefaultWorkingDirectory)/$(Release.PrimaryArtifactSourceAlias)/test.ng.$(Build.BuildNumber)/dist/testweb/docker-compose-build.yml'
dockerComposeCommand: build
arguments: '--build-arg azure_pat=$(System.AccessToken) --build-arg azure_username=Azure'
The idea here is that this container is composed and delivered straight to Azure's Container Registry.
I have ensured that the user that's running this process, as been granted permissions in that ACR, as well as added the user to the Administrative group in Azure DevOps.
A lot of responses talks about adding the user to the Docker group, but this is a Hosted Agent, not a private agent, so there is no such option.
I have even tried installing Docker CLI before this task, but nothings working.
Am I being daft to think that I can compose in Azure DevOps?
Edit
The contents of my artifacts folder looks something like this:
This error message is extremely misleading. If anyone from Microsoft is looking at this question, please consider making the error more specific, if possible.
It turned out, I missed a semi-colon in a build task that replaced tokens before the build artifacts was pushed from the build output, and because of that, the yaml file had a #{..} token inside of it, which caused the docker-compose to fail.
It had nothing to do with permissions, nor a .dockerignore file, very misleading.
We have a scheduled release in Octopus that deploys the last known good release to Prod back to Prod.
However this has started failing because the artifact has fallen out of our retention policy - this we can fix by altering the retention policy.
The real issue is that when it failed no notifications were sent to the team because artifact collection happens before even the first step.
I have tested this with a dummy release that just has a single basic step and then a Slack Notification step for when it fails. However, we never get to the first step - let alone the slack step.
How can i hook on to this failure so that we know about these issues in future.
You have to follow below steps to achieve the same
Step 1) Add Email Template step # First : to inform that Build is triggered
There is a setting in that called : Start Trigger set it to Run in parallel with the previous step so email will be triggered while your artifacts are downloading
Step 2) Add Email Template step # Last : to inform that build failed
Just change the setting Run Condition set it to : Failure: only run when a previous step failed
so when your deployment get fail, It will notify the same. You can add the cause of failure in email body using inbuilt variables also.
I am using https://wiki.jenkins.io/display/JENKINS/EnvInject+Plugin 1.93.1 in my Jenkins installation.
I need to fetch the EnvInject properties configuration for every job I have, but I can't seem to find a way to do this in the job rest api.
The way I figured to do this is by fetching the last build for every job and then hit the injectedEnvVars/api/.
This strategy is not optimal because I have to do a request for every job, and that is taking too long (4000+ jobs).
Am I missing something? Is there a way to fetch the envInject properties together with the job information?
If you think send 4000 HTTP requests is not effective, You can iterate the JENKINS_HOME folder on Jenkins Master.
Following picture illustrate the structure for injectedEnvVars.txt which stores the value of EnvInject.
.jenkins is JENKINS_HOME folder
fetch-envinject-value is jenkins job
builds/1 is the 1st job build
builds/1/injectedEnvVars.txt is all environment variables for this job build.