From 7744d17d03926a59f13a998a07bd09c673d40a67 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 9 Jul 2025 12:41:47 -0600 Subject: chore: install rust-analyzer for vim lsp support --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 701b2422..578fbec0 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) setup: mise install mise exec go -- go install github.com/xlgmokha/minit@latest - mise exec rust -- rustup component add clippy rustfmt + mise exec rust -- rustup component add clippy rustfmt rust-analyzer mise exec rust -- cargo install --locked cedar-policy-cli # Cargo targets -- cgit v1.2.3 From d729c26ad1ffeda197b4747930a8135e972978e6 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 9 Jul 2025 15:28:31 -0600 Subject: chore: fix make target to support multiple policies --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 578fbec0..b90f8407 100644 --- a/Makefile +++ b/Makefile @@ -30,12 +30,12 @@ clean: fmt: @cargo fmt - @cedar format --policies etc/authzd/policy0.cedar --write + @for policy in etc/authzd/*.cedar; do cedar format --policies $$policy --write; done lint: @cargo clippy - @cedar check-parse --policies etc/authzd/policy0.cedar - @cedar format --policies etc/authzd/policy0.cedar --check + @for policy in etc/authzd/*.cedar; do cedar check-parse --policies $$policy; done + @for policy in etc/authzd/*.cedar; do cedar format --policies $$policy --check; done doc: @cargo doc --open -- cgit v1.2.3 From 63146ae4815b5d1f3c7a9ec18daac35034ab57e2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 09:27:40 -0600 Subject: chore: remove test-image target --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b90f8407..34a83424 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g') IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) .PHONY: build check test run clean fmt lint doc vendor -.PHONY: build-image run-image health-check list-services test-image +.PHONY: build-image run-image +.PHONY: health-check list-services setup: mise install -- cgit v1.2.3 From 0a4611de6cbb2787ba45db161c51b87fdc07ed5c Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 13:37:10 -0600 Subject: chore: add make targets to generate entities.json files --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 34a83424..bb33f295 100644 --- a/Makefile +++ b/Makefile @@ -57,3 +57,12 @@ health-check: list-services: @grpcurl -plaintext localhost:20000 list + +# entities targets +generate-staging-entities: + @cargo run --bin cli -- generate --host https://staging.gitlab.com --project authorization/sparkle/team --output etc/authzd/staging.gitlab.com/authorization/sparkle/team/entities.json + +generate-production-entities: + @cargo run --bin cli -- generate --project gitlab-org/gitlab --output etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json + @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/authzd --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/entities.json + @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/sparkled --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/entities.json -- cgit v1.2.3 From 13be2a41026e065db2ebe81b41817ad2e376b2cf Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 14:10:14 -0600 Subject: chore: shorten target names --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bb33f295..76b68ed2 100644 --- a/Makefile +++ b/Makefile @@ -59,10 +59,10 @@ list-services: @grpcurl -plaintext localhost:20000 list # entities targets -generate-staging-entities: +staging-entities: @cargo run --bin cli -- generate --host https://staging.gitlab.com --project authorization/sparkle/team --output etc/authzd/staging.gitlab.com/authorization/sparkle/team/entities.json -generate-production-entities: +production-entities: @cargo run --bin cli -- generate --project gitlab-org/gitlab --output etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/authzd --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/entities.json @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/sparkled --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/entities.json -- cgit v1.2.3 From 88d397e9c9a68d597074baa050c104399f192b6c Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 15:10:48 -0600 Subject: chore: move binaries to ./bin --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 76b68ed2..83392788 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ setup: # Cargo targets build: @cargo build --offline + @cp target/debug/authzd bin/authzd + @cargo build --bin cli --offline + @cp target/debug/cli bin/cli check: @cargo check @@ -23,7 +26,6 @@ test: @cargo test run: build - @cp target/debug/authzd bin/authzd @minit clean: -- cgit v1.2.3 From a6da9d3ad69cc996947d533c413bd43f489a7bd6 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 15:20:48 -0600 Subject: chore: update makefile to add targets for building binaries and checking env --- Makefile | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 83392788..deaff94c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ -PROJECT_NAME := $(shell basename $(shell pwd))# {{{}}} +AUTHZD_BIN := bin/authzd +CLI_BIN := bin/cli GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g') IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) +PROJECT_NAME := $(shell basename $(shell pwd)) .PHONY: build check test run clean fmt lint doc vendor .PHONY: build-image run-image .PHONY: health-check list-services +.PHONY: staging-entities production-entities setup: mise install @@ -12,13 +15,17 @@ setup: mise exec rust -- rustup component add clippy rustfmt rust-analyzer mise exec rust -- cargo install --locked cedar-policy-cli -# Cargo targets -build: - @cargo build --offline +$(AUTHZD_BIN): $(shell find src -name "*.rs" 2>/dev/null) Cargo.toml + @cargo build --bin authzd --offline @cp target/debug/authzd bin/authzd + +$(CLI_BIN): $(shell find src -name "*.rs" 2>/dev/null) Cargo.toml @cargo build --bin cli --offline @cp target/debug/cli bin/cli +# Cargo targets +build: $(AUTHZD_BIN) $(CLI_BIN) + check: @cargo check @@ -29,6 +36,7 @@ run: build @minit clean: + @rm -f $(AUTHZD_BIN) $(CLI_BIN) @cargo clean fmt: @@ -61,10 +69,17 @@ list-services: @grpcurl -plaintext localhost:20000 list # entities targets -staging-entities: - @cargo run --bin cli -- generate --host https://staging.gitlab.com --project authorization/sparkle/team --output etc/authzd/staging.gitlab.com/authorization/sparkle/team/entities.json - -production-entities: - @cargo run --bin cli -- generate --project gitlab-org/gitlab --output etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json - @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/authzd --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/entities.json - @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/sparkled --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/entities.json +check-gitlab-token: + @if [ -z "$$GITLAB_TOKEN" ]; then \ + echo "Error: GITLAB_TOKEN environment variable is required"; \ + echo "Set it with: export GITLAB_TOKEN=your_token"; \ + exit 1; \ + fi + +staging-entities: $(CLI_BIN) check-gitlab-token + @$(CLI_BIN) generate --host https://staging.gitlab.com --project authorization/sparkle/team --output etc/authzd/staging.gitlab.com/authorization/sparkle/team/entities.json + +production-entities: $(CLI_BIN) check-gitlab-token + @$(CLI_BIN) generate --project gitlab-org/gitlab --output etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json + @$(CLI_BIN) generate --project gitlab-org/software-supply-chain-security/authorization/authzd --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/entities.json + @$(CLI_BIN) generate --project gitlab-org/software-supply-chain-security/authorization/sparkled --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/entities.json -- cgit v1.2.3 From d13b79501e113a908cc3a4d38be1837869f717ea Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 10 Jul 2025 17:15:23 -0600 Subject: chore: define IMAGE_TAG after PROJECT_NAME --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index deaff94c..1c1bff8d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ AUTHZD_BIN := bin/authzd CLI_BIN := bin/cli GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g') -IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) PROJECT_NAME := $(shell basename $(shell pwd)) +IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) .PHONY: build check test run clean fmt lint doc vendor .PHONY: build-image run-image -- cgit v1.2.3