Skip to content

Latest commit

 

History

History
180 lines (125 loc) · 5.12 KB

POC.md

File metadata and controls

180 lines (125 loc) · 5.12 KB

Introduction

Forjj is the New Power DevOps solution to build and maintain a complete DevOps solution, integrating SCM/CI/ChatOps/CD all with your preferred toolset.

Forjj has been designed to be widely opened to contribution.

  • Forjj plugins

    Any pieces to build a solution with integration are stored in forjj-contribs repository as a forjj plugin. For example, ci/jenkins is a plugin which contains code to create/manage a jenkins instance and jobs. See jenkins forjj plugin See contribution page to get plugins details

  • Forjj core (this project)

    Forjj core is a GO binary. It contains code to:

    • automate the DevOs solution creation from a solution description data.
    • store source code in git repositories.
    • create a demo project
    • enhance solution, in scaling, or any other infrastructure update.
    • repositories management

    Forjj core could be expanded with a web ui to:

    • expose options of plugins
    • assist in project management (creation/update/delete)
    • assist in solution infrastructure management (scale/changes)

Project status:

  • Partially completed - the infra repository, myforj-infra, with the infra code to create/maintain it, pushed to github.
    • DONE github: forjj driver to help forjj to interact with github service
    • CLOSED to DONE jenkins: forjj driver to help forjj to create a jenkins instance as code and apply it with maintain.
  • NOT STARTED - a demo repository, pushed to github.
  • IN PROGRESS - a new jenkins instance in your workstation.
  • IN PROGRESS - integration between github and jenkins (7 jobs)

How to build it? How to test it?

Today, there is 3 components to build:

  • forjj (this project)
  • forjj github (plugin)
  • forjj jenkins (plugin)

Build forjj

Requirement:

  • docker 1.10 or higher
  • git
  • bash

Optional:

  • go 1.5 or higher - by default, we use docker to build with GO 1.7
  • glide 0.12.1 or higher - by default, we use docker to install deps
  1. Create (or use) your GO Path environment
export GOPATH=~/src/go && mkdir $GOPATH/src # if you want to create it
cd $GOPATH/src
  1. Clone your fork (or https://github.com/forj-oss/forjj)
git clone https://github.com/<MyName>/forjj
cd forjj
  1. If you want to use docker to build, load the build environment.
source build-env.sh $GOPATH

If docker is accessible using sudo, do the following instead:

source build-env.sh --sudo $GOPATH

Note: This build environment creates aliases to do go and glide transparently from a docker container, exactly like go and glide would be installed on your workstation.

So, you will be able to call directly go or glide from command line.

build-env.sh script add 2 aliases to your ~/.bashrc called build-env and build-env-unset

Use build-env-unset to unload the build environment

Use build-env to load a project build environment like forjj. Note that this script will simply execute source build-env.sh for you. As soon as you have defined the GOPATH variable, you could build forjj as follow:

You can also use a dynamic prompt to keep you informed about which build environment is loaded. See #Build_environment.

create-build-env.sh (located in bin/) will create a docker image with golang 1.7 and glide. See build env Dockerfile

  1. Install project dependencies with glide
glide i
  1. Install forjj
go install

Now, forjj should work:

$GOPATH/bin/forjj

Build plugins

  1. Cloning forjj-contribs
cd ~/src/go/src
git clone https://github.com/forj-oss/forjj-contribs
  1. Build github plugin
cd ~/src/go/src/forjj-contribs/upstream/github
go generate
bin/build.sh

Now, a new docker image has been generated, called docker.io/forjj/github

  1. BUild jenkins plugin
cd ~/src/go/src/github.com/forj-oss/forjj-contribs/ci/jenkins
go generate
bin/build.sh

Now, a new docker image has been generated, called docker.io/forjj/jenkins

So, now you can start playing with forjj.

Testing forjj

We can create thing, step by step. Like create a basic workspace.

Ex: Create a basic workspace:

# Create an empty workspace.
forjj create ~/tmp/forjj
# Create a worspace
# create source code for github
# write github source code, add and commit it
# Instantiate github configuration as described by the generated code.
forjj create ~/tmp/forjj --debug --apps ci:jenkins,upstream:github --github-token $GITHUB_TOKEN --github-server github.com --jenkins-service-addr maison.emea.hpqcorp.net --docker-exe-path ~/tmp/docker
# Create a worspace
# create source code for github
# write github source code, add and commit it
# Instantiate github configuration as described by the generated code.
forjj create ~/tmp/forjj --debug --apps ci:jenkins,upstream:github --github-token $GITHUB_TOKEN --github-server github.com --jenkins-service-addr maison.emea.hpqcorp.net --docker-exe-path ~/tmp/docker