invoking apigeelint module from Jenkins for static code analysis

Hi ,

I am working on CI/CD process to build and deploy api proxy with Jenkins & GitHub Repo.

here I want to add apigeelint to run static code analysis before proceeding actual build . I am able to run same in my local and getting report too ..

Now looking for some help on how to integrate same with Jenkins ..if we have any docs/links with process please direct me to there

Solved Solved
0 6 972
1 ACCEPTED SOLUTION

HI @Ravi U

If you are using the deploy.sh, then you can include the same set of command you are using in your local to run apigeelint. Create a package.json file in the same directory as apiproxy (if not already created) and include apigeelint as dependency, something like

{
  "name": "proxyName",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "test": "tests"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Sai Saran",
  "license": "ISC",
  "dependencies": {
    "apigeelint": "^0.1.8"
  }
}

Then in your script before the deploy command, include the following

npm install
./node_modules/apigeelint/main.js -s apiproxy/ -f table.js

Please check and let me know if it works

NOTE: Make sure the system running the script has NodeJS and npm installed

View solution in original post

6 REPLIES 6

Hi @Ravi U

Welcome to the community !!!

Which build script are you using to deploy proxy to Apigee - Maven or some customized shell script or any other tool ? Will be able to help if you can provide that info

Hi Sai , I am using deploy.sh shell script for deploying proxy into apigee

HI @Ravi U

If you are using the deploy.sh, then you can include the same set of command you are using in your local to run apigeelint. Create a package.json file in the same directory as apiproxy (if not already created) and include apigeelint as dependency, something like

{
  "name": "proxyName",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "test": "tests"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Sai Saran",
  "license": "ISC",
  "dependencies": {
    "apigeelint": "^0.1.8"
  }
}

Then in your script before the deploy command, include the following

npm install
./node_modules/apigeelint/main.js -s apiproxy/ -f table.js

Please check and let me know if it works

NOTE: Make sure the system running the script has NodeJS and npm installed

I have added one more shell script with required commands and invoked before actual deployment scripts ..looks like apigeelint verifying proxy code but Jenkins console logs not able to show the report information in correct format

Report coming up like below

╔����������������������������������������������������������������������������������������������������������������╗
â•‘ 0 Errors                                                                                                       â•‘
╟────────────────────────────────────────────────────────────────────────────────────────────────────────────────╢
â•‘ 0 Warnings                                                                                                     â•‘
╚�����������������������������������������������������������������������������������������������������������������


You might want to try other format types. The tools supports a bunch. Check out the documentation at https://www.npmjs.com/package/apigeelint#usage

Thanks sai ..will try some other types