From 011c43756374f88b8e3a1b5f8f04e9bde5f4fde3 Mon Sep 17 00:00:00 2001 From: Tosone Date: Mon, 9 Oct 2023 14:43:53 +0800 Subject: [PATCH] :sparkles: Add friendly link --- .github/workflows/image-build.yml | 2 +- README.md | 2 +- build/Dockerfile | 3 +-- build/Dockerfile.builder.local | 1 - build/Dockerfile.debian | 3 +-- build/Dockerfile.local | 1 - pkg/configs/default.go | 8 +++++-- pkg/logger/glog.go | 8 +------ web/src/App.tsx | 3 +-- web/src/components/Menu/index.tsx | 16 +++++++------- web/src/pages/Builder/RunnerList.tsx | 9 ++++++-- web/src/pages/Builder/RunnerLog.tsx | 13 +++++++----- .../pages/CodeRepository/BuilderRunner.tsx | 21 ------------------- web/src/pages/Home/index.css | 15 ------------- web/src/pages/Home/index.tsx | 2 -- web/src/pages/Login/index.tsx | 10 ++++----- 16 files changed, 40 insertions(+), 77 deletions(-) delete mode 100644 web/src/pages/CodeRepository/BuilderRunner.tsx delete mode 100644 web/src/pages/Home/index.css diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index abfed94d..5ed10579 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -2,7 +2,7 @@ name: Image CI on: schedule: - - cron: "0 0 * * 6" + - cron: "0 1 * * *" push: branches: - main diff --git a/README.md b/README.md index 46666ef0..aa23df61 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ docker run --name sigma -v /home/admin/config:/etc/sigma \ ./scripts/samples/samples.sh ``` -Visit: , username/password: sigma/sigma. +Visit: , username/password: sigma/sigma I will periodically reboot the container, and since the container doesn't have any disk mount, every reboot will clear all the data. diff --git a/build/Dockerfile b/build/Dockerfile index e8befae8..39acf9a8 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -61,7 +61,7 @@ COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist WORKDIR /go/src/github.com/go-sigma/sigma -RUN --mount=type=cache,target=/root/.cache/go-build make all +RUN --mount=type=cache,target=/root/.cache/go-build make build FROM alpine:${ALPINE_VERSION} @@ -70,6 +70,5 @@ COPY --from=trivy /usr/local/bin/trivy /usr/local/bin/trivy COPY --from=trivy /opt/trivy/trivy.db /opt/trivy/db/trivy.db COPY ./conf/config.yaml /etc/sigma/config.yaml COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma /usr/local/bin/sigma -COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma-builder /usr/local/bin/sigma-builder CMD ["sigma", "server"] diff --git a/build/Dockerfile.builder.local b/build/Dockerfile.builder.local index 6b9dfd1a..d8e5cc6d 100644 --- a/build/Dockerfile.builder.local +++ b/build/Dockerfile.builder.local @@ -2,7 +2,6 @@ FROM moby/buildkit:v0.12.2-rootless USER root RUN set -eux && \ - sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \ apk add --no-cache git-lfs && \ mkdir -p /code/ && \ chown -R 1000:1000 /opt/ && \ diff --git a/build/Dockerfile.debian b/build/Dockerfile.debian index 49e828a1..1af4471e 100644 --- a/build/Dockerfile.debian +++ b/build/Dockerfile.debian @@ -67,7 +67,7 @@ COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist WORKDIR /go/src/github.com/go-sigma/sigma -RUN --mount=type=cache,target=/root/.cache/go-build make all +RUN --mount=type=cache,target=/root/.cache/go-build make build FROM debian:${DEBIAN_VERSION} @@ -87,6 +87,5 @@ COPY --from=trivy /usr/local/bin/trivy /usr/local/bin/trivy COPY --from=trivy /opt/trivy/trivy.db /opt/trivy/db/trivy.db COPY ./conf/config.yaml /etc/sigma/config.yaml COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma /usr/local/bin/sigma -COPY --from=builder /go/src/github.com/go-sigma/sigma/bin/sigma-builder /usr/local/bin/sigma-builder CMD ["sigma", "server"] diff --git a/build/Dockerfile.local b/build/Dockerfile.local index b49901f2..beb7082c 100644 --- a/build/Dockerfile.local +++ b/build/Dockerfile.local @@ -47,6 +47,5 @@ COPY --from=trivy /opt/trivy/trivy.db /opt/trivy/db/trivy.db COPY --from=trivy /opt/trivy/metadata.json /opt/trivy/db/metadata.json COPY ./conf/config.yaml /etc/sigma/config.yaml COPY ./bin/sigma /usr/local/bin/sigma -COPY ./bin/sigma-builder /usr/local/bin/sigma-builder CMD ["sigma", "server"] diff --git a/pkg/configs/default.go b/pkg/configs/default.go index 41f27e72..9a3dc6af 100644 --- a/pkg/configs/default.go +++ b/pkg/configs/default.go @@ -30,6 +30,10 @@ func defaultSettings() { viper.SetDefault("server.endpoint", "http://127.0.0.1:3000") viper.SetDefault("server.internalEndpoint", "http://127.0.0.1:3000") - // configuration.HTTP.Endpoint = "http://127.0.0.1:3000" - // configuration.HTTP.InternalEndpoint = "http://127.0.0.1:3000" + if configuration.HTTP.Endpoint == "" { + configuration.HTTP.Endpoint = "http://127.0.0.1:3000" + } + if configuration.HTTP.InternalEndpoint == "" { + configuration.HTTP.InternalEndpoint = "http://127.0.0.1:3000" + } } diff --git a/pkg/logger/glog.go b/pkg/logger/glog.go index 2b4ac8fe..7ab52b3e 100644 --- a/pkg/logger/glog.go +++ b/pkg/logger/glog.go @@ -49,13 +49,7 @@ func (l ZLogger) Info(ctx context.Context, msg string, opts ...interface{}) { // Trace is the trace log func (l ZLogger) Trace(ctx context.Context, begin time.Time, f func() (string, int64), err error) { zl := zerolog.Ctx(ctx) - var event *zerolog.Event - - if err != nil { - event = zl.Error() - } else { - event = zl.Info() - } + var event = zl.Debug() event = event.Str("elapsed", time.Since(begin).String()) diff --git a/web/src/App.tsx b/web/src/App.tsx index 30846ed6..0bed79d7 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -30,7 +30,6 @@ import NamespaceDaemonTasks from "./pages/Namespace/DaemonTask"; import CodeRepositoryHome from './pages/CodeRepository'; import CodeRepositoryList from './pages/CodeRepository/List'; -import BuilderRunner from './pages/CodeRepository/BuilderRunner'; import BuildersSetup from './pages/Builder/Setup'; import BuilderRunnerList from './pages/Builder/RunnerList'; @@ -60,7 +59,7 @@ export default function App() { style={{ top: "3rem" }} /> - } /> + } /> } /> diff --git a/web/src/components/Menu/index.tsx b/web/src/components/Menu/index.tsx index c61f7388..a4a7d675 100644 --- a/web/src/components/Menu/index.tsx +++ b/web/src/components/Menu/index.tsx @@ -22,7 +22,7 @@ import { Link, useSearchParams, useNavigate } from 'react-router-dom'; import Toast from "../../components/Notification"; import { INamespaceItem, INamespaceList, IHTTPError, IUserSelf, IEndpoint } from "../../interfaces"; -export default function ({ localServer, item, namespace, repository, tag }: { localServer: string, item: string, namespace?: string, repository?: string, tag?: string }) { +export default function ({ localServer, item, namespace, repository, tag, selfClick }: { localServer: string, item: string, namespace?: string, repository?: string, tag?: string, selfClick?: boolean }) { const [showProfileMenu, setShowProfileMenu] = useState(false); const [menuActive, setMenuActive] = useState(item === "" ? "home" : item); const navigate = useNavigate(); @@ -164,7 +164,7 @@ export default function ({ localServer, item, namespace, repository, tag }: { lo }