Skip to content

Commit 4bdb9a7

Browse files
committed
fix(agent): redo directory structure so test/build work
1 parent 2436792 commit 4bdb9a7

22 files changed

+20
-19
lines changed

.github/workflows/build_agent_container.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ jobs:
5353
cd agent
5454
export TAGS="-t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:${{ github.sha }}"
5555
export REGISTRY=${REGISTRY@L}
56-
make docker-build-only
56+
# Get the last tag and use it as the env var AGENT_VERSION if it doesn't exist use 0.0.0+{github.sha}
57+
export AGENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0+${{ github.sha }}")
58+
make docker-build-only agent_version=${AGENT_VERSION}
5759
env:
5860
AGENT_IMAGE: ${{env.IMAGE_NAME}}/agent
5961

agent/Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ help: ## Display this help.
2727
venv: ## Sets up a python venv at `./venv`
2828
python3 -m venv venv
2929
$(VENV)pip install hatch coverage
30-
$(VENV)hatch config set dirs.project "[\"${PWD}\"]"
3130

3231
##@ Test
3332
.PHONY: test
@@ -46,14 +45,14 @@ format:
4645

4746
##@ Build
4847
.PHONY: build
49-
build: ## Builds using hatch to `skyhook-agent/dist`
50-
$(VENV)hatch -p skyhook-agent version ${1:unkown}
51-
$(VENV)hatch -p skyhook-agent build -c
48+
build: ## Builds using hatch to `dist`
49+
$(VENV)hatch version $(build_version)
50+
$(VENV)hatch build -c
5251

5352
##@ Publish
5453
.PHONY: publish
5554
publish: ## Publishes using hatch
56-
$(VENV)hatch -p skyhook-agent publish
55+
$(VENV)hatch publish
5756

5857
BUILD_ARGS ?=
5958
ifndef GITLAB_CI
@@ -70,7 +69,7 @@ ACTUAL_TAGS=$(shell echo "-t $(REGISTRY)/$(AGENT_IMAGE):$(shell date +%y.%m.%d-%
7069
.PHONY: docker-build-only
7170
docker-build-only:
7271
@echo "Building skyhook-agent docker image with tags: $(ACTUAL_TAGS)"
73-
docker buildx build $(BUILD_ARGS) --platform linux/amd64,linux/arm64 $(ACTUAL_TAGS) -f docker/Dockerfile .
72+
docker buildx build $(BUILD_ARGS) --build-arg AGENT_VERSION=$(AGENT_VERSION) --platform linux/amd64,linux/arm64 $(ACTUAL_TAGS) -f docker/Dockerfile .
7473

7574
##@ Docker Build
7675
.PHONY: docker-build

agent/docker/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM python:3.10-alpine as builder
1+
FROM python:3.12-alpine as builder
22

3-
ARG CI_COMMIT_TAG:-0.0.0
3+
ARG AGENT_VERSION:-0.0.0
44

55
COPY . /code
66
WORKDIR /code
77
RUN apk add bash make
88
RUN make venv
9-
RUN make build ${CI_COMMIT_TAG}
9+
RUN make build build_version=${AGENT_VERSION}
1010

11-
FROM python:3.10-alpine
11+
FROM python:3.12-alpine
1212

1313
RUN mkdir -p /skyhook-agent-wheels
1414
COPY --from=builder /code/skyhook-agent/dist/* /skyhook-agent-wheels

agent/hatch.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
mode = "local"
2+
13
[envs.default]
24
dependencies = [
35
"coverage[toml]",
@@ -16,7 +18,7 @@ cov = [
1618
]
1719

1820
[[envs.all.matrix]]
19-
python = ["3.8", "3.9", "3.10"]
21+
python = ["3.12"]
2022

2123
[envs.lint]
2224
detached = true
@@ -40,6 +42,3 @@ all = [
4042
"style",
4143
"typing",
4244
]
43-
44-
[version]
45-
source = "vcs"

agent/skyhook-agent/README.md

Whitespace-only changes.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-vcs"]
2+
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -34,6 +34,7 @@ Source = "https://github.com/nvidia.com/skyhook"
3434
[project.scripts]
3535
controller = "skyhook_agent.controller:cli"
3636

37+
3738
[tool.hatch.version]
3839
path = "src/skyhook_agent/__about__.py"
3940

@@ -61,8 +62,8 @@ omit = [
6162
]
6263

6364
[tool.coverage.paths]
64-
skyhook_agent = ["src/skyhook_agent", "*/skyhook-agent/src/skyhook_agent"]
65-
tests = ["tests", "*/skyhook-agent/tests"]
65+
skyhook_agent = ["src/skyhook_agent", "*/src/skyhook_agent"]
66+
tests = ["tests", "*/tests"]
6667

6768
[tool.coverage.report]
6869
exclude_lines = [
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
#
4-
__version__ = "0.0.6"
4+
__version__ = "0.0.0"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)