Skip to content

Commit b68de30

Browse files
authored
Merge pull request #321 from onepanelio/dev
chore: dev > master (v0.10.0)
2 parents dedc295 + facbed5 commit b68de30

27 files changed

+1285
-150
lines changed

.github/workflows/push_develop_branch.yaml renamed to .github/workflows/push_dev_branch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Publish develop docker image
1+
name: Publish dev docker image
22
on:
33
push:
44
branches:
5-
- develop
5+
- dev
66
jobs:
77
build:
88
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Make sure that your `$GOBIN` is in your `$PATH`.
4949

5050
Generate Go and Swagger APIs:
5151
```bash
52-
make api
52+
make api version=1.0.0
5353
```
5454

5555
## Minikube Debugging and Development
@@ -122,6 +122,8 @@ After this, build main.go and run the executable.
122122

123123
## Code Structure & Organization
124124

125+
### `utils` dir
126+
125127
```shell script
126128
utils/*.go
127129
```
@@ -150,4 +152,25 @@ These can be pulled out into their own package or into a new v2 directory if nee
150152
You can add
151153
- kubernetes specific operations
152154
- database specific operations
153-
- types
155+
- types
156+
157+
### `cmd` dir
158+
Each source file here is assumed to result in an executable.
159+
- Hence the `package main` at the top of each
160+
161+
Place each source file into it's own folder.
162+
Example source file name: `flush_cache.go`
163+
- Dir structure: `cmd/flush-cache/flush_cache.go`
164+
165+
To avoid errors like this during docker build
166+
```text
167+
# github.com/onepanelio/core/cmd
168+
cmd/goose.go:22:6: main redeclared in this block
169+
previous declaration at cmd/gen-release-md.go:136:6
170+
github.com/onepanelio/core
171+
```
172+
Caused by
173+
```dockerfile
174+
RUN go install -v ./...
175+
```
176+

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ COPY . .
55

66
RUN go get -d -v ./...
77
RUN go install -v ./...
8-
8+
RUN go get -u github.com/pressly/goose/cmd/goose
9+
RUN go build -o /go/bin/goose ./cmd/goose/goose.go
910

1011
FROM golang:1.13.10
1112
COPY --from=builder /go/bin/core .
1213
COPY --from=builder /go/src/db ./db
14+
COPY --from=builder /go/bin/goose .
1315

1416
EXPOSE 8888
1517
EXPOSE 8887

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
COMMIT_HASH=$(shell git rev-parse --short HEAD)
22

3+
.PHONY: init
4+
5+
init:
6+
ifndef version
7+
$(error version is undefined)
8+
endif
9+
310
jq:
411
cat api/apidocs.swagger.json \
512
| jq 'walk( if type == "object" then with_entries( .key |= sub( "api\\."; "") ) else . end )' \
613
| jq 'walk( if type == "string" then gsub( "api\\."; "") else . end )' \
14+
| jq '.info.version = "$(version)"' \
715
> api/api.swagger.json
816
rm api/apidocs.swagger.json
917

@@ -16,7 +24,7 @@ protoc:
1624
--grpc-gateway_out=logtostderr=true,allow_delete_body=true:api \
1725
--swagger_out=allow_merge=true,fqn_for_swagger_name=true,allow_delete_body=true,logtostderr=true,simple_operation_ids=true:api
1826

19-
api: protoc jq
27+
api: init protoc jq
2028

2129
docker-build:
2230
docker build -t onepanel-core .

api/api.pb.go

Lines changed: 17 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/api.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import "protoc-gen-swagger/options/annotations.proto";
66

77
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
88
info: {
9-
title: "Onepanel Core";
10-
description: "Onepanel Core project API";
11-
version: "1.0.0-beta1";
9+
title: "Onepanel";
10+
description: "Onepanel API";
11+
version: "0.10.0";
1212
contact: {
13-
name: "Onepanel Core project";
13+
name: "Onepanel project";
1414
url: "https://github.com/onepanelio/core";
1515
};
1616
};

api/api.swagger.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"swagger": "2.0",
33
"info": {
4-
"title": "Onepanel Core",
5-
"description": "Onepanel Core project API",
6-
"version": "1.0.0-beta1",
4+
"title": "Onepanel",
5+
"description": "Onepanel API",
6+
"version": "0.10.0",
77
"contact": {
8-
"name": "Onepanel Core project",
8+
"name": "Onepanel project",
99
"url": "https://github.com/onepanelio/core"
1010
}
1111
},
@@ -3167,6 +3167,9 @@
31673167
"createdAt": {
31683168
"type": "string"
31693169
},
3170+
"modifiedAt": {
3171+
"type": "string"
3172+
},
31703173
"uid": {
31713174
"type": "string"
31723175
},

api/workflow_template.pb.go

Lines changed: 32 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/workflow_template.proto

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ message CronWorkflowStatisticsReport {
135135

136136
message WorkflowTemplate {
137137
string createdAt = 1;
138-
string uid = 2;
139-
string name = 3;
140-
int64 version = 4;
141-
int64 versions = 5;
142-
string manifest = 6;
143-
bool isLatest = 7;
144-
bool isArchived = 8;
145-
repeated KeyValue labels = 9;
146-
147-
WorkflowExecutionStatisticReport stats = 10;
148-
CronWorkflowStatisticsReport cronStats = 11;
149-
138+
string modifiedAt = 2;
139+
string uid = 3;
140+
string name = 4;
141+
int64 version = 5;
142+
int64 versions = 6;
143+
string manifest = 7;
144+
bool isLatest = 8;
145+
bool isArchived = 9;
146+
repeated KeyValue labels = 10;
147+
148+
WorkflowExecutionStatisticReport stats = 11;
149+
CronWorkflowStatisticsReport cronStats = 12;
150150
}
151151

152152
message GetWorkflowTemplateLabelsRequest {

cmd/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Helper scripts
2+
3+
## gen-release-md.go
4+
Generates markdown for releases.
5+
6+
Usage:
7+
```bash
8+
go run cmd/gen-release-md/gen-release-md.go -v=0.10.0 > /tmp/release.md
9+
```
10+
11+
## goose.go
12+
Supports both Go and SQL migrations.
13+
14+
```bash
15+
go run cmd/goose/goose up # run up migrations
16+
go run cmd/goose/goose down # run down migrations
17+
```

0 commit comments

Comments
 (0)