Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Addressing Govindan's comment-Separating out CI information to dedica…
Browse files Browse the repository at this point in the history
…ted page
  • Loading branch information
shuklanirdesh82 committed Jun 30, 2017
1 parent a976e63 commit c55efbf
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 89 deletions.
94 changes: 94 additions & 0 deletions CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# CI Overview

## Topics

* [Testing on CI](#testing-on-ci-system)
* [Current CI setup](#ci-system)
* [Running CI/CD on a dev setup](##running-cicd-on-a-dev-setup)

## Testing on CI system

The work flow for testing proposed code looks like this

- Each checkin into a branch on the official repo will run the full set of
tests.

- On Pull Requests the full set of tests will be run.
- The logs for the build and test will be posted to the CI server.
- Due to security concerns the artifacts will not be published.
https://github.com/drone/drone/issues/1476

- Each commit into the master operation will run the full set of tests
part of the CI system.
- On success a docker image consisting of only the shippable docker
plugin is posted to docker hub. The image is tagged with latest
(and `<branch>-<build>`). Any one can pull this image and run it to
use the docker plugin.

A typical workflow for a developer should be.

- Create a branch, push changes and make sure tests do not break as reported
by the CI system.
- When ready post a PR. This will trigger a full set of tests on ESX. After all
the tests pass and the review is complete the PR will be merged in. If the PR
depends on new code checked into master, merge in the changes as a rebase and
push the changes to the branch.
- When there is a failure unrelated to your PR, you may want to *Restart* the failed CI run instead of pushing dummy commit to trigger CI run.
- When the PR is merged in the CI system will re-run the tests against the master.
On success a new Docker image will be ready for customers to deploy (This is only
for the docker plugin, the ESX code needs to be shipped separately).

## CI System

We are using the CI system that has been up by the CNA folks (@casualjim, @frapposelli & @mhagen-vmware).
The CI system is based on https://drone.io/ URL for the server is https://ci.vmware.run/
To be able to change the integration between CI and GitHub, first become admin using the self serve portal.

Behind the firewall there is a HW node running ESX that hosts 2 ESX VMs (v6.0u2 and v6.5). Each VM in turn contains a VSAN datastore as well as a VMFS datastore with 2 VMs per datastore (VMs are reused to form swarm cluster). CI testbed is also configured to have swarm cluster and there 3 VMs participating into the swarm cluster (2 VMs created on vmfs datastore and 1 VM created on vsan datastore).

There is a webhook setup between github repo and the CI server. The CI server uses
.drone.yml file to drive the CI workflow.

The credentials for Docker Hub deployment is secured using http://readme.drone.io/usage/secrets/

### Running CI/CD on a dev setup
Each developer can run tests part of the CI/CD system locally in their sandbox. This section describes how to configure your development setup for running CI/CD. If you are looking for configuring local testbed setup, **please refer** [Setting up local testbed](#local-testbed-setup).

* Setup:
The current CI/CD workflow assumes that the testbed consists of:
- One ESX
- 3 Linux VMs running on the same datastore in the ESX.

* Install [Drone CLI](https://github.com/drone/drone-cli)
```
curl http://downloads.drone.io/drone-cli/drone_linux_amd64.tar.gz | tar zx
sudo install -t /usr/local/bin drone
```

* If not already done, checkout source code in $GOPATH
```
mkdir -p $GOPATH/src/github.com/vmware
cd $GOPATH/src/github.com/vmware
git clone https://github.com/vmware/docker-volume-vsphere.git
```

* Setup ssh keys on linux nodes & ESX

Linux:
```
export NODE=root@10.20.105.54
cat ~/.ssh/id_rsa.pub | ssh $NODE "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
```

ESX:
```
cat ~/.ssh/id_rsa.pub | ssh $NODE " cat >> /etc/ssh/keys-root/authorized_keys"
```
Test SSH keys, login form the drone node should not require typing in a password.

* Run drone exec

```
cd $GOPATH/src/github.com/vmware/docker-volume-vsphere/
drone exec --trusted --yaml .drone.dev.yml -i ~/.ssh/id_rsa -e VM1=<ip VM1> -e VM2=<ip VM2> -e ESX=<ip ESX>
```
95 changes: 6 additions & 89 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
* [Setting up local testbed](#local-testbed-setup)
* [Capturing ESX Code Coverage](#capturing-esx-code-coverage)
* [Bug filing guidelines](#bug-filing-guidelines)
* [Testing on CI](#testing-on-ci-system)
* [Current CI setup](#ci-system)
* [Testing on CI](#cicd-system)
* [Cutting a new release guidelines](#cutting-a-new-release-guidelines)
* [Tagging a release](#tag-a-release)
* [Generating change log](#generate-the-change-log)
Expand Down Expand Up @@ -233,93 +232,6 @@ git commit -m "Added new dependency go-plugins-helpers"
exit
```

## Testing on CI system

The work flow for testing proposed code looks like this

- Each checkin into a branch on the official repo will run the full set of
tests.

- On Pull Requests the full set of tests will be run.
- The logs for the build and test will be posted to the CI server.
- Due to security concerns the artifacts will not be published.
https://github.com/drone/drone/issues/1476

- Each commit into the master operation will run the full set of tests
part of the CI system.
- On success a docker image consisting of only the shippable docker
plugin is posted to docker hub. The image is tagged with latest
(and `<branch>-<build>`). Any one can pull this image and run it to
use the docker plugin.

A typical workflow for a developer should be.

- Create a branch, push changes and make sure tests do not break as reported
by the CI system.
- When ready post a PR. This will trigger a full set of tests on ESX. After all
the tests pass and the review is complete the PR will be merged in. If the PR
depends on new code checked into master, merge in the changes as a rebase and
push the changes to the branch.
- When there is a failure unrelated to your PR, you may want to *Restart* the failed CI run instead of pushing dummy commit to trigger CI run.
- When the PR is merged in the CI system will re-run the tests against the master.
On success a new Docker image will be ready for customers to deploy (This is only
for the docker plugin, the ESX code needs to be shipped separately).

## CI System

We are using the CI system that has been up by the CNA folks (@casualjim, @frapposelli & @mhagen-vmware).
The CI system is based on https://drone.io/ URL for the server is https://ci.vmware.run/
To be able to change the integration between CI and GitHub, first become admin using the self serve portal.

Behind the firewall there is a HW node running ESX that hosts 2 ESX VMs (v6.0u2 and v6.5). Each VM in turn contains a VSAN datastore as well as a VMFS datastore with 2 VMs per datastore (VMs are reused to form swarm cluster). CI testbed is also configured to have swarm cluster and there 3 VMs participating into the swarm cluster (2 VMs created on vmfs datastore and 1 VM created on vsan datastore).

There is a webhook setup between github repo and the CI server. The CI server uses
.drone.yml file to drive the CI workflow.

The credentials for Docker Hub deployment is secured using http://readme.drone.io/usage/secrets/

### Running CI/CD on a dev setup
Each developer can run tests part of the CI/CD system locally in their sandbox. This section describes how to configure your development setup for running CI/CD. If you are looking for configuring local testbed setup, **please refer** [Setting up local testbed](#local-testbed-setup).

* Setup:
The current CI/CD workflow assumes that the testbed consists of:
- One ESX
- 3 Linux VMs running on the same datastore in the ESX.

* Install [Drone CLI](https://github.com/drone/drone-cli)
```
curl http://downloads.drone.io/drone-cli/drone_linux_amd64.tar.gz | tar zx
sudo install -t /usr/local/bin drone
```

* If not already done, checkout source code in $GOPATH
```
mkdir -p $GOPATH/src/github.com/vmware
cd $GOPATH/src/github.com/vmware
git clone https://github.com/vmware/docker-volume-vsphere.git
```

* Setup ssh keys on linux nodes & ESX

Linux:
```
export NODE=root@10.20.105.54
cat ~/.ssh/id_rsa.pub | ssh $NODE "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
```

ESX:
```
cat ~/.ssh/id_rsa.pub | ssh $NODE " cat >> /etc/ssh/keys-root/authorized_keys"
```
Test SSH keys, login form the drone node should not require typing in a password.

* Run drone exec

```
cd $GOPATH/src/github.com/vmware/docker-volume-vsphere/
drone exec --trusted --yaml .drone.dev.yml -i ~/.ssh/id_rsa -e VM1=<ip VM1> -e VM2=<ip VM2> -e ESX=<ip ESX>
```

## Capturing ESX Code Coverage
Coverage is captured using make coverage target (On CI it is called using drone script).
User can configure the setup and use this target to see the coverage.
Expand Down Expand Up @@ -348,6 +260,11 @@ source=/usr/lib/vmware/vmdkops
```
COVERAGE_PROCESS_START DEFAULT=/coverage.rc
```

## CI/CD System

The CI/CD system is based on [Drone platform](https://drone.io/) and the server is https://ci.vmware.run/. More information is found at our [CI.md](https://github.com/vmware/docker-volume-vsphere/blob/master/CI.md)

## Cutting a new release guidelines

Once a release has been tagged, the CI system will start a build and push the binaries to GitHub Releases page. Creating the release on GitHub is a manual process but the binaries for it will be auto generated.
Expand Down

0 comments on commit c55efbf

Please sign in to comment.