Skip to content

Commit

Permalink
feat: support x-pathwar from docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jul 28, 2020
1 parent 031d81a commit 6382783
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 340 deletions.
22 changes: 11 additions & 11 deletions api/pwdb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;

message Challenge {
int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\" yaml:\"id,omitempty\"", (gogoproto.customname) = "ID"];
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"created_at,omitempty\""];
google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"updated_at,omitempty\""];

string name = 100;
string description = 101;
Expand All @@ -26,13 +26,13 @@ message Challenge {
// AuthorProfile
// repeated string tags = ;

repeated ChallengeFlavor flavors = 200 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""];
repeated ChallengeFlavor flavors = 200 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\" yaml:\"flavors,omitempty\""];
}

message ChallengeFlavor {
int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\" yaml:\"id,omitempty\"", (gogoproto.customname) = "ID"];
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"created_at,omitempty\""];
google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"updated_at,omitempty\""];

string version = 100;
string changelog = 101;
Expand All @@ -46,10 +46,10 @@ message ChallengeFlavor {
string slug = 109 [(gogoproto.moretags) = "gorm:\"unique_index\""];
string body = 110;

Challenge challenge = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeID\""];
int64 challenge_id = 201 [(gogoproto.customname) = "ChallengeID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""];
repeated SeasonChallenge season_challenges = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false;foreignkey:FlavorID\""];
repeated ChallengeInstance instances = 203 [(gogoproto.moretags) = "gorm:\"PRELOAD:false;foreignkey:FlavorID\""];
Challenge challenge = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeID\" yaml:\"challenge,omitempty\""];
int64 challenge_id = 201 [(gogoproto.customname) = "ChallengeID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\" yaml:\"challenge_id,omitempty\""];
repeated SeasonChallenge season_challenges = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false;foreignkey:FlavorID\" yaml:\"season_challenges,omitempty\""];
repeated ChallengeInstance instances = 203 [(gogoproto.moretags) = "gorm:\"PRELOAD:false;foreignkey:FlavorID\" yaml:\"instances,omitempty\""];
//repeated ChallengeSubscription subscriptions = 203 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""];

enum Driver {
Expand Down
6 changes: 3 additions & 3 deletions challenges/challenge.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ pathwar.ps:
docker.build:
docker-compose build --pull

.PHONY: pathwar-prepare
.PHONY: pathwar.prepare
pathwar.prepare:
pathwar $(PATHWAR_OPTS) compose prepare --prefix=$(PREFIX) --no-push .
pathwar $(PATHWAR_OPTS) compose prepare --prefix=$(PREFIX) --no-push . > pathwar-compose.yml

.PHONY: pathwar-push
.PHONY: pathwar.push
pathwar.push:
pathwar $(PATHWAR_OPTS) compose prepare --prefix=$(PREFIX) .

Expand Down
2 changes: 1 addition & 1 deletion docs/gen.sum

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

2 changes: 1 addition & 1 deletion go/gen.sum

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

5 changes: 5 additions & 0 deletions go/pkg/pwcompose/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import (
"fmt"

"github.com/docker/docker/api/types"
"pathwar.land/pathwar/v2/go/pkg/pwdb"
)

type config struct {
Version string
Networks map[string]network
Volumes map[string]volume
Services map[string]Service
XPathwar struct {
Challenge pwdb.Challenge `yaml:"challenge"`
Flavor pwdb.ChallengeFlavor `yaml:"flavor"`
} `yaml:"x-pathwar"`
}

type network struct {
Expand Down
Loading

0 comments on commit 6382783

Please sign in to comment.