Skip to content

Commit 11c3508

Browse files
committed
make GCS support enabled by default
1 parent f71d6b5 commit 11c3508

File tree

5 files changed

+21
-36
lines changed

5 files changed

+21
-36
lines changed

AUTHORIZATION.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type AuthConfigSource interface {
7373

7474
- **`github.com/openshift-eng/cyborg-data`**: External reusable core package for organizational data access
7575
- Supports multiple data sources (files, GCS)
76-
- Build with `-tags gcs` for cloud storage support
76+
- GCS support included by default
7777
- Hot reload with configurable check intervals
7878
- **`pkg/orgdata/`**: Slack-specific wrapper around core package
7979
- **`pkg/slack/`**: Slack command handlers with authorization middleware
@@ -94,8 +94,8 @@ type AuthConfigSource interface {
9494
#### Option B: Google Cloud Storage (Production)
9595

9696
```bash
97-
# Build with GCS support
98-
make BUILD_FLAGS="-tags gcs" build
97+
# Build (GCS support included by default)
98+
make build
9999

100100
# Run with GCS backend
101101
./ci-chat-bot \
@@ -329,7 +329,7 @@ service := orgdata.NewIndexedOrgDataService()
329329
// Option 1: Load from local files
330330
err := service.LoadFromFiles([]string{"comprehensive_index.json"})
331331

332-
// Option 2: Load from GCS (requires -tags gcs)
332+
// Option 2: Load from GCS
333333
gcsConfig := orgdata.GCSConfig{
334334
Bucket: "resolved-org",
335335
ObjectPath: "orgdata/comprehensive_index.json",
@@ -371,9 +371,9 @@ The `AuthorizedCommandHandler` wrapper:
371371
### Common Issues
372372

373373
**"Authorization service not configured"**
374-
- **Local files**: Check `--orgdata-paths` and `--authorization-config` flags
374+
- **Local files**: Check `--orgdata-paths` and `--authorization-config` flags
375375
- **GCS**: Verify `--gcs-enabled=true` and GCS configuration flags
376-
- **Build**: Ensure binary built with `-tags gcs` for GCS support
376+
- **Build**: GCS support is included in all builds by default
377377
- **Authentication**: Run `gcloud auth login` or set service account credentials
378378
- **Logs**: Check for data loading errors, GCS authentication failures
379379

@@ -408,7 +408,7 @@ The system can load organizational data from multiple sources:
408408
```
409409
- **Best for**: Production, cross-cluster deployments
410410
- **Hot Reload**: Configurable polling (default: 5 minutes)
411-
- **Dependencies**: Requires `-tags gcs` build flag
411+
- **Dependencies**: GCS support included by default
412412
- **Authentication**: Application Default Credentials or service account JSON
413413

414414
### Development Scripts

Makefile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ build_date=$(shell date -u '+%Y%m%d')
99
version=v${build_date}-${git_commit}
1010

1111
SOURCE_GIT_TAG=v1.0.0+$(shell git rev-parse --short=7 HEAD)
12-
# Use standard GO_BUILD_FLAGS for build tags (e.g., -tags gcs)
13-
GO_BUILD_FLAGS ?=
12+
# GCS support is enabled by default - append to build machinery's defaults
13+
GO_BUILD_FLAGS += -tags gcs
1414

1515
# Extend OpenShift's standard ldflags
1616
GO_LD_EXTRAFLAGS=-X github.com/openshift/ci-chat-bot/vendor/k8s.io/client-go/pkg/version.gitCommit=$(shell git rev-parse HEAD) -X github.com/openshift/ci-chat-bot/vendor/k8s.io/client-go/pkg/version.gitVersion=${SOURCE_GIT_TAG} -X sigs.k8s.io/prow/version.Name=ci-chat-bot -X sigs.k8s.io/prow/version.Version=${version}
1717
GOLINT=golangci-lint run
1818

19-
# Build with GCS support enabled
20-
build-gcs:
21-
$(MAKE) GO_BUILD_FLAGS="-tags gcs" build
22-
.PHONY: build-gcs
23-
2419
debug:
2520
go build $(GO_BUILD_FLAGS) -gcflags="all=-N -l" $(GO_LD_FLAGS) $(GO_MOD_FLAGS) -o ci-chat-bot ./cmd/...
2621
.PHONY: debug
@@ -49,15 +44,14 @@ run-local:
4944

5045
help-ci-chat-bot:
5146
@echo "CI Chat Bot specific targets:"
52-
@echo " build - Build ci-chat-bot binary (standard OpenShift build)"
53-
@echo " build-gcs - Build with GCS support enabled (-tags gcs)"
47+
@echo " build - Build ci-chat-bot binary (GCS support included by default)"
5448
@echo " debug - Build with debug symbols"
5549
@echo " run - Run ci-chat-bot with hack/run.sh (auto-detects GCS vs local)"
5650
@echo " run-gcs - Run with GCS backend explicitly"
5751
@echo " run-local - Run with local file backend explicitly"
5852
@echo ""
5953
@echo "Build flags:"
60-
@echo " GO_BUILD_FLAGS - Standard OpenShift build flags (e.g., GO_BUILD_FLAGS='-tags gcs' make build)"
54+
@echo " GO_BUILD_FLAGS - Standard OpenShift build flags for custom tags"
6155
@echo ""
6256
@echo "Environment variables for hack scripts:"
6357
@echo " USE_GCS_ORGDATA - Set to 'true' to use GCS backend"
@@ -67,8 +61,7 @@ help-ci-chat-bot:
6761
@echo " AUTH_CONFIG - Authorization config file path"
6862
@echo ""
6963
@echo "Examples:"
70-
@echo " make build-gcs # Build with GCS support (recommended)"
71-
@echo " make GO_BUILD_FLAGS='-tags gcs' build # Build with GCS using OpenShift standard"
64+
@echo " make build # Build with all features (GCS included)"
7265
@echo " make run-gcs # Run with GCS backend"
7366
@echo " ORGDATA_PATHS=/my/file.json make run # Run with custom local file"
7467
.PHONY: help-ci-chat-bot

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ To see the available commands, type `help`.
2020
- **Hot reload**: Both file watching and GCS polling for live updates
2121
- **Pluggable architecture**: Easy to extend with new data sources
2222

23-
### 🚀 **Production Ready**
23+
### 🚀 **Production Ready**
2424
- **Fast performance**: O(1) organizational lookups with pre-computed indexes
2525
- **Thread-safe**: Concurrent access with read-write mutex protection
26-
- **Build flexibility**: Optional GCS support with build tags (`-tags gcs`)
26+
- **GCS support**: Cloud storage support included by default
2727
- **Secure authentication**: Application Default Credentials for GCS
2828

2929
## Quick Start
@@ -39,8 +39,8 @@ export ORGDATA_PATHS="/path/to/comprehensive_index.json"
3939

4040
### Option 2: Google Cloud Storage
4141
```bash
42-
# Build with GCS support
43-
make BUILD_FLAGS="-tags gcs" build
42+
# Build (GCS support included by default)
43+
make build
4444

4545
# Quick start with GCS
4646
./hack/run-with-gcs.sh
@@ -66,12 +66,9 @@ export GCS_OBJECT_PATH="orgdata/comprehensive_index.json"
6666
## Build Options
6767

6868
```bash
69-
# Standard build (file-based data sources only)
69+
# Build (includes both file-based and GCS data sources)
7070
make build
7171

72-
# Build with GCS support
73-
make BUILD_FLAGS="-tags gcs" build
74-
7572
# See all available targets
7673
make help-ci-chat-bot
7774
```

hack/run.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ oc --context app.ci -n ci get secrets ci-chat-bot-slack-app --template='{{index
2424

2525
work_dir=$(readlink -f $(dirname $0)/..)
2626

27-
# Determine build flags based on configuration
28-
build_flags=""
27+
# Determine orgdata configuration
2928
orgdata_flags=""
3029

3130
# Check if GCS is enabled
3231
if [[ "${USE_GCS_ORGDATA:-false}" == "true" ]]; then
33-
echo "Building with GCS support..."
34-
build_flags="-tags gcs"
35-
32+
echo "Using GCS backend..."
33+
3634
# GCS configuration with defaults
3735
GCS_BUCKET="${GCS_BUCKET:-resolved-org}"
3836
GCS_OBJECT_PATH="${GCS_OBJECT_PATH:-orgdata/comprehensive_index.json}"
@@ -71,7 +69,7 @@ fi
7169
AUTH_CONFIG="${AUTH_CONFIG:-${work_dir}/test-authorization.yaml}"
7270

7371
echo "Building ci-chat-bot..."
74-
make GO_BUILD_FLAGS="$build_flags"
72+
make
7573

7674
echo "Starting ci-chat-bot with $(echo $orgdata_flags | cut -d' ' -f1) backend..."
7775
./ci-chat-bot \

pkg/orgdata/gcs_support.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build gcs
2-
// +build gcs
3-
41
package orgdata
52

63
import (

0 commit comments

Comments
 (0)