Compare commits

...

26 Commits

Author SHA1 Message Date
Yuxing Deng
2b39db9f07 fix(ci): Fix multi-arch build problem
Added build linux/arm64 binary to default ci
2023-11-15 16:30:57 +08:00
Yuxing Deng
4dc1acb1f2 feat(ci): Improve drone pipeline configuration
- Separate push and tag pipeline
- Use buildx to build and push multi-arch image
2023-11-15 16:09:58 +08:00
Yuxing Deng
989d087b99 No need to run hack_fs
As the embed fs packaged all files.
And bump upx version.
2023-11-13 16:29:48 +08:00
Yuxing Deng
c214e6ba6a Add windows amd64 support
Bump steve customized logic to fix serving embed assets problem
2023-11-13 15:46:03 +08:00
Yuxing Deng
390b11caef Bump steve
And upgrade builder image to v1.21.
2023-11-10 15:24:31 +08:00
niusmallnan
e016261c4b Bump steve and dashboard 2023-07-14 13:36:54 +08:00
niusmallnan
c43288964a Bump dashboard 2023-07-13 15:20:20 +08:00
niusmallnan
70e586976d Bump dashboard 2023-07-13 12:16:04 +08:00
niusmallnan
d0ce0e28bf Bump dashboard 2023-07-13 10:46:03 +08:00
niusmallnan
ad0a0c0cb3 Bump steve and dashboard for v2.7.5 2023-07-13 09:02:30 +08:00
niusmallnan
651d499086 Bumo bci 15.5 2023-07-11 11:35:10 +08:00
niusmallnan
8e592b1a3c Bump steve and dashboard for Rancher v2.7.2 2023-04-18 12:20:04 +08:00
niusmallnan
c1f5fda228 [CI SKIP] Update README for basic auth 2023-04-11 11:07:14 +08:00
niusmallnan
10e5323c95 [CI SKIP] Use ingress v1 for nginx-ingress basic auth demo 2023-04-10 17:18:22 +08:00
niusmallnan
ea49f9d3b4 [CI SKIP] Add basic-auth manifests for traefik v2 2023-04-10 17:09:30 +08:00
niusmallnan
b0b81ba87d [CI SKIP] switch to sslip.io for ingress demos 2023-04-10 16:20:43 +08:00
niusmallnan
e757347def Disable compress for darwin releases 2023-04-04 09:08:50 +08:00
niusmallnan
f4970b85a2 Bump steve and dashboard for Rancher v2.7.1 2023-03-20 15:13:04 +08:00
niusmallnan
bfae192748 Use --scanners instead of --security-checks 2023-03-20 11:24:18 +08:00
niusmallnan
3810cd702f Bump upx 4.0.2 2023-03-20 11:23:47 +08:00
niusmallnan
f898c559e0 Bump steve and dashboard 2022-12-20 15:16:25 +08:00
niusmallnan
f0effa7f09 Bump upx 4.0.1 2022-12-20 15:12:34 +08:00
niusmallnan
2838ceb34a Add image scan pipeline in drone 2022-12-09 09:29:18 +08:00
niusmallnan
40a972eeef Use BCI minimal image 2022-12-09 08:59:34 +08:00
niusmallnan
88c924a816 Use BCI image 2022-12-09 08:51:39 +08:00
niusmallnan
d24282849f Bump dashboard v2.6.9-kube-explorer-ui-rc2 2022-11-15 13:47:25 +08:00
20 changed files with 311 additions and 401 deletions

View File

