mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-04 12:05:35 +00:00
Set a default value for SEM_VER
build-time variable in Dockerfile
(#435)
Also fix a runtime error that happens when the API server's version is not a valid SemVer.
This commit is contained in:
@@ -29,7 +29,7 @@ RUN go list -f '{{.Path}}@{{.Version}}' -m all | sed 1d | grep -e 'go-cache' -e
|
|||||||
ARG COMMIT_HASH
|
ARG COMMIT_HASH
|
||||||
ARG GIT_BRANCH
|
ARG GIT_BRANCH
|
||||||
ARG BUILD_TIMESTAMP
|
ARG BUILD_TIMESTAMP
|
||||||
ARG SEM_VER
|
ARG SEM_VER=0.0.0
|
||||||
|
|
||||||
# Copy and build agent code
|
# Copy and build agent code
|
||||||
COPY shared ../shared
|
COPY shared ../shared
|
||||||
|
@@ -5,12 +5,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/up9inc/mizu/shared/kubernetes"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/up9inc/mizu/shared/kubernetes"
|
||||||
|
|
||||||
"github.com/up9inc/mizu/cli/config"
|
"github.com/up9inc/mizu/cli/config"
|
||||||
"github.com/up9inc/mizu/shared"
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
@@ -28,7 +29,7 @@ const DefaultTimeout = 5 * time.Second
|
|||||||
|
|
||||||
func NewProvider(url string, retries int, timeout time.Duration) *Provider {
|
func NewProvider(url string, retries int, timeout time.Duration) *Provider {
|
||||||
return &Provider{
|
return &Provider{
|
||||||
url: url,
|
url: url,
|
||||||
retries: config.GetIntEnvConfig(config.ApiServerRetries, retries),
|
retries: config.GetIntEnvConfig(config.ApiServerRetries, retries),
|
||||||
client: &http.Client{
|
client: &http.Client{
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
|
@@ -24,6 +24,11 @@ func CheckVersionCompatibility(apiServerProvider *apiserver.Provider) (bool, err
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !semver.SemVersion(apiSemVer).IsValid() {
|
||||||
|
logger.Log.Errorf(uiUtils.Red, fmt.Sprintf("api version (%s) is not a valid SemVer", apiSemVer))
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
if semver.SemVersion(apiSemVer).Major() == semver.SemVersion(mizu.SemVer).Major() &&
|
if semver.SemVersion(apiSemVer).Major() == semver.SemVersion(mizu.SemVer).Major() &&
|
||||||
semver.SemVersion(apiSemVer).Minor() == semver.SemVersion(mizu.SemVer).Minor() {
|
semver.SemVersion(apiSemVer).Minor() == semver.SemVersion(mizu.SemVer).Minor() {
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@@ -28,7 +28,7 @@ RUN go list -f '{{.Path}}@{{.Version}}' -m all | sed 1d | grep -e 'go-cache' -e
|
|||||||
ARG COMMIT_HASH
|
ARG COMMIT_HASH
|
||||||
ARG GIT_BRANCH
|
ARG GIT_BRANCH
|
||||||
ARG BUILD_TIMESTAMP
|
ARG BUILD_TIMESTAMP
|
||||||
ARG SEM_VER
|
ARG SEM_VER=0.0.0
|
||||||
|
|
||||||
# Copy and build agent code
|
# Copy and build agent code
|
||||||
COPY shared ../shared
|
COPY shared ../shared
|
||||||
|
Reference in New Issue
Block a user