diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e43068f..5baf181 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,9 +96,6 @@ jobs: context: . file: ./cmd/nclet/Dockerfile push: true - build-args: | - DEFAULT_SSH_USERNAME=${{ secrets.NCLET_DEFAULT_SSH_USERNAME }} - DEFAULT_SSH_PASSWORD=${{ secrets.NCLET_DEFAULT_SSH_PASSWORD }} tags: | asia-northeast1-docker.pkg.dev/networkcontest/janog55/netcon-pms-nclet:latest asia-northeast1-docker.pkg.dev/networkcontest/janog55/netcon-pms-nclet:master diff --git a/cmd/access-helper/labels.go b/cmd/access-helper/labels.go index e0577b5..fe9fc76 100644 --- a/cmd/access-helper/labels.go +++ b/cmd/access-helper/labels.go @@ -2,6 +2,16 @@ package main // These are the label keys that we can customize how to access Node in ContainerLab. const ( + // defaultUsername is a default username for SSH access. + // You can override this value when building access-helper with -ldflags. + // ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208 + defaultSSHUsername string = "clab" + + // defaultPassword is a default password for SSH access. + // You can override this value when building access-helper with -ldflags. + // ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208 + defaultSSHPassword string = "clab@123" + // AccessMethodKey is the label key to specify the access method. // The possible values are either "ssh" or "exec". // With "ssh", access-helper will try to connect to the Node via SSH. @@ -38,15 +48,3 @@ const ( execCommandKey = "netcon.janog.gr.jp/execCommand" defaultExecCommand = "sh" ) - -var ( - // defaultUsername is a default username for SSH access. - // You can override this value when building access-helper with -ldflags. - // ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208 - defaultSSHUsername string - - // defaultPassword is a default password for SSH access. - // You can override this value when building access-helper with -ldflags. - // ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208 - defaultSSHPassword string -) diff --git a/cmd/nclet/Dockerfile b/cmd/nclet/Dockerfile index bf26977..2b6fa2b 100644 --- a/cmd/nclet/Dockerfile +++ b/cmd/nclet/Dockerfile @@ -22,9 +22,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -o nc # Build the access-helper binary FROM golang:1.23 as access-helper_builder -ARG DEFAULT_SSH_USERNAME -ARG DEFAULT_SSH_PASSWORD - WORKDIR /workspace COPY go.mod go.mod COPY go.sum go.sum @@ -36,8 +33,7 @@ COPY pkg/ pkg/ # Build RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 \ - go build -o access-helper -ldflags="-X main.defaultSSHUsername=${DEFAULT_SSH_USERNAME} -X main.defaultSSHPassword=${DEFAULT_SSH_PASSWORD}" ./cmd/access-helper - + go build -o access-helper ./cmd/access-helper # Build the containerlab binary FROM golang:1.23 as containerlab_builder