@@ -1,294 +1,165 @@
--- type: docker
kind: pipeline kind: pipeline
name: default-amd64 name: push
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
steps: trigger:
- name: build event:
pull: default exclude:
image: rancher/dapper:v0.5.8 - promote
commands: include:
- dapper ci - push
privileged: true - pull_request
volumes:
- name: docker
path: /var/run/docker.sock
when:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
event:
- push
- pull_request
- name: release
pull: default
image: rancher/dapper:v0.5.8
commands:
- dapper ci
privileged: true
environment:
CROSS: 1
volumes:
- name: docker
path: /var/run/docker.sock
when:
event:
- tag
- name: stage-binaries-head
image: rancher/dapper:v0.5.8
commands:
- "cp -r ./bin/kube-explorer ./package/"
when:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
event:
- push
- name: stage-binaries
image: rancher/dapper:v0.5.8
commands:
- "cp -r ./bin/kube-explorer-linux-amd64 ./package/kube-explorer"
when:
event:
- tag
- name: github_binary_release
pull: default
image: plugins/github-release
settings:
api_key:
from_secret: github_token
checksum:
- sha256
files:
- "bin/*"
title: "${DRONE_TAG}"
overwrite: true
when:
event:
- tag
- name: docker-publish-head
pull: default
image: plugins/docker
settings:
dockerfile: package/Dockerfile
context: package/
password:
from_secret: docker_password
repo: cnrancher/kube-explorer
tag: head-linux-amd64
username:
from_secret: docker_username
when:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
event:
- push
- name: docker-publish
pull: default
image: plugins/docker
settings:
dockerfile: package/Dockerfile
context: package/
password:
from_secret: docker_password
repo: cnrancher/kube-explorer
tag: ${DRONE_TAG}-linux-amd64
username:
from_secret: docker_username
when:
event:
- tag
volumes: volumes:
- name: docker - name: docker
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
node: node:
instance: agent-amd64 instance: agent-amd64
trigger:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
- "refs/tags/*"
event:
exclude:
- promote
---
kind: pipeline
name: default-arm64
platform:
os: linux
arch: arm64
steps: steps:
- name: build - name: build
pull: default image: rancher/dapper:v0.6.0
image: rancher/dapper:v0.5.8 commands:
commands: - dapper ci
- dapper ci environment:
privileged: true CROSS: "${DRONE_BUILD_EVENT}"
volumes: privileged: true
- name: docker volumes:
path: /var/run/docker.sock - name: docker
when: path: /var/run/docker.sock
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
- "refs/tags/*"
event:
- push
- tag
- name: stage-binaries - name: image-scan-head
image: rancher/dapper:v0.5.8 image: aquasec/trivy
commands: commands:
- "cp -r ./bin/* ./package/" - trivy image --no-progress --ignore-unfixed --severity HIGH,CRITICAL --scanners vuln --exit-code 1 cnrancher/kube-explorer:${DRONE_COMMIT:0:7}
when: volumes:
ref: - name: docker
include: path: /var/run/docker.sock
- "refs/heads/main" when:
- "refs/heads/v*" event:
- "refs/tags/*" - push
event: ref:
- push include:
- tag - "refs/heads/main"
- "refs/heads/v*"
- name: docker-publish-head - name: install-buildx-support
pull: default image: tonistiigi/binfmt
image: plugins/docker privileged: true
settings: entrypoint:
build_args: - /usr/bin/binfmt
- ARCH=arm64 command:
dockerfile: package/Dockerfile - --install
context: package/ - all
password: when:
from_secret: docker_password event:
repo: cnrancher/kube-explorer - push
tag: head-linux-arm64 ref:
username: include:
from_secret: docker_username - "refs/heads/main"
when: - "refs/heads/v*"
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
event:
- push
- name: docker-publish - name: docker-publish
pull: default image: thegeeklab/drone-docker-buildx
image: plugins/docker privileged: true
settings: settings:
build_args: platforms: linux/amd64,linux/arm64/v8
- ARCH=arm64 dockerfile: package/Dockerfile
dockerfile: package/Dockerfile repo: cnrancher/kube-explorer
context: package/ tag: latest
password: username:
from_secret: docker_password from_secret: docker_username
repo: cnrancher/kube-explorer password:
tag: ${DRONE_TAG}-linux-arm64 from_secret: docker_password
username: volumes:
from_secret: docker_username - name: docker
when: path: /var/run/docker.sock
event: when:
- tag event:
- push
volumes: ref:
- name: docker include:
host: - "refs/heads/main"
path: /var/run/docker.sock - "refs/heads/v*"
trigger:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
- "refs/tags/*"
event:
exclude:
- promote
node:
instance: agent-arm64
--- ---
type: docker
kind: pipeline kind: pipeline
name: manifest name: tag
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
steps: trigger:
- name: push-manifest-head event:
image: plugins/manifest exclude:
settings: - promote
ignore_missing: true include:
username: - tag
from_secret: docker_username ref:
password: include:
from_secret: docker_password - "refs/tags/*"
spec: manifest-head.tmpl
when:
ref:
include:
- "refs/heads/main"
- "refs/heads/v*"
event:
- push
- name: push-manifest
image: plugins/manifest
settings:
ignore_missing: true
username:
from_secret: docker_username
password:
from_secret: docker_password
spec: manifest.tmpl
when:
event:
- tag
volumes: volumes:
- name: docker - name: docker
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
node: node:
instance: agent-amd64 instance: agent-amd64
trigger: steps:
ref: - name: release
include: image: rancher/dapper:v0.6.0
- "refs/heads/main" commands:
- "refs/heads/v*" - dapper ci
- "refs/tags/*" privileged: true
event: environment:
exclude: CROSS: "${DRONE_BUILD_EVENT}"
- promote volumes:
- name: docker
path: /var/run/docker.sock
depends_on: - name: install-buildx-support
- default-amd64 image: tonistiigi/binfmt
- default-arm64 privileged: true
entrypoint:
- /usr/bin/binfmt
command:
- --install
- all
... - name: docker-publish
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
platforms: linux/amd64,linux/arm64/v8
dockerfile: package/Dockerfile
repo: cnrancher/kube-explorer
tag: ${DRONE_TAG}
username:
from_secret: docker_username
password:
from_secret: docker_password
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
checksum:
- sha256
files:
- "bin/*"
title: "${DRONE_TAG}"
overwrite: true

