= Fabric8 Work Item Tracker :toc: :toc-placement: preamble :sectnums: :experimental:
image:https://ci.centos.org/buildStatus/icon?job=devtools-fabric8-wit-build-master[Jenkins,link="https://ci.centos.org/view/Devtools/job/devtools-fabric8-wit-build-master/lastBuild/"] image:https://goreportcard.com/badge/github.com/fabric8-services/fabric8-wit[Go Report Card, link="https://goreportcard.com/report/github.com/fabric8-services/fabric8-wit"] image:https://godoc.org/github.com/fabric8-services/fabric8-wit?status.png[GoDoc,link="https://godoc.org/github.com/fabric8-services/fabric8-wit"] image:https://codecov.io/gh/fabric8-services/fabric8-wit/branch/master/graph/badge.svg[Codecov.io,link="https://codecov.io/gh/fabric8-services/fabric8-wit"]
Work Items describe and keep track of work that needs to be done. A user can be assigned to a Work Item. Each Work Item must be attached to a Collaboration Space and an Area (assigned by default). This can be used to model bugs, tasks, features, ideas, and more.
== Building from source [[building]]
The following guide is mainly targeted towards a Linux or Mac OSX development machine. If you are on Windows, we recommend to take a look at link:docs/development/getting-started-win.adoc[Getting started with fabric8-wit development on Windows].
=== Prerequisites [[prerequisites]]
You need to install:
go
(>= v1.8)git
mercurial
make
==== Check your Go version [[check-go-version]]
Run the following command to find out your Go version.
You must at least have Go version 1.8.
See <
==== Install dep [[dep-setup]]
This project uses https://github.com/golang/dep[dep] as a package manager for Go.
Running the make deps
command will install dep
in $GOPATH/bin
if it's not already available on your system.
=== Get the code [[get-the-code]]
Assuming you have Go installed and configured (have $GOPATH
setup and
pointing to a single directory) here is how to build.
Check out the code
=== Build [[build]]
Like most other projects, this one depends on various other projects that need to be downloaded.
We also generate some code from design files that shall make it into our final artifacts.
To fetch the dependencies, generate code and finally build the project you can
type make
in a freshly clone repository of this project.
==== Special make targets
There is no need to fetch the dependencies, or re-generate code every time you
want to compile. That's why we offer special make
targets for these topics:
===== Fetch dependencies [[fetch-dependencies]]
This will download all the dependencies for this project inside a directory
called vendor
. This way we can ensure that every developer and our CI system
is using the same version.
For dependency management of go
packages we use https://github.com/golang/dep[`dep]. The file
Gopkg.toml` contains all dependencies. If you want to
understand the format for this file, look link:https://golang.github.io/dep/docs/Gopkg.toml.html[here].
===== Generate GOA sources [[generate-code]]
You need to run this command if you just checked out the code and later if you've modified the designs.
===== Build [[build]]
If you want to just build the ALM server and client, run make build
.
===== Clean [[clean]]
This removes all downloaded dependencies, all generated code and compiled artifacts.
===== Tests [[test]]
Here's how to run all available tests. All tests will check all Go packages
except those in the vendor/
directory.
Make sure you have docker and docker-compose available.
Setting up test environment - make integration-test-env-prepare
Tear test environment down - make integration-test-env-tear-down
docker-compose up -d db
.
+===== Coverage [[coverage]]
To visualize the coverage of unit, integration, or all tests you can run these commands:
$ make coverage-unit
$ make coverage-integration
$ make coverage-all
NOTE: If the tests (see <
Each of the above tests (see <
Here's how the
[horizontal]
<package>
::
something like github.com/fabric8-services/fabric8-wit/models
<test>
::
unit
or integration
<mode>
::
Sets the mode for coverage analysis for the packages being tested.
Possible values for <mode>
are set (the default), count, or atomic and
they directly relate to the output of go test --help
.
In addition to all individual coverage information for each package, we also create three more files:
[horizontal]
tmp/coverage.unit.mode-<mode>
::
This file collects all the coverage profiles for all unit tests.
tmp/coverage.integration.mode-<mode>
::
This file collects all the coverage profiles for all integration tests.
tmp/coverage.mode-<mode>
::
This file is the merge result of the two afore mentioned files and thus gives
coverage information for all tests.
== Build through minishift
There is a separate documentation for https://github.com/fabric8-services/fabric8-wit/blob/master/minishift/README.adoc[building WIT using minishift]
== Configuration file
If no configuration file is specified when the core is started, these are the defaults.
postgres.host: localhost postgres.port: 5432 postgres.user: postgres postgres.password: mysecretpassword postgres.database: postgres postgres.sslmode: disable
postgres.connection.timeout: 5
postgres.connection.retrysleep: 1s
http.address: 0.0.0.0:8080
developer.mode.enabled: false
populate.commontypes: true
token.privatekey : > -----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAnwrjH5iTSErw9xUptp6QSFoUfpHUXZ+PaslYSUrpLjw1q27O DSFwmhV4+dAaTMO5chFv/kM36H3ZOyA146nwxB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1SxoycNRM4peGJB1nWJydEl8RajcRwZ6U+zeOc+OfWbH WUFuLadlrEx5212CQ2k+OZlDAoGAdsH2w6kZ83xCFOOv41ioqx5HLQGlYLpxfVg+ 2gkeWa523HglIcdPEghYIBNRDQAuG3RRYSeW+kEy+f4Jc2tHu8bS9FWkRcsWoIji ZzBJ0G5JHPtaub6sEC6/ZWe0F1nJYP2KLop57FxKRt0G2+fxeA0ahpMwa2oMMiQM 4GM3pHUCgYEAj2ZjjsF2MXYA6kuPUG1vyY9pvj1n4fyEEoV/zxY1k56UKboVOtYr BA/cKaLPqUF+08Tz/9MPBw51UH4GYfppA/x0ktc8998984FeIpfIFX6I2U9yUnoQ OCCAgsB8g8yTB4qntAYyfofEoDiseKrngQT5DSdxd51A/jw7B8WyBK8= -----END RSA PRIVATE KEY-----
token.publickey : > -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnwrjH5iTSErw9xUptp6Q SFoUfpHUXZ+PaslYSUrpLjw1q27ODSFwmhV4+dAaTMO5chFv/kM36H3ZOyA146nw xBobS723okFaIkshRrf6qgtD6coTHlVUSBTAcwKEjNn4C9jtEpyOl+eSgxhMzRH3 bwTIFlLlVMiZf7XVE7P3yuOCpqkk2rdYVSpQWQWKU+ZRywJkYcLwjEYjc70AoNpj O5QnY+Exx98E30iEdPHZpsfNhsjh9Z7IX5TrMYgz7zBTw8+niO/uq3RBaHyIhDbv enbR9Q59d88lbnEeHKgSMe2RQpFR3rxFRkc/64Rn/bMuL/ptNowPqh1P+9GjYzWm PwIDAQAB -----END PUBLIC KEY-----
github.client.id : 875da0d2113ba0a6951d github.secret : 2fe6736e90a9283036a37059d75ac0c82f4f5288
Although this is a YAML file, we highly suggest to stick to this rather lenghty notation instead of nesting structs.
To override configuration values using environment variables, use the prefix
F8_
and replace the dots in the variables names with underscores.
For example to override postgres.password
, set the environment variable F8_POSTGRES_PASSWORD
to the value of you liking.
NOTE: config.yaml is not processed by default. In order to use it, the following environment variable must be set export F8_CONFIG_FILE_PATH="config.yaml"
NOTE: Environment variables override the default values and the ones you've set in your config file.
==== Development
Only files +./*.go+
, +./design/*.go+
, +./models/*.go+
and +./tool/wit-cli/main.go+
should be edited.
These files and directory are generated:
./app/
./assets/js/
./client/
./swagger/
./tool/cli/
./bindata_asstfs.go
== Developer setup
Start up dependent docker services using docker-compose
and runs auto reload on source change tool fresh
.
The above steps start the API Server on port 8080.
Test out the build by executing CLI commands in a different terminal.
NOTE: The CLI needs the API Server which was started on executing make dev
to be up and running. Please do not kill the process. Alternatively if you haven't run make dev
you could just start the server by running ./bin/alm
.
Note the spaceID to be used in next request.
where baseType in the payload refer to a work item type.
=== Reset Database
The database are kept in a docker container that gets reused between restarts. Thus restarts will not clear out the database.
To clear out the database kill the database like this:
In case you have mulitple fabric8*
running use docker ps
to locate the container name.
== Debugging [[debug]]
System defined Work Item Types are
userstory
In response you should get ID of created item, using that you can retrieve the work item.
== Swagger API
A browsable documentation for our API is available with http://swagger.goa.design/?url=github.com%2Ffabric8-services%2Ffabric8-wit%2Fdesign[goa Swagger Generator]. It reflects the latest state of the master branch.
== Prod preview setup
In order to setup wit to work against link:https://prod-preview.openshift.io/[prod preview] the following environment variables must be set:
export F8_DEVELOPER_MODE_ENABLED=1
export F8_OPENSHIFT_TENANT_MASTERURL="https://console.free-stg.openshift.com/"
export F8_KEYCLOAK_REALM="fabric8"
export F8_CONFIG_FILE_PATH="config.yaml"
Also, F8_TENANT_SERVICEURL
env var must be set and point to the prod-preview link:https://github.com/fabric8-services/fabric8-tenant[fabric8-tenant] endpoint.
However, there is no publicly available route for it and one should oc login
to the prod-preview OpenShift Dedicated cluster and use
link:https://docs.openshift.com/enterprise/3.0/dev_guide/port_forwarding.html[port forwarding] for fabric8-tenant pod:
export F8_TENANT_SERVICEURL="http://localhost:<local-port>/"
== che-starter setup
link:https://github.com/redhat-developer/che-starter[che-starter] endpoint can be configure via the following environment variable:
export F8_CHESTARTERURL="http://localhost:10000/"