Skip to content

Commit

Permalink
Fix agent docker (#3288)
Browse files Browse the repository at this point in the history
  • Loading branch information
schoren authored Oct 20, 2023
1 parent fece173 commit 900f483
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
with:
distribution: goreleaser-pro
version: v1.21.2
args: release --clean --skip-announce -f .goreleaser.demo.yaml
args: release --clean --skip=announce -f .goreleaser.demo.yaml
env:
VERSION: ${{ github.ref_name}}-demo
TRACETEST_ENV: demo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
with:
distribution: goreleaser-pro
version: v1.21.2
args: release --skip-announce --snapshot -f .goreleaser.dev.yaml
args: release --skip=announce --snapshot -f .goreleaser.dev.yaml
- name: Move binaries to known location
if: steps.cache-docker-build.outputs.cache-hit != 'true'
run: |
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ dockers:
- image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}-amd64'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ dockers:
image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ dockers:
- image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}-amd64'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -121,6 +123,8 @@ dockers:
- image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}-arm64'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ dockers:
- image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}-amd64'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -131,6 +133,8 @@ dockers:
- image_templates:
- 'kubeshop/tracetest-agent:{{ .Env.VERSION }}-arm64'
dockerfile: "Dockerfile.agent"
extra_files:
- agent/
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.agent
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ENV TRACETEST_API_KEY ""
WORKDIR /app

COPY ./tracetest /app/tracetest
COPY ./agent/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

ENTRYPOINT [ "tracetest", "start", "--api-key", "$TRACETEST_API_KEY" ]
ENTRYPOINT ["/app/entrypoint.sh"]

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ WEB_SRC_FILES := $(shell find web -type f -not -path "*node_modules*" -not -path
web/build: web/node_modules $(WEB_SRC_FILES)
cd web; npm run build

dist/tracetest-docker-$(TAG).tar dist/tracetest-agent-docker-$(TAG).tar: $(CLI_SRC_FILES) $(SERVER_SRC_FILES) $(WEB_SRC_FILES)
goreleaser release --clean --skip-announce --snapshot -f .goreleaser.dev.yaml
dist/tracetest-docker-$(TAG).tar dist/tracetest-agent-docker-$(TAG).tar: $(CLI_SRC_FILES) $(SERVER_SRC_FILES) $(WEB_SRC_FILES) Dockerfile Dockerfile.agent agent/entrypoint.sh
goreleaser release --clean --skip=announce --snapshot -f .goreleaser.dev.yaml
docker save --output dist/tracetest-docker-$(TAG).tar "kubeshop/tracetest:$(TAG)"
docker save --output dist/tracetest-agent-docker-$(TAG).tar "kubeshop/tracetest-agent:$(TAG)"

Expand Down
10 changes: 10 additions & 0 deletions agent/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Validate that TRACETEST_API_KEY is not empty
if [ -z "$TRACETEST_API_KEY" ]; then
echo "Error: TRACETEST_API_KEY environment variable is empty." >&2
exit 1
fi

# Execute tracetest with the API key and any additional arguments
exec tracetest start --api-key "$TRACETEST_API_KEY" "$@"
2 changes: 1 addition & 1 deletion cli/cmd/start_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var startCmd = &cobra.Command{
Use: "start",
Short: "Start Tracetest",
Long: "Start using Tracetest",
PreRun: setupCommand(SkipConfigValidation()),
PreRun: setupCommand(SkipConfigValidation(), SkipVersionMismatchCheck()),
Run: WithResultHandler((func(_ *cobra.Command, _ []string) (string, error) {
ctx := context.Background()

Expand Down
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/golang-jwt/jwt v3.2.1+incompatible
github.com/goware/urlx v0.3.2
github.com/kubeshop/tracetest/agent v0.0.0-20230907210810-84198fc9f4ef
github.com/kubeshop/tracetest/server v0.0.0-20231010015728-ab7381aa0030
github.com/kubeshop/tracetest/server v0.0.0-20231013213457-a91e7a82c68b
github.com/pterm/pterm v0.12.55
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubeshop/tracetest/server v0.0.0-20231010015728-ab7381aa0030 h1:O5rDqsPEsWUCbQT1G2MTqdag5ypGzUyndX0N4T/PZO0=
github.com/kubeshop/tracetest/server v0.0.0-20231010015728-ab7381aa0030/go.mod h1:iN6NZ4zxLyoHbr3N4tGKADLtt65BlMpI+sbg1EOXTYg=
github.com/kubeshop/tracetest/server v0.0.0-20231013213457-a91e7a82c68b h1:hFCtNiKHH4RgAf3ZjJU3hlt7B2BanWVSicLAmI1khN4=
github.com/kubeshop/tracetest/server v0.0.0-20231013213457-a91e7a82c68b/go.mod h1:nFkdGSFBMpnxjz46moo28PkQys/nO5MdV7yLI+15dw4=
github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
Expand Down
3 changes: 2 additions & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e h1:BWhy2j3IXJhjCbC68Fp
github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
github.com/gogo/googleapis v1.4.0 h1:zgVt4UpGxcqVOw97aRGxT4svlcmdK35fynLNctY32zI=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 h1:+eHOFJl1BaXrQxKX+T06f78590z4qA2ZzBTqahsKSE4=
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8=
Expand Down Expand Up @@ -1238,6 +1237,7 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
Expand All @@ -1247,6 +1247,7 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri
golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down

0 comments on commit 900f483

Please sign in to comment.