2
.gitignore vendored
View File

@@ -19,3 +19,5 @@
/dist /dist
/build /build
*.swp *.swp
/.vscode

View File

@@ -1,30 +1,28 @@
FROM golang:1.19 FROM registry.suse.com/bci/golang:1.21
ARG PROXY
ARG GOPROXY
ARG DAPPER_HOST_ARCH ARG DAPPER_HOST_ARCH
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
ENV https_proxy=${PROXY} \
http_proxy=${PROXY}
RUN apt-get update && \ RUN zypper -n install ca-certificates git-core wget curl unzip tar vim less file xz
apt-get install -y ca-certificates git wget curl xz-utils && \ RUN zypper install -y -f docker
rm -f /bin/sh && ln -s /bin/bash /bin/sh && \
curl -sL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-${ARCH}_linux.tar.xz | tar xvJf - --strip-components=1 -C /tmp && \ ENV UPX_VERSION 4.2.1
RUN curl -sL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${ARCH}_linux.tar.xz | tar xvJf - --strip-components=1 -C /tmp && \
mv /tmp/upx /usr/bin/ mv /tmp/upx /usr/bin/
RUN if [ "${ARCH}" == "amd64" ]; then \ RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2; \
fi fi
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \ ENV GIT_COMMIT="b5d6adfbc855c3e0ef458e0aa0939c2582b8073f" \
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \ GIT_BRANCH="ke/v0.3" \
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
DOCKER_URL=DOCKER_URL_${ARCH}
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
ENV GIT_COMMIT="f8261f5f6e3a58f2e9a4b97ed5dc0a5f92b03c9e" \
GIT_BRANCH="ke/v0.2" \
GIT_SOURCE=${GOPATH}/src/github.com/rancher/steve \ GIT_SOURCE=${GOPATH}/src/github.com/rancher/steve \
CATTLE_DASHBOARD_UI_VERSION="v2.6.9-kube-explorer-ui-rc1" CATTLE_DASHBOARD_UI_VERSION="v2.7.5-kube-explorer-ui-rc7"
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS GOPROXY
ENV DAPPER_SOURCE /opt/kube-explorer ENV DAPPER_SOURCE /opt/kube-explorer
ENV DAPPER_OUTPUT ./bin ./dist ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true ENV DAPPER_DOCKER_SOCKET true

12
deploy/kubectl/README.md Normal file
View File

@@ -0,0 +1,12 @@
## Access Control Via Basic Auth
Deploy the kube-explorer workload:
```
kubectl create -f .
```
Configure for different IngressClass:
- [Nginx Ingress](./nginx-auth)
- [Traefik Ingress](./traefik-v2-auth)

View File

@@ -13,9 +13,9 @@ htpasswd -nb username password | base64
To install this mode, just run this script: To install this mode, just run this script:
``` ```
kubectl apply -f ./secret.yaml kubectl create -f ./secret.yaml
export MY_XIP_IO=$(curl -sL ipinfo.io/ip) export MY_IP=$(curl -sL ipinfo.io/ip)
envsubst < ./ingress.yaml.tpl | kubectl apply -f - envsubst < ./ingress.yaml.tpl | kubectl create -f -
``` ```
For more infos: https://kubernetes.github.io/ingress-nginx/examples/auth/basic/ For more infos: https://kubernetes.github.io/ingress-nginx/examples/auth/basic/

View File

@@ -1,8 +1,8 @@
# Note: please replace the host first # Note: please replace the host first
# To use xip.io: http://xip.io/ # To use sslip.io: https://sslip.io/
# To get your public IP: curl ipinfo.io/ip # To get your public IP: curl ipinfo.io/ip
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: kube-explorer name: kube-explorer
@@ -10,16 +10,18 @@ metadata:
labels: labels:
app: kube-explorer app: kube-explorer
annotations: annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/auth-type: basic nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: kube-explorer nginx.ingress.kubernetes.io/auth-secret: kube-explorer
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kube-explorer' nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kube-explorer'
spec: spec:
rules: rules:
- host: "${MY_XIP_IO}.xip.io" - host: "${MY_IP}.sslip.io"
http: http:
paths: paths:
- path: / - path: /
pathType: Prefix
backend: backend:
serviceName: kube-explorer service:
servicePort: 8989 name: kube-explorer
port:
number: 8989

View File

@@ -13,9 +13,9 @@ htpasswd -nb username password | base64
To install this mode, just run this script: To install this mode, just run this script:
``` ```
kubectl apply -f ./secret.yaml kubectl create -f ./secret.yaml
export MY_XIP_IO=$(curl -sL ipinfo.io/ip) export MY_IP=$(curl -sL ipinfo.io/ip)
envsubst < ./ingress.yaml.tpl | kubectl apply -f - envsubst < ./ingress.yaml.tpl | kubectl create -f -
``` ```
For more infos: https://doc.traefik.io/traefik/v1.7/configuration/backends/kubernetes/ For more infos: https://doc.traefik.io/traefik/v1.7/configuration/backends/kubernetes/

View File

@@ -1,5 +1,5 @@
# Note: please replace the host first # Note: please replace the host first
# To use xip.io: http://xip.io/ # To use sslip.io: https://sslip.io/
# To get your public IP: curl ipinfo.io/ip # To get your public IP: curl ipinfo.io/ip
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1beta1
@@ -16,7 +16,7 @@ metadata:
ingress.kubernetes.io/auth-remove-header: "true" ingress.kubernetes.io/auth-remove-header: "true"
spec: spec:
rules: rules:
- host: "${MY_XIP_IO}.xip.io" - host: "${MY_IP}.sslip.io"
http: http:
paths: paths:
- path: / - path: /

View File

@@ -0,0 +1,21 @@
## Traefik Auth
This can be used in K3s, as K3s use traefik as the default ingress class.
We use `basic-auth` to control the access of kube-explorer. The auth token is stored in the secret.
The default user is `niusmallnan`, and password is `dagedddd`. You can replace to another value with `htpasswd` tool.
```
htpasswd -nb username password | base64
```
To install this mode, just run this script:
```
kubectl create -f ./middleware.yaml
export MY_IP=$(curl -sL ipinfo.io/ip)
envsubst < ./ingress.yaml.tpl | kubectl create -f -
```
For more infos: https://doc.traefik.io/traefik/middlewares/http/basicauth/

View File

@@ -0,0 +1,25 @@
# Note: please replace the host first
# To use sslip.io.io: https://sslip.io.io/
# To get your public IP: curl ipinfo.io/ip
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kube-explorer
namespace: kube-system
labels:
app: kube-explorer
annotations:
traefik.ingress.kubernetes.io/router.middlewares: kube-system-kube-explorer@kubernetescrd
spec:
rules:
- host: "${MY_IP}.sslip.io"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kube-explorer
port:
number: 8989

View File

