Skip to content

Commit 27df03c

Browse files
committed
workout
1 parent 75a6738 commit 27df03c

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ env:
1616
GH_REGISTRY: ghcr.io
1717
IMAGE_NAME: ${{ github.repository }}
1818
RELEASE_VERSION: ${{ github.ref_name }}
19+
SCANNER_IMG_VERSION: v1.0.10
20+
SNIFFER_IMG_VERSION: v1.1.8
1921

2022
jobs:
2123
goreleaser:
@@ -89,6 +91,8 @@ jobs:
8991
${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
9092
build-args: |
9193
VERSION=${{ env.RELEASE_VERSION }}
94+
SCANNER_IMG_VERSION=${{ env.SCANNER_IMG_VERSION }}
95+
SNIFFER_IMG_VERSION=${{ env.SNIFFER_IMG_VERSION }}
9296
9397
- name: Sign artifact
9498
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY . /build
66
WORKDIR /build
77

88
RUN go mod download && \
9-
CGO_ENABLED=0 GO111MODULE=on go build -ldflags="-X 'main.appName=NetAssert' -X 'main.version=${VERSION}'" -v -o /netassertv2 cmd/netassert/cli/*.go && \
9+
CGO_ENABLED=0 GO111MODULE=on go build -ldflags="-X 'main.appName=NetAssert' -X 'main.version=${VERSION}' -X 'main.scannerImgVersion=${SCANNER_IMG_VERSION}' -X 'main.snifferImgVersion=${SNIFFER_IMG_VERSION}'" -v -o /netassertv2 cmd/netassert/cli/*.go && \
1010
ls -ltr /netassertv2
1111

1212
FROM gcr.io/distroless/base:nonroot

cmd/netassert/cli/root.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
// these variables are overwritten at build time using ldflags
910
var (
10-
version = "v2.0.0-dev" // netassert version
11-
appName = "NetAssert" // name of the application
12-
gitHash = "" // the git hash of the build
13-
buildDate = "" // build date, will be injected by the build system
11+
version = "v2.0.0-dev" // netassert version
12+
appName = "NetAssert" // name of the application
13+
gitHash = "" // the git hash of the build
14+
buildDate = "" // build date, will be injected by the build system
15+
scannerImgVersion = "latest" // scanner container image version
16+
snifferImgVersion = "latest" // sniffer container image version
1417
)
1518

1619
var rootCmd = &cobra.Command{

cmd/netassert/cli/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ type runCmdConfig struct {
3535
var runCmdCfg = runCmdConfig{
3636
TapFile: "results.tap", // name of the default TAP file where the results will be written
3737
SuffixLength: 9, // suffix length of the random string to be appended to the container name
38-
SnifferContainerImage: "docker.io/controlplane/netassertv2-packet-sniffer:v1.1.7",
38+
SnifferContainerImage: fmt.Sprintf("%s:%s", "docker.io/controlplane/netassertv2-packet-sniffer", snifferImgVersion),
3939
SnifferContainerPrefix: "netassertv2-sniffer",
40-
ScannerContainerImage: "docker.io/controlplane/netassertv2-l4-client:v1.0.6",
40+
ScannerContainerImage: fmt.Sprintf("%s:%s", "docker.io/controlplane/netassertv2-l4-client", scannerImgVersion),
4141
ScannerContainerPrefix: "netassertv2-client",
4242
PauseInSeconds: 1, // seconds to pause before each test case
4343
PacketCaptureInterface: `eth0`, // the interface used by the sniffer image to capture traffic

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "0.0.1"
55

66
# build the binary in ./bin folder
77
build:
8-
go build -ldflags="-X 'main.appName=NetAssert' -X 'main.version=2.0.0-dev'" -o bin/netassert cmd/netassert/cli/*.go
8+
go build -o bin/netassert cmd/netassert/cli/*.go
99

1010
# build and run the binary
1111
run: build

0 commit comments

Comments
 (0)