Skip to content
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
11 changes: 6 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ^1.23
go-version-file: go.mod

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v9
with:
version: latest
skip-go-installation: true
args: "--build-tags server --timeout=10m --max-same-issues 20"
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
22 changes: 11 additions & 11 deletions .github/workflows/publish_container_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ jobs:

steps:
- name: backend repository
uses: actions/checkout@v4
uses: actions/checkout@v7

- uses: actions/setup-go@v4
- uses: actions/setup-go@v7
with:
go-version: ^1.23
go-version-file: go.mod

# - uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: actions/setup-node@v2
# - uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v4
- uses: actions/setup-node@v7
with:
node-version: "18"
node-version: "22"

- name: Login in to docker registry
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login in to quay.io registry
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
Expand All @@ -43,7 +43,7 @@ jobs:
run: ./scripts/setup_web_console.sh

- name: Cache node modules
uses: actions/cache@v4
uses: actions/cache@v6
env:
cache-name: cache-node-modules
with:
Expand All @@ -57,7 +57,7 @@ jobs:
TX_TOKEN: '${{ secrets.TRANSIFEX_TOKEN_MC_V2 }}'

- name: Cache go modules
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish_executables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ jobs:

steps:
- name: checkout backend repository
uses: actions/checkout@v4
uses: actions/checkout@v7

- uses: actions/setup-go@v4
- uses: actions/setup-go@v7
with:
go-version: ^1.23
go-version-file: go.mod

- uses: actions/setup-node@v2
- uses: actions/setup-node@v7
with:
node-version: "18"
node-version: "22"

- name: setup web console repository
run: ./scripts/setup_web_console.sh

- name: cache node modules
uses: actions/cache@v4
uses: actions/cache@v6
env:
cache-name: cache-node-modules
with:
Expand All @@ -39,7 +39,7 @@ jobs:
TX_TOKEN: '${{ secrets.TRANSIFEX_TOKEN_MC_V2 }}'

- name: Cache go modules
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand All @@ -58,7 +58,7 @@ jobs:
sha256sum *.zip >> ./SHA256SUMS.txt

- name: Update release notes and executables
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/') # executes only for new release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions cmd/client/command/delete/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var deleteCmd = &cobra.Command{

func printStatus(err error) {
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
fmt.Fprintln(rootCmd.IOStreams.Out, "Deleted successfully")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "Deleted successfully")
}
4 changes: 2 additions & 2 deletions cmd/client/command/disable/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var disableCmd = &cobra.Command{

func printStatus(err error) {
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
fmt.Fprintln(rootCmd.IOStreams.Out, "Disabled successfully")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "Disabled successfully")
}
4 changes: 2 additions & 2 deletions cmd/client/command/enable/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var enableCmd = &cobra.Command{

func printStatus(err error) {
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
fmt.Fprintln(rootCmd.IOStreams.Out, "Enabled successfully")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "Enabled successfully")
}
10 changes: 5 additions & 5 deletions cmd/client/command/get/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@ func getQueryParams(headers []printer.Header) (map[string]interface{}, error) {
func executeGetCmd(headers []printer.Header, listFunc ListFunc, dataType interface{}) {
queryParams, err := getQueryParams(headers)
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}

result, err := listFunc(queryParams)
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
res, ok := result.Data.([]interface{})
if !ok {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "invalid response type:%T\n", result.Data)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "invalid response type:%T\n", result.Data)
return
}

if len(res) == 0 {
fmt.Fprintln(rootCmd.IOStreams.Out, "No resource found")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "No resource found")
return
}

Expand All @@ -141,7 +141,7 @@ func executeGetCmd(headers []printer.Header, listFunc ListFunc, dataType interfa
item := reflect.New(reflect.TypeOf(dataType)).Interface()
err = utils.MapToStruct(utils.TagNameJSON, data, item)
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error on map to struct. %s", err.Error())
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error on map to struct. %s", err.Error())
continue
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/client/command/reboot/reboot_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ var nodeRebootCmd = &cobra.Command{
client := rootCmd.GetClient()
err := client.ExecuteNodeAction(nodeTY.ActionReboot, args)
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
fmt.Fprintln(rootCmd.IOStreams.Out, "Nodes reboot command supplied")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "Nodes reboot command supplied")
},
}
4 changes: 2 additions & 2 deletions cmd/client/command/reload/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var reloadCmd = &cobra.Command{

func printStatus(err error) {
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s\n", err)
return
}
fmt.Fprintln(rootCmd.IOStreams.Out, "Reloaded successfully")
_, _ = fmt.Fprintln(rootCmd.IOStreams.Out, "Reloaded successfully")
}
8 changes: 4 additions & 4 deletions cmd/client/command/root/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func UpdateStreams(cmd *cobra.Command) {
func Execute(streams clientTY.IOStreams) {
IOStreams = streams
if err := Cmd.Execute(); err != nil {
fmt.Fprintln(IOStreams.ErrOut, err)
_, _ = fmt.Fprintln(IOStreams.ErrOut, err)
os.Exit(1)
}
}
Expand All @@ -85,11 +85,11 @@ func WriteConfigFile() {

configBytes, err := yaml.Marshal(CONFIG)
if err != nil {
fmt.Fprintf(IOStreams.ErrOut, "error on config file marshal. error:[%s]\n", err.Error())
_, _ = fmt.Fprintf(IOStreams.ErrOut, "error on config file marshal. error:[%s]\n", err.Error())
}
err = os.WriteFile(cfgFile, configBytes, os.ModePerm)
if err != nil {
fmt.Fprintf(IOStreams.ErrOut, "error on writing config file to disk, filename:%s, error:[%s]\n", cfgFile, err.Error())
_, _ = fmt.Fprintf(IOStreams.ErrOut, "error on writing config file to disk, filename:%s, error:[%s]\n", cfgFile, err.Error())
}
}

Expand Down Expand Up @@ -117,7 +117,7 @@ func initConfig() {
if err := viper.ReadInConfig(); err == nil {
err = viper.Unmarshal(&CONFIG)
if err != nil {
fmt.Fprint(IOStreams.ErrOut, "error on unmarshal of config\n", err)
_, _ = fmt.Fprint(IOStreams.ErrOut, "error on unmarshal of config\n", err)
}
}
}
16 changes: 8 additions & 8 deletions cmd/client/command/root/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var loginCmd = &cobra.Command{
if loginUsername == "" {
_username, err := promptUsername()
if err != nil {
fmt.Fprintln(IOStreams.ErrOut, err.Error())
_, _ = fmt.Fprintln(IOStreams.ErrOut, err.Error())
return
}
loginUsername = _username
Expand All @@ -67,7 +67,7 @@ var loginCmd = &cobra.Command{
if loginPassword == "" {
_password, err := promptPassword()
if err != nil {
fmt.Fprintln(IOStreams.ErrOut, err.Error())
_, _ = fmt.Fprintln(IOStreams.ErrOut, err.Error())
return
}
loginPassword = _password
Expand All @@ -79,11 +79,11 @@ var loginCmd = &cobra.Command{
client := GetClient()
res, err := client.Login(loginUsername, loginPassword, loginToken, loginExpiresIn)
if err != nil {
fmt.Fprintln(IOStreams.ErrOut, "error on login", err)
_, _ = fmt.Fprintln(IOStreams.ErrOut, "error on login", err)
return
}
if res != nil {
fmt.Fprintln(IOStreams.ErrOut, "Login successful.")
_, _ = fmt.Fprintln(IOStreams.ErrOut, "Login successful.")
CONFIG.URL = args[0]
CONFIG.Username = loginUsername
CONFIG.Password = res.Token
Expand All @@ -102,14 +102,14 @@ var logoutCmd = &cobra.Command{
mc logout`,
Run: func(cmd *cobra.Command, args []string) {
if CONFIG.URL == "" {
fmt.Fprintln(IOStreams.ErrOut, "There is no connection information.")
_, _ = fmt.Fprintln(IOStreams.ErrOut, "There is no connection information.")
return
}
CONFIG.URL = ""
CONFIG.Username = ""
CONFIG.Password = ""
CONFIG.Insecure = false
fmt.Fprintln(IOStreams.Out, "Logout successful.")
_, _ = fmt.Fprintln(IOStreams.Out, "Logout successful.")
WriteConfigFile()
},
}
Expand All @@ -125,10 +125,10 @@ func promptUsername() (string, error) {
}

func promptPassword() (string, error) {
fmt.Fprint(IOStreams.Out, "Password: ")
_, _ = fmt.Fprint(IOStreams.Out, "Password: ")
// TODO: should use IOStreams.In in the place of os.Stdin.Fd
pw, err := term.ReadPassword(int(os.Stdin.Fd()))
fmt.Fprintln(IOStreams.Out)
_, _ = fmt.Fprintln(IOStreams.Out)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/client/command/set/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ func executeSetCmd(quickIdPrefix, keyPath string, resources []string, payload st
}
err := client.ExecuteAction(actions)
if err != nil {
fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s", err.Error())
_, _ = fmt.Fprintf(rootCmd.IOStreams.ErrOut, "error:%s", err.Error())
}
}
4 changes: 2 additions & 2 deletions docker/gateway.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM} golang:1.23-alpine3.21 AS builder
FROM --platform=${BUILDPLATFORM} golang:1.26-alpine3.24 AS builder
RUN mkdir /app
ADD . /app
WORKDIR /app
Expand All @@ -14,7 +14,7 @@ ARG TARGETARCH
ENV TARGET_BUILD="gateway"
RUN scripts/container_binary.sh

FROM alpine:3.21
FROM alpine:3.24

LABEL maintainer="Jeeva Kandasamy <jkandasa@gmail.com>"

Expand Down
4 changes: 2 additions & 2 deletions docker/handler.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM} golang:1.23-alpine3.21 AS builder
FROM --platform=${BUILDPLATFORM} golang:1.26-alpine3.24 AS builder
RUN mkdir /app
ADD . /app
WORKDIR /app
Expand All @@ -14,7 +14,7 @@ ARG TARGETARCH
ENV TARGET_BUILD="handler"
RUN scripts/container_binary.sh

FROM alpine:3.21
FROM alpine:3.24

LABEL maintainer="Jeeva Kandasamy <jkandasa@gmail.com>"

Expand Down
4 changes: 2 additions & 2 deletions docker/server.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-alpine3.21 AS builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.26-alpine3.24 AS builder
RUN mkdir /app
ADD . /app
WORKDIR /app
Expand All @@ -14,7 +14,7 @@ ARG TARGETARCH
ENV TARGET_BUILD="server"
RUN scripts/container_binary.sh

FROM alpine:3.21
FROM alpine:3.24

LABEL maintainer="Jeeva Kandasamy <jkandasa@gmail.com>"

Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/mycontroller-org/server/v2

go 1.23.0

toolchain go1.23.7
go 1.26.2

require (
github.com/Masterminds/semver/v3 v3.2.1
Expand Down
5 changes: 2 additions & 3 deletions pkg/api/backup/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/mycontroller-org/server/v2/pkg/utils"
filterUtils "github.com/mycontroller-org/server/v2/pkg/utils/filter_sort"
busTY "github.com/mycontroller-org/server/v2/plugin/bus/types"
backupRestore "github.com/mycontroller-org/server/v2/plugin/database/storage/backup"
backupTY "github.com/mycontroller-org/server/v2/plugin/database/storage/backup"
storageTY "github.com/mycontroller-org/server/v2/plugin/database/storage/types"
"go.uber.org/zap"
Expand All @@ -18,12 +17,12 @@ import (
type BackupAPI struct {
ctx context.Context
logger *zap.Logger
backupRestore *backupRestore.BackupRestore
backupRestore *backupTY.BackupRestore
bus busTY.Plugin
settingsAPI *settings.SettingsAPI
}

func New(ctx context.Context, logger *zap.Logger, backupRestore *backupRestore.BackupRestore, storage storageTY.Plugin, bus busTY.Plugin, enc *encryptionAPI.Encryption) *BackupAPI {
func New(ctx context.Context, logger *zap.Logger, backupRestore *backupTY.BackupRestore, storage storageTY.Plugin, bus busTY.Plugin, enc *encryptionAPI.Encryption) *BackupAPI {
return &BackupAPI{
ctx: ctx,
logger: logger.Named("backup_api"),
Expand Down
Loading