@@ -0,0 +1,28 @@
# The definitions below require the definitions for the Middleware and IngressRoute kinds.
# https://doc.traefik.io/traefik/reference/dynamic-configuration/kubernetes-crd/#definitions
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: kube-explorer
namespace: kube-system
labels:
app: kube-explorer
spec:
basicAuth:
secret: kube-explorer
removeHeader: true
---
# To create an encoded user:password pair, the following command can be used:
# htpasswd -nb user password | base64
apiVersion: v1
kind: Secret
metadata:
name: kube-explorer
namespace: kube-system
labels:
app: kube-explorer
data:
auth: bml1c21hbGxuYW46JGFwcjEkbDdUZjJOdWskbmNXajYubHYvMGNkcXM0NFoyelVQLgoK
type: Opaque

View File

@@ -1,12 +0,0 @@
image: cnrancher/kube-explorer:latest
manifests:
-
image: cnrancher/kube-explorer:head-linux-amd64
platform:
architecture: amd64
os: linux
-
image: cnrancher/kube-explorer:head-linux-arm64
platform:
architecture: arm64
os: linux

View File

@@ -1,12 +0,0 @@
image: cnrancher/kube-explorer:{{build.tag}}
manifests:
-
image: cnrancher/kube-explorer:{{build.tag}}-linux-amd64
platform:
architecture: amd64
os: linux
-
image: cnrancher/kube-explorer:{{build.tag}}-linux-arm64
platform:
architecture: arm64
os: linux

View File

@@ -1,6 +1,7 @@
FROM alpine:3.13 FROM registry.suse.com/bci/bci-minimal:15.5
ARG TARGETARCH
COPY kube-explorer entrypoint.sh /usr/bin/ ARG TARGETOS
# Hack to make golang do files,dns search order ENV ARCH=${TARGETARCH:-"amd64"} OS=${TARGETOS:-"linux"}
ENV LOCALDOMAIN="" COPY package/entrypoint.sh /usr/bin/
COPY bin/kube-explorer-${OS}-${ARCH} /usr/bin/kube-explorer
ENTRYPOINT ["entrypoint.sh"] ENTRYPOINT ["entrypoint.sh"]

View File

@@ -5,6 +5,7 @@ source $(dirname $0)/version
OS_ARCH_ARG_LINUX="amd64 arm arm64" OS_ARCH_ARG_LINUX="amd64 arm arm64"
OS_ARCH_ARG_DARWIN="amd64 arm64" OS_ARCH_ARG_DARWIN="amd64 arm64"
OS_ARCH_ARG_WINDOWS="amd64"
LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION
-X github.com/rancher/steve/pkg/version.GitCommit=$COMMIT" -X github.com/rancher/steve/pkg/version.GitCommit=$COMMIT"
@@ -13,34 +14,58 @@ LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION
pushd $GIT_SOURCE pushd $GIT_SOURCE
if [ -n "$CROSS" ]; then case "$CROSS" in
for ARCH in ${OS_ARCH_ARG_LINUX}; do "push")
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH" for ARCH in ${OS_ARCH_ARG_LINUX}; do
echo "Building binary for linux/$ARCH..." OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \ echo "Building binary for linux/$ARCH..."
-ldflags \ GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
"$LD_INJECT_VALUES $LINKFLAGS" \ -ldflags \
-o ${OUTPUT_BIN} "$LD_INJECT_VALUES $LINKFLAGS" \
done -o ${OUTPUT_BIN}
done
;;
"tag")
for ARCH in ${OS_ARCH_ARG_LINUX}; do
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
echo "Building binary for linux/$ARCH..."
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
-ldflags \
"$LD_INJECT_VALUES $LINKFLAGS" \
-o ${OUTPUT_BIN}
done
for ARCH in ${OS_ARCH_ARG_DARWIN}; do for ARCH in ${OS_ARCH_ARG_DARWIN}; do
OUTPUT_BIN="bin/kube-explorer-darwin-$ARCH" OUTPUT_BIN="bin/kube-explorer-darwin-$ARCH"
echo "Building binary for darwin/$ARCH..." echo "Building binary for darwin/$ARCH..."
GOARCH=$ARCH GOOS=darwin CGO_ENABLED=0 go build -tags embed \ GOARCH=$ARCH GOOS=darwin CGO_ENABLED=0 go build -tags embed \
-ldflags \ -ldflags \
"$LD_INJECT_VALUES" \ "$LD_INJECT_VALUES" \
-o ${OUTPUT_BIN} -o ${OUTPUT_BIN}
done done
else
# only build one for current platform for ARCH in ${OS_ARCH_ARG_WINDOWS}; do
CGO_ENABLED=0 go build -tags embed \ OUTPUT_BIN="bin/kube-explorer-windows-$ARCH.exe"
-ldflags \ echo "Building binary for windows/$ARCH..."
"$LD_INJECT_VALUES $LINKFLAGS" \ GOARCH=$ARCH GOOS=windows CGO_ENABLED=0 go build -tags embed \
-o bin/kube-explorer -ldflags \
fi "$LD_INJECT_VALUES" \
-o ${OUTPUT_BIN}
done
;;
*)
# only build one for current platform
CGO_ENABLED=0 go build -tags embed \
-ldflags \
"$LD_INJECT_VALUES $LINKFLAGS" \
-o "bin/kube-explorer-$(uname | tr '[:upper:]' '[:lower:]')-${ARCH}"
;;
esac
mkdir -p $DAPPER_SOURCE/bin
for f in $(ls ./bin/); do for f in $(ls ./bin/); do
if [[ $f != *darwin-arm64 ]]; then if [[ $f != *darwin* ]]; then
upx -o $DAPPER_SOURCE/bin/$f bin/$f || true upx -o $DAPPER_SOURCE/bin/$f bin/$f || true
fi fi
if [ -f $DAPPER_SOURCE/bin/$f ]; then if [ -f $DAPPER_SOURCE/bin/$f ]; then

View File

@@ -4,15 +4,14 @@ mkdir -p $(dirname $GIT_SOURCE)
pushd $(dirname $GIT_SOURCE) pushd $(dirname $GIT_SOURCE)
git clone --depth=1 --branch ${GIT_BRANCH} https://github.com/niusmallnan/steve.git git clone --depth=1 --branch ${GIT_BRANCH} https://github.com/orangedeng/ke-steve.git steve
cd steve cd steve
git reset --hard ${GIT_COMMIT} git reset --hard ${GIT_COMMIT}
mkdir -p pkg/ui/ui/dashboard mkdir -p pkg/ui/ui/dashboard
cd pkg/ui/ui/dashboard cd pkg/ui/ui/dashboard
curl -sL https://pandaria-dashboard-ui.s3.ap-southeast-2.amazonaws.com/release-2.6-cn/kube-explorer-ui/${CATTLE_DASHBOARD_UI_VERSION}.tar.gz | tar xvzf - --strip-components=2 curl -sL https://pandaria-dashboard-ui.s3.ap-southeast-2.amazonaws.com/release-2.7-cn/kube-explorer-ui/${CATTLE_DASHBOARD_UI_VERSION}.tar.gz | tar xvzf - --strip-components=2
cp index.html ../index.html cp index.html ../index.html
popd popd
$(dirname $0)/hack_fs $GIT_SOURCE/pkg/ui/ui/

View File

@@ -1,42 +0,0 @@
#!/bin/bash
set -ex
#
# find . -type f -name "_*"
#
function hack_files() {
for f in $(find $1 -type f -name "_*"); do
name=$(basename $f)
updir=$(dirname $f)
new_path=$updir/${name:1}
echo "move $f $new_path"
mv $f $new_path
done
}
#
# find . -type d -name "_*"
#
function hack_dirs() {
for d in $(find $1 -mindepth 1 -maxdepth 1 -type d); do
if [[ ! -d $d ]]; then
continue
fi
name=$(basename $d)
if [[ ${name:0:1} == "_" ]]; then
updir=$(dirname $d)
new_path=$updir/${name:1}
echo "move $d $new_path"
mv $d $new_path
hack_dirs $new_path
continue
fi
hack_dirs $d
done
}
pushd $1
hack_files .
hack_dirs .
popd

View File

@@ -5,14 +5,6 @@ source $(dirname $0)/version
pushd $DAPPER_SOURCE pushd $DAPPER_SOURCE
if [ -f bin/kube-explorer-linux-${ARCH} ]; then docker build -f package/Dockerfile -t cnrancher/kube-explorer:$VERSION .
# For cross mode
cp bin/kube-explorer-linux-${ARCH} package/kube-explorer
else
# For common mode
cp bin/kube-explorer package/
fi
cd package
docker build -f Dockerfile -t cnrancher/kube-explorer:$VERSION .
popd popd