appirio-tech / thurgood

Thurgood is an automated build, testing and security tool for Appirio and topcoder utilizing Jenkins and Checkmarx.
5 stars 16 forks source link

Thurgood

Thurgood is an automated build, testing and security tool for Appirio and topcoder utilizing Jenkins and Checkmarx.

You can run the API from the API Explorer https://thurgood-production.herokuapp.com/explorer or http://localhost:3000/explorer if you are running it locally. See below for more info.

You can see the job queue at http://thurgood-queue.herokuapp.com

Overview

Thurgood is a multi-part application. Here is a high level overview of the application.

Jenkins & Checkmark

You can log into the Jenkins server at: http://ec2-54-158-149-254.compute-1.amazonaws.com/jenkins/login.

Models

Job Model

The job is the heart of Thurgood and has the following properties:

Environment Model

The testing environment used for a job. This is a combination of a github repo, possible testing login credentials and it's associated Jenkins job.

Project Model

The project is used to automatically submit a job when Thurgood receives a webhook from another project github repo. See the instructions below.

See /test/setup.js for sample data.

Salesforce Jobs

This is important.... for Saleforce jobs the files need be all be contained in an src root folder as the build process specifically looks for that directory.

Either add files to a src directory or create it from your Eclipse project with the manifest structure. Just right click on the 'src' directory from Eclipse and zip up everything you want submitted. Your zip file should unzip in the following structure:

See the sample-salesforce.zip file in the project root for an example.

Setting up a project

Thurgood can automatically pull code from your project's github and submit a corresponding job each time you make a commit to your project's repo. First, create a new job record with the repo as :user/:repo (e.g., jeffdonthemic/github-push-test and then create a job using the id of this newly create project.

In your project's github repo, make the squirrelforce github user a collaborator on your repo and create a webhook for push events with the payload URL of https://thurgood-production.herokuapp.com/webhook. You will also need the secret which you can find once you log into Thurgood and click the create new project button.

API Explorer

The documentation for the API is available at the API Explorer. The API is locked down so you'll need to authenticate first and then set the returned id as the access token in the upper right.

Authentication

You can use the default admin user to authenticate and return an access_token. Username is thurgood and the password is set via an environment variable THURGOOD_ADMIN_PASSWORD. Use the StrongLoop API Explorer (https://thurgood-production.herokuapp.com:3000/explorer) with the User/login request section or POST to https://thurgood-production.herokuapp.com/Users/login with the following JSON.

{
  "username": "thurgood",
  "password": THURGOOD_ADMIN_PASSWORD
}

The resulting id is the access token when can be appended to all endpoints:

https://thurgood-production.herokuapp.com/api/jobs?access_token=ACCESS_TOKEN

Testing

Mocha tests uses a test MongoDB connection (mongodb://localhost/thurgood-test). Check the file in /server/datasources.test.json for more details. The /test/setup.js script runs before each set of test and populates the test database. You can modify test data there but you shouldn't need to.

You will need to add some settings to your local .env files. First copy .env-sample and rename it .env. If you want to actually push code to a github repo, you'll need to add your GITHUB_USERNAME and GITHUB_PASSWORD. You'll also need change the repo setting for each each of the environments in the /test/setup.js file so that your user can push to these repos.

To run the mocha tests, run the application in one terminal tab:

source .env
NODE_ENV=test nodemon .

Run the test in another terminal tab:

source .env
npm test