Skip to content

Commit

Permalink
Provide plug-in point for alternative version schemes (#15)
Browse files Browse the repository at this point in the history
* Provide plug-in point for alternative version schemes
  • Loading branch information
timperrett authored Oct 14, 2018
1 parent b2ac779 commit e105368
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,19 @@ cd $GOPATH && \
git clone git@github.com:getnelson/slipway.git github.com/getnelson/slipway
```

Next, install the tools `slipway` needs to build:
Next, install the tools `slipway` needs to build and generate the protobuf (as a one-time operation)

```
make tools
make deps.install
make generate
```

Generate the protobuf (as a one-time operation) and then build:
Finally, execute the build and test:

```
make generate && \
make build && \
make test
```

The slipway binary will then be available in `./bin/slipway`


8 changes: 4 additions & 4 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@ func getUnitNameFromDockerContainer(ctr string) (a string, b string) {
* Given a docker tag like 1.23.45 create a typed protobuf nelson.Version
* representation which can be used with v2 APIs
*/
func versionFromTag(tagged string) (v *nelson.Version, errs []error) {
func versionFromTag(tagged string) (v *nelson.SemanticVersion, errs []error) {
arr := strings.Split(tagged, ".")
if len(arr) > 3 {
errs = append(errs, errors.New("The supplied version string '"+tagged+"' should follow semver, and be composed of three components. E.g. 1.20.49"))
return &nelson.Version{}, errs
return &nelson.SemanticVersion{}, errs
}

se, _ := strconv.ParseInt(arr[0], 10, 32)
fe, _ := strconv.ParseInt(arr[1], 10, 32)
pa, _ := strconv.ParseInt(arr[2], 10, 32)

return &nelson.Version{Series: int32(se), Feature: int32(fe), Patch: int32(pa)}, nil
return &nelson.SemanticVersion{Major: int32(se), Minor: int32(fe), Patch: int32(pa)}, nil
}

/* lift the old three-param behavior into the new v2 typed nelson.Deployable */
Expand All @@ -133,7 +133,7 @@ func newProtoDeployable(imageUri string, unitName string, tag string) (*nelson.D

return &nelson.Deployable{
UnitName: unitName,
Version: v,
Version: &nelson.Deployable_Semver{v},
Kind: &nelson.Deployable_Container{
&nelson.Container{
Image: imageUri,
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import:
- package: gopkg.in/yaml.v2
version: a5b47d31c556af34a302ce5d659e6fea44d90de0
- package: github.com/getnelson/api
version: 5bdf591afeae6880f49b2026e1975af5a2050ecb
version: b34ae15e3411689955977de715a10d5bd2901de5
subpackages:
- protobuf
- package: github.com/gogo/googleapis

0 comments on commit e105368

Please sign in to comment.