github.com/nais/knorten@v0.0.0-20240104110906-55926958e361/Makefile (about)

     1  .PHONY: env local local-offline generate-sql install-sqlc goose
     2  # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
     3  ifeq (,$(shell go env GOBIN))
     4  	GOBIN=$(shell go env GOPATH)/bin
     5  else
     6  	GOBIN=$(shell go env GOBIN)
     7  endif
     8  
     9  -include .env
    10  
    11  env:
    12  	echo "AZURE_APP_CLIENT_ID=$(shell kubectl get secret --context=knada --namespace=knada-system knorten -o jsonpath='{.data.AZURE_APP_CLIENT_ID}' | base64 -d)" > .env
    13  	echo "AZURE_APP_CLIENT_SECRET=$(shell kubectl get secret --context=knada --namespace=knada-system knorten -o jsonpath='{.data.AZURE_APP_CLIENT_SECRET}' | base64 -d)" >> .env
    14  	echo "AZURE_APP_TENANT_ID=$(shell kubectl get secret --context=knada --namespace=knada-system knorten -o jsonpath='{.data.AZURE_APP_TENANT_ID}' | base64 -d)" >> .env
    15  
    16  netpol:
    17  	$(shell kubectl get --context=knada --namespace=knada-system configmap/airflow-network-policy -o json | jq -r '.data."default-egress-airflow-worker.yaml"' > .default-egress-airflow-worker.yaml)
    18  
    19  local-online:
    20  	go run -race . \
    21  	  --admin-group=nada@nav.no \
    22  	  --airflow-chart-version=1.10.0 \
    23  	  --db-conn-string=postgres://postgres:postgres@localhost:5432/knorten \
    24  	  --db-enc-key=jegersekstentegn \
    25  	  --in-cluster=false \
    26  	  --jupyter-chart-version=2.0.0 \
    27  	  --oauth2-client-id=$(AZURE_APP_CLIENT_ID) \
    28  	  --oauth2-client-secret=$(AZURE_APP_CLIENT_SECRET) \
    29  	  --oauth2-tenant-id=$(AZURE_APP_TENANT_ID) \
    30  	  --project=nada-dev-db2e \
    31  	  --region=europe-north1 \
    32  	  --session-key online-session
    33  	  --zone=europe-north1-b \
    34  
    35  local:
    36  	HELM_REPOSITORY_CONFIG="./.helm-repositories.yaml" \
    37  	go run -race . \
    38  	  --admin-group=nada@nav.no \
    39  	  --airflow-chart-version=1.10.0 \
    40  	  --db-conn-string=postgres://postgres:postgres@localhost:5432/knorten \
    41  	  --db-enc-key=jegersekstentegn \
    42  	  --dry-run \
    43  	  --in-cluster=false \
    44  	  --jupyter-chart-version=2.0.0 \
    45  	  --project=nada-dev-db2e \
    46  	  --region=europe-north1 \
    47  	  --session-key offline-session
    48  	  --zone=europe-north1-b \
    49  
    50  generate-sql:
    51  	$(GOBIN)/sqlc generate
    52  
    53  install-sqlc:
    54  	go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
    55  
    56  # make goose cmd=status
    57  goose:
    58  	goose -dir pkg/database/migrations/ postgres "user=postgres password=postgres dbname=knorten host=localhost sslmode=disable" $(cmd)
    59  
    60  init:
    61  	go run local/main.go
    62  
    63  css:
    64  	npx tailwindcss --postcss -i local/tailwind.css -o assets/css/main.css
    65  
    66  css-watch:
    67  	npx tailwindcss --postcss -i local/tailwind.css -o assets/css/main.css -w
    68  
    69  test:
    70  	HELM_REPOSITORY_CONFIG="./.helm-repositories.yaml" go test -v ./... -count=1