Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy RX CLI Install #87

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/vendor/*
debug
radix-cli
rx
rx-test
/rx
/rx-test
.idea/
.dccache
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
builds:
- id: rx
binary: rx
main: ./cli/rx

env:
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY . /app
RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix

# Build
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx ./cli/rx

## Run operator
FROM scratch
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Radix CLI in the [Radix documentation](https://radix.equinor.com/docs/topic-radi

## Installation

### If using Go:
```sh
go install github.com/equinor/radix-cli/cli/rx@latest
```

### Linux or Mac

#### Binaries
Expand Down Expand Up @@ -166,7 +171,7 @@ We are making releases available as GitHub releases using [go-releaser](https://
To generate a local version for debugging purposes, it can be built using:

```
CGO_ENABLED=0 GOOS=darwin go build -ldflags "-s -w" -a -installsuffix cgo -o ./rx
CGO_ENABLED=0 GOOS=darwin go build -ldflags "-s -w" -a -installsuffix cgo -o ./rx ./cli/rx
```

### Security
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime/debug"
"strings"
"time"

Expand Down Expand Up @@ -38,6 +39,15 @@ func Execute() {
}
}

func init() {
if Version == "dev" {
if info, ok := debug.ReadBuildInfo(); ok {
Version = info.Main.Version
rootCmd.Version = info.Main.Version
}
}
}

func setVerbosePersistentFlag(cmd *cobra.Command) *bool {
return cmd.PersistentFlags().Bool(flagnames.Verbose, false, "Verbose output")
}
Expand Down
Loading