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
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions cmd/access-helper/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
)
6 changes: 1 addition & 5 deletions cmd/nclet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading