Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganise repo #4

Merged
merged 4 commits into from
Nov 17, 2023
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- run: go mod download
- run: make
- prometheus/store_artifact:
file: batchjob_exporter
file: ./bin/batchjob_exporter
test-arm:
executor: arm
steps:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ go.work
# Ignore fixtures
collector/fixtures/sys

# Ignore binary
**/*batchjob_exporter

# Ignore scripts
run.sh

Expand All @@ -34,3 +31,6 @@ run.sh
/.deps
/.release
/.tarballs

# Ignore binaries
/bin
1 change: 1 addition & 0 deletions .promu-cgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repository:
build:
binaries:
- name: batchjob_exporter
path: ./cmd/batchjob_exporter
flags: -a -tags 'netgo osusergo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
Expand Down
1 change: 1 addition & 0 deletions .promu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository:
build:
binaries:
- name: batchjob_exporter
path: ./cmd/batchjob_exporter
flags: -a -tags 'netgo osusergo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ PROMTOOL_VERSION ?= 2.30.0
PROMTOOL_URL ?= https://github.com/prometheus/prometheus/releases/download/v$(PROMTOOL_VERSION)/prometheus-$(PROMTOOL_VERSION).$(GO_BUILD_PLATFORM).tar.gz
PROMTOOL ?= $(FIRST_GOPATH)/bin/promtool

PREFIX := $(shell pwd)/bin

TEST_DOCKER ?= false
DOCKER_IMAGE_NAME ?= batchjob-exporter
MACH ?= $(shell uname -m)
Expand Down Expand Up @@ -101,17 +103,17 @@ skip-test-32bit:
%/.unpacked: %.ttar
@echo ">> extracting fixtures"
if [ -d $(dir $@) ] ; then rm -rf $(dir $@) ; fi
./ttar -C $(dir $*) -x -f $*.ttar
./scripts/ttar -C $(dir $*) -x -f $*.ttar
touch $@

update_fixtures:
rm -vf collector/fixtures/sys/.unpacked
./ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys
./scripts/ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys

.PHONY: test-e2e
test-e2e: build collector/fixtures/sys/.unpacked
@echo ">> running end-to-end tests"
./e2e-test.sh
./scripts/e2e-test.sh

.PHONY: skip-test-e2e
skip-test-e2e:
Expand All @@ -120,7 +122,7 @@ skip-test-e2e:
.PHONY: checkmetrics
checkmetrics: $(PROMTOOL)
@echo ">> checking metrics for correctness"
./checkmetrics.sh $(PROMTOOL) $(e2e-out)
./scripts/checkmetrics.sh $(PROMTOOL) $(e2e-out)

.PHONY: checkrules
checkrules: $(PROMTOOL)
Expand All @@ -130,7 +132,7 @@ checkrules: $(PROMTOOL)
.PHONY: test-docker
test-docker:
@echo ">> testing docker image"
./test_image.sh "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-amd64:$(DOCKER_IMAGE_TAG)" 9010
./scripts/test_image.sh "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-amd64:$(DOCKER_IMAGE_TAG)" 9010

.PHONY: skip-test-docker
skip-test-docker:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions e2e-test.sh → scripts/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euf -o pipefail

cd "$(dirname $0)"
cd "$(dirname $0)/.."

port="$((10000 + (RANDOM % 10000)))"
tmpdir=$(mktemp -d /tmp/batchjob_exporter_e2e_test.XXXXXX)
Expand Down Expand Up @@ -44,13 +44,13 @@ do
esac
done

if [ ! -x ./batchjob_exporter ]
if [ ! -x ./bin/batchjob_exporter ]
then
echo './batchjob_exporter not found. Consider running `go build` first.' >&2
echo './bin/batchjob_exporter not found. Consider running `go build` first.' >&2
exit 1
fi

PATH=$PWD/collector/fixtures:$PATH ./batchjob_exporter \
PATH=$PWD/collector/fixtures:$PATH ./bin/batchjob_exporter \
--path.sysfs="collector/fixtures/sys" \
--path.cgroupfs="collector/fixtures/sys/fs/cgroup" \
--collector.slurm.unique.jobid \
Expand Down
File renamed without changes.
File renamed without changes.