How to run only one test every night in Jenkins Pipeline flow - jenkins

I have series of test in Jenkins Pipeline like Integration test1, Integration test2, smoke test, End-to-End Test. Out of these test I want only the End-to-End Test to run every night for master irrespective of the SCM changes.
For example refer attached picture of Pipeline flow
In this I would like to run End-to-End Test every night where as other test should run whenever SCM commit happens. And End-to-End Test should take the latest available artifact from Master.

Scheduling in Jenkins is applicable to jobs. You need to refactor the End-to-End Tests into a separate Job. It can be a simple free-style job or a pipeline job. Then, you can schedule this job by configuring the Build Triggers > Build periodically.
This job can also be invoked from the pipeline by using the build job dsl:
build job: 'e2e-test', parameters: ...

Related

Scheduled builds on CircleCI

We currently have a CircleCI pipeline, that get's triggered whenever a commit gets merged to the test environment.
It builds the app and then runs some tests againsts it using the url of the web app. All this is defined in the config.yml file.
e.g.
Step 1 - Builds the app
Step 2 - Runs tests against the app (on https://)
How can one create a nightly build that only runs tests i.e. Step 2?
In this case, it is not triggered by a commit to the test environment, but is just a scheduled build that runs tests at a specified time
CircleCI supports scheduling jobs through the Scheduled Pipelines feature. From the docs
Scheduled pipelines allow you to trigger pipelines periodically based on a schedule.
You can configure scheduling by choosing your project and then going to Project Settings -> Triggers -> Add Triggers.
In the trigger configuration, add a pipeline parameter, run-tests for instance, which will be passed to the pipeline when the trigger executes the schedule.
Additionally, add the same pipeline parameter to your config.yaml and a when statement to the workflow you want to run, which will check if the pipeline parameter run-tests is present. That should be all the configuration needed to execute a pipeline on a schedule with a specific workflow.
Documentation: https://circleci.com/docs/scheduled-pipelines/

Jenkins Pipeline - Can we run a job outside of jenkins pipeline?

I am using jenkins pipeline and my Jenkinsfile has several stages and jobs. Is there any way to run specific job outside of jenkins pipeline ?
Example: Let's say one of the stage is to do "scp build artifacts to remote location". For some reason this got failed and if at all I want to run rest of the jobs manually out of jenkins pipeline, how can I do that ?
I am least interested to invoke a new build. So can we run remaining jobs after failure outside of jenkins pipeline manually ?
You may be able to do it by writing unit test cases to your Jenkinsfile and test them as a maven project. This may or may not solve your problem without looking at your entire problem but if you can reorganize your logic to achieve 100% test coverage then it is doable. You can find more information about writing test cases of Jenkins pipelines here

How to trigger a job success to a pipeline workflow before archiving artifacts

I have the Jenkins pipeline which contains series of job (for testing using Selenium & Cucumber BDD). Every time we run the pipeline, even the functional test is passed (i called it test status) it takes time for saving the artifacts then job is considered to be PASSED (this i called Job status). So let's say for a simple test that take only 1 minute to run , but saving the artifacts from Jenkins slave to Jenkins master take around the same time or more before it's considered to be passed. In regarding to the fast feedback to the team while running these jobs, it slows down the whole flow.
So, I wonder if there's way that i can modify or config for the post-build actions to send the test status to the pipeline right after running the test (but still saving the artifacts ? )
I just configured the post-build actions:
Archive the artifacts - File to archive : **
My expectation, basically is, the test status (passed/failed) will be parsed right away to Pipeline build scripts, so that the pipeline script will 'acknowledge' it way faster.
As per my understanding without upload completion, success or failure status can't be sent to the upstream job.

DevOps Continuos Delivery for Java Script

Can i use Jenkins integration for DevOps Continuos Delivery Pipeline for JavaScript code builds?
I am trying to build/propose a solution for integrating Jenkins tool and to remove manual code build and deployments to remove the manual effort for my team.
Generally in Jenkins, you can use the below:
Build -> Automated Test -> Dev Deploy -> QA Approval -> QA Deploy
The Seed Job is the one which will be creating other Jenkins job automatically but the seed job itself will be configured manually. The Seed Job will read the DSL script, parse those and create appropriate Job configurations in Jenkins.
After the seed job runs successfully, we will have a job created for our sample app.
The Seed job will create the following set of jobs which will eventually be part of the pipeline. The Seed job will also create a Jenkins pipeline view.
Build: This job includes the configuration for the building project, job triggers, scm location, jdk version to use, maven goals, artifact upload to repo like Artifactory.
Test: This job can call test suites and decide to call a downstream job or not.
Dev Deploy: Simple job with a trigger to the Promotion Job if the deployment was successful.
This job can call the script to perform a deployment or use tools like Bamboo or Urbancode.
Usually a Dev deploy doesn’t need promotion, but we can add that step if required.
QA Promotion: This job includes a send email notification to the person/group responsible for approval. The email contains a link for promotion.
The Promotion Email link can look like this: http://localhost:8080/XXX/XXXXX/XXX
The same can be done for the UAT and Prod:
We can chain multiple Promotion Jobs and Deploy jobs to accomplish the need for another environment, for e.g. UAT Promotion -> UAT Deploy ->PreProd Promotion -> PreProd Deploy -> Prod Promotion -> Prod Deploy
And here for all the above mentioned processes it can be done via Jenkins tool
Also yes, to answer your question you definitely can use Jenkins integration in Devops Pipeline.
If you are building your solution in cloud or in any domain servers then you might have to get the Jenkins integrated in the same environment.

How to trigger Jenkins downstream job from script but not manually through Jenskins?

From Jenkins plugin (ie. Delivery Pipeline, Parameterized Trigger), we could setup a pipeline which contains multiple jobs in sequence, for instance: Build -> Unit Test -> Deploy To DEV.
Now, for each pipeline, we want to stop after "Unit Test" because we need to wait for someone to approve the deployment before it can go on (We use JIRA as the tracking system for this).
Say when, someone approves the deployment ticket in JIRA, we already setup a post action to fire and trigger a job in Jenkins, say "Deploy To Dev" in this case. However, this job will run independently outside the pipeline.
Is there a way, we can trigger the down stream job from script within an instance of a pipeline so it can carry over all the parameters from upstream and shown as part of the pipeline?
Thx

Resources