Skip to content

Commit

Permalink
Fixes 'popper workflow' issue with missing stage files
Browse files Browse the repository at this point in the history
The command assumed that a stage file always exist. We know skip
generating a call graph for missing stage files.
  • Loading branch information
ivotron committed Jan 7, 2018
1 parent cfd76b3 commit 098b8c5
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 36 deletions.
72 changes: 44 additions & 28 deletions docs/ci/popperci.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,6 @@ status' is `GOLD`, the status of all validations is `PASS`. When the
pipeline runs correctly but one or more validations fail (pipeline's
status is `PASS`), the status of one or more validations is `FAIL`.

## Popper Badges

We maintain a badging service that can be used to keep track of the
status of a pipeline. In order to enable this, the `--enable-badging`
flag has to be passed to the `popper ci` subcommand.

![Badging service.](/figures/cibadges.png)

Badges are commonly used to denote the status of a software project
with respect to certain aspect, e.g. whether the latest version can be
built without errors, or the percentage of code that unit tests cover
(code coverage). Badges available for Popper are shown in the above
figure. If badging is enabled, after the execution of a pipeline, the
status of a pipeline is recorded in the badging server, which keeps
track of statuses for every revision of ever pipeline.

Users can include a link to the badge in the `README` page of a
pipeline, which can be displayed on the web interface of the version
control system (GitHub in this case). The CLI tool can generate links
for pipelines:

```bash
popper badge <exp>
```

Which prints to `stdout` the text that should be added to the `README`
file of the pipeline.

## Testing Locally

The
Expand Down Expand Up @@ -193,3 +165,47 @@ popper_logs/
├── validate.sh.out
└── validate.sh.err
```

These files are added to the
[`.gitignore`](https://help.github.com/articles/ignoring-files/) file
so they won't be committed to the git repository when doing `git add`.
To quickly remove them, one can clean the working tree:
```bash
# get list of files that would be deleted
# include directories (-d)
# include ignored files (-x)
git clean -dx --dry-run
# remove --dry-run and add --force to actually delete files
git clean -dx --force
```
## Popper Badges
We maintain a badging service that can be used to keep track of the
status of a pipeline. In order to enable this, the `--enable-badging`
flag has to be passed to the `popper ci` subcommand.
![Badging service.](/figures/cibadges.png)
Badges are commonly used to denote the status of a software project
with respect to certain aspect, e.g. whether the latest version can be
built without errors, or the percentage of code that unit tests cover
(code coverage). Badges available for Popper are shown in the above
figure. If badging is enabled, after the execution of a pipeline, the
status of a pipeline is recorded in the badging server, which keeps
track of statuses for every revision of ever pipeline.
Users can include a link to the badge in the `README` page of a
pipeline, which can be displayed on the web interface of the version
control system (GitHub in this case). The CLI tool can generate links
for pipelines:
```bash
popper badge <exp>
```
Which prints to `stdout` the text that should be added to the `README`
file of the pipeline.
7 changes: 3 additions & 4 deletions docs/protocol/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ artifacts following a [DevOps](https://en.wikipedia.org/wiki/DevOps)
approach, with the goal of making it easy for others (and yourself!)
to repeat an experiment or analysis pipeline.

## Quickstart Guide

We first need to install the CLI tool by following [these
instructions](https://github.com/systemslab/popper/tree/master/popper#install).
Show the available commands:
Expand All @@ -21,7 +19,7 @@ Show which version you installed:
popper version
```

> **NOTE**: this exercise was written using 0.4.1.
> **NOTE**: this exercise was written using 0.5
Create a project repository (if you are not familiar with git, look [here](https://www.learnenough.com/git-tutorial)):

Expand All @@ -34,7 +32,8 @@ git add .
git commit -m 'first commit'
```

Initialize the popper repository and add the commit file to git:
Initialize the popper repository and add the `.popper.yml` file to
git:

```bash
popper init
Expand Down
2 changes: 1 addition & 1 deletion popper/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func getPipelineName() (expName string, err error) {

func ensureInRootFolder() {
if !sh.Test("dir", "pipelines") {
log.Fatalln("Can't find pipelines/ folder in current directory.")
log.Fatalln("Can't find pipelines/ folder in current directory. 'cd' to root of project.")
}
}

Expand Down
8 changes: 6 additions & 2 deletions popper/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"strings"

sh "github.com/codeskyblue/go-sh"
"github.com/spf13/cobra"
"mvdan.cc/sh/syntax"
)
Expand Down Expand Up @@ -68,7 +69,7 @@ func getDotGraphForStage(pipelinePath, stageFile, previousStageFile string) (dot

// first comment in a script goes in the root of that stage
if _, present := nodesInGraph[hashIt(stage)]; !present {
dot += fmt.Sprintf(" %s [shape=record,label=\"{%s|%s}\"];\n", stage, stageFile, label)
dot += fmt.Sprintf(" %s [shape=record,style=filled,label=\"{%s|%s}\"];\n", stage, stageFile, label)

if len(previousStageFile) > 0 {
previous := strings.Replace(previousStageFile, ".sh", "", -1)
Expand Down Expand Up @@ -97,7 +98,7 @@ func getDotGraphForStage(pipelinePath, stageFile, previousStageFile string) (dot
}
break
}
label = cmdValue + ":" + label
label = cmdValue + ": " + label
case *syntax.ForClause:
label = "loop: " + label
case *syntax.WhileClause:
Expand Down Expand Up @@ -145,6 +146,9 @@ func getDotGraph(pipelinePath string, stages []string) (dot string, err error) {

for _, stage := range stages {

if !sh.Test("f", pipelinePath+"/"+stage) {
continue
}
if subdot, err := getDotGraphForStage(pipelinePath, stage, previousStage); err != nil {
return "", err
} else {
Expand Down
2 changes: 1 addition & 1 deletion popper/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

var versionId = "0.5"
var versionId = "0.5.1"

var versionCmd = &cobra.Command{
Use: "version",
Expand Down

0 comments on commit 098b8c5

Please sign in to comment.