Skip to content

Commit

Permalink
update cmp plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
nxcc committed Feb 3, 2023
1 parent 2995822 commit f421916
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile-cmp
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X 'main.build=$VER
RUN sed "s/VERSION/$VERSION/g" docker/plugin.yaml > plugin.yaml

FROM gcr.io/distroless/static-debian11
COPY --from=builder /go/src/app/cuegen /opt/bin/cuegen
COPY --from=builder /go/src/app/cuegen /bin/cuegen
COPY --from=builder /go/src/app/plugin.yaml /home/argocd/cmp-server/config/plugin.yaml
7 changes: 3 additions & 4 deletions docker/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ metadata:
name: cuegen
spec:
version: VERSION
init:
command: ["/opt/bin/cuegen", "version"]
generate:
command: ["/opt/bin/cuegen", "."]
command: ["/bin/cuegen", "."]
discover:
fileName: "cuegen.yaml"
find:
command: ["/bin/cuegen", "-is-cuegen-dir"]
9 changes: 3 additions & 6 deletions internal/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ func Main() int {
fmt.Println("true")
return 0
}
fmt.Println("false")
return 1
return 0
}

// check args
Expand Down Expand Up @@ -151,8 +150,7 @@ func loadConfig(path string) (string, cuegen.Config, error) {
}
}

// loadYamlConfig loads the cuegen config. When a directory is passed, cuegen will
// look for the default "cuegen.yaml" in that directory.
// loadYamlConfig loads the cuegen config
func loadYamlConfig(file string) (string, cuegen.Config, error) {
fh, err := os.Open(file)
if err != nil {
Expand All @@ -170,8 +168,7 @@ func loadYamlConfig(file string) (string, cuegen.Config, error) {
//go:embed schema.cue
var cuegenConfigSchema []byte

// loadCueConfig loads the cuegen config. When a directory is passed, cuegen will
// look for the default "cuegen.cue" in that directory.
// loadCueConfig loads the cuegen config
func loadCueConfig(file string) (string, cuegen.Config, error) {
config := struct{ Cuegen cuegen.Config }{}
if err := cueconfig.Load(file, cuegenConfigSchema, nil, nil, &config); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions tests/local/cmp-is-cuegen-dir.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ stdout true

# .txt
cd $WORK/chart3
! exec cuegen -is-cuegen-dir
stdout false
exec cuegen -is-cuegen-dir
stdout '^$'

-- chart1/cuegen.cue --
-- chart2/cuegen.yaml --
Expand Down

0 comments on commit f421916

Please sign in to comment.