Hi guys, I have updated my Apigee CICD repo on Github.
Pipeline steps,
Github
.Apigee Lint
.apiproxy
directory goes through Unit Tests
using mocha
.Istanbul/nyc
and reports are generated by Cobertura
.edge.json
configurations are created/updated and a new revision is published in prod
environment using Apigee Maven Build Plugin
.prod
environment goes through Integration tests using Apickli
.Cucumber Reports
are displayed in Jenkins.FAILS
, the current revision is undeployed
and a stable/previous/hardcoded revision is re-deployed
.Success/Fail
notification along with Cucumber reports
are sent to Slack Room
.For a detailed demo/steps/scripts, visit GitHub Repo.
I would still like to modify the current pipeline and add new options in the future,
Integration Test
, we can add another Stage to Update Developer Portal Docs
.Apigee Drupal based portal
.Apigee Integrated Developer Portal
as of 14th July 2019.Performace/Load Tests
after Integration Tests
dev >> uat >> prod
environments and use Jenkins to Merge and Commit updates.OAS
with Apigee Management APIs to create and deploy a proxy through Pipeline.********************************************************v1*********************************************************
@Siddharth Barahalikar - You have provided great details for creating Apigee pipeline. How much time did you need to establish this pipeline?
Hi @Hitesh Parikh, sorry for the delayed response. I somehow missed your query.
Well, it took me about a week to explore various docs & set up this pipeline.
Do you have the latest updates too? as I see latest commit is one year old
I have plans to update it. But it is going to take sometime.
Are you looking for anything specific?
Not yet. Just started to follow this. Will post here if I face any issue.
It would be great if you put up a video if possible.
What exactly assertible is doing here? is that unit testing goes to assertible and then to apigee test?
At that time, I used Assertible as a first level basic testing, to check the status codes and input validation.
But it can be done using Apickli as well. So once you pull the proxy from github, I would suggest you do the static code analysis, then do Unit test for custom code like JS, Java, Python, Nodejs.
StaticCodeAnalysis >> Unit Test >> Deploy >> Performance/Integration testing >> Updating Docs
For cucumber reports, do you have any specific config that needs to be changed in jenkins config other than plugin installation?
for me reports are not getting generated.
After APICKLI test, a reports.json file is generated. You need to copy that files to the workspace and then run a cucumber command. You can do that in finally block.
finally { // generate cucumber reports in both Test Pass/Fail scenario // to generate reports, cucumber plugin searches for an *.json file in Workspace by default bat "cd hr-api/test-dir/test/features && cp reports.json $WORKSPACE" cucumber fileIncludePattern: 'reports.json' }
could you provide the whole updated jenkins file that you are executing in windows
@Siddharth Barahalikar, I am looking at this repo for Jenkins job.
https://github.com/sidd-harth/apigee-cicd
If you have 1 Github repo for each proxy and a jenkinsfile in each repo, could you guide on how the job is setup on Jenkins? Are you using 1 proxy repo === 1 jenkins job?
Or would it be possible to use 1 Jenkins job for all proxy repos?
Thanks in advance.
I am not working on this currently so I dont have an updated Jenkinsfile.
Try it and let me know your issues, I will try to address them.
The repo you are looking at has only one proxy.
I have not tried 1 Jenkins job for all proxy repos. But I guess it can be done with this Jenkins Plugin Multiple SCMs Plugin
Thanks able to do it finally.
Only thing i noticed is I need to add npm install before cucumber/apickli tests, in the same test folder. If I installed anywhere else, it fails.
I am glad that it worked for you.
Even I had issue with cucumber and I mentioned them in the Known/Current Issues at the end of Readme. I have rectified it in the new update.
I have started working on v2 of this project. I will update this thread in few days.
Hi @SatK, I updated my Repo, please have a look if required.
question, where is this getting used. I see sendNotifications is configured in var, but where is this shared one
@Library('slackNotifications-shared-library@master') _
I am using a shared library to send slack notification. It reduces the repeated code in declarative pipeline.
Check this blog,
Thanks. One more question
apiproxy
directory goes through Unit Tests
using mocha
. - Setting the variables to js file and retrieving them. Is this the test you are doing here?Istanbul/nyc
and reports are generated by Cobertura
. - Didn't understand this. what is code coverage and what does it do?Hi @maneesh m,
I opinion on having 1 jenkin job for all the proxy would not be a good approach. if it fails it has to revert all the proxies and other configurations which is very difficult to trace, fix and deploy. So 1 proxy repo = 1 job would be much better.
Great article @Siddharth Barahalikar
@Siddharth Barahalikar, congratulations, it's a great article.
Just a question, as the pipeline is triggered by a github code update, how would a change thru apigee-ui trigger the pipeline ? I mean, every change made using apigee-ui would need to be exported and commited to github manually to trigger the pipeline ?
Thank you for sharing info