Skip to content

Commit 1dc0a29

Browse files
committed
Merge branch 'release-v0.8.0'
2 parents 973d705 + a12bb9c commit 1dc0a29

File tree

202 files changed

+8018
-1892
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+8018
-1892
lines changed

.github/workflows/cleanup.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: GCR Cleanup
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *' # Every day at midnight
5+
workflow_dispatch:
6+
jobs:
7+
cleanup:
8+
name: GCR Cleanup
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v3
13+
14+
- id: auth
15+
uses: google-github-actions/auth@v1
16+
with:
17+
credentials_json: ${{ secrets.GCR_SERVICE_ACCOUNT }}
18+
19+
- name: Setup Cloud SDK
20+
uses: google-github-actions/setup-gcloud@v1
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.10'
26+
27+
- name: Run Cleanup Script
28+
# Keep at least 3 images, delete images older than 168 hours (7 days)
29+
run: |
30+
python containers/cleangcr.py -y -k 3 -g 168

.github/workflows/containers.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- main
66
- develop
7+
- 'release-v*'
78
tags:
89
- 'v*'
910
pull_request:

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
env:
3939
GOPATH: ${{ github.workspace }}/go
4040
GOBIN: ${{ github.workspace }}/go/bin
41+
GOTEST_GITHUB_ACTIONS: 1
4142
defaults:
4243
run:
4344
working-directory: ${{ env.GOPATH }}/src/github.com/rotationalio/ensign

cmd/debug/main.go

Lines changed: 0 additions & 147 deletions
This file was deleted.

cmd/ensign/main.go

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import (
66
"fmt"
77
"log"
88
"os"
9+
"text/tabwriter"
910
"time"
1011

1112
"github.com/joho/godotenv"
13+
confire "github.com/rotationalio/confire/usage"
1214
"github.com/rotationalio/ensign/pkg"
1315
"github.com/rotationalio/ensign/pkg/ensign"
1416
api "github.com/rotationalio/ensign/pkg/ensign/api/v1beta1"
@@ -18,7 +20,6 @@ import (
1820
"google.golang.org/grpc/credentials"
1921
"google.golang.org/grpc/credentials/insecure"
2022
"google.golang.org/protobuf/encoding/protojson"
21-
"gopkg.in/yaml.v3"
2223
)
2324

2425
func main() {
@@ -37,29 +38,18 @@ func main() {
3738
Usage: "run the ensign server",
3839
Category: "server",
3940
Action: serve,
40-
Flags: []cli.Flag{
41-
&cli.StringFlag{
42-
Name: "bindaddr",
43-
Aliases: []string{"a"},
44-
Usage: "address to bind the ensign server to",
45-
},
46-
&cli.StringFlag{
47-
Name: "conf-file",
48-
Aliases: []string{"c"},
49-
Usage: "path to a configuration file on disk",
50-
},
51-
},
41+
Flags: []cli.Flag{},
5242
},
5343
{
5444
Name: "config",
55-
Usage: "inspect and validate the ensign configuration",
56-
Category: "ops",
57-
Action: inspectConfig,
45+
Usage: "print ensign configuration guide",
46+
Category: "utility",
47+
Action: usage,
5848
Flags: []cli.Flag{
59-
&cli.StringFlag{
60-
Name: "conf-file",
61-
Aliases: []string{"c"},
62-
Usage: "path to a configuration file on disk",
49+
&cli.BoolFlag{
50+
Name: "list",
51+
Aliases: []string{"l"},
52+
Usage: "print in list mode instead of table mode",
6353
},
6454
},
6555
},
@@ -96,19 +86,8 @@ func main() {
9686
func serve(c *cli.Context) (err error) {
9787
// Load the configuration from a file or from the environment.
9888
var conf config.Config
99-
if path := c.String("conf-file"); path != "" {
100-
if conf, err = config.Load(path); err != nil {
101-
return cli.Exit(err, 1)
102-
}
103-
} else {
104-
if conf, err = config.New(); err != nil {
105-
return cli.Exit(err, 1)
106-
}
107-
}
108-
109-
// Override configuration based on CLI flags
110-
if addr := c.String("bindaddr"); addr != "" {
111-
conf.BindAddr = addr
89+
if conf, err = config.New(); err != nil {
90+
return cli.Exit(err, 1)
11291
}
11392

11493
// Create and serve the Ensign server
@@ -127,23 +106,18 @@ func serve(c *cli.Context) (err error) {
127106
// Ops Commands
128107
//===========================================================================
129108

130-
func inspectConfig(c *cli.Context) (err error) {
131-
// Load the configuration from a file or from the environment.
132-
var conf config.Config
133-
if path := c.String("conf-file"); path != "" {
134-
if conf, err = config.Load(path); err != nil {
135-
return cli.Exit(err, 1)
136-
}
137-
} else {
138-
if conf, err = config.New(); err != nil {
139-
return cli.Exit(err, 1)
140-
}
109+
func usage(c *cli.Context) (err error) {
110+
tabs := tabwriter.NewWriter(os.Stdout, 1, 0, 4, ' ', 0)
111+
format := confire.DefaultTableFormat
112+
if c.Bool("list") {
113+
format = confire.DefaultListFormat
141114
}
142115

143-
// If the configuration is valid print it as YAML
144-
if err = yaml.NewEncoder(os.Stdout).Encode(&conf); err != nil {
145-
return err
116+
var conf config.Config
117+
if err := confire.Usagef("ensign", &conf, tabs, format); err != nil {
118+
return cli.Exit(err, 1)
146119
}
120+
tabs.Flush()
147121
return nil
148122
}
149123

0 commit comments

Comments
 (0)