Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
RuVector/scripts/setup-gcs-examples.sh at main · BAS-More/RuVector · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
BAS-More
RuVector
Repository navigation
Code
Pull requests
7
(7)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
RuVector
/
scripts
/
setup-gcs-examples.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
120 lines (106 loc) · 4.12 KB
main
Breadcrumbs
RuVector
/
scripts
/
setup-gcs-examples.sh
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
120 lines (106 loc) · 4.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!
/bin/bash
#
Setup GCS bucket for RVF example hosting
#
Run once to create the infrastructure
#
#
Prerequisites:
#
- gcloud CLI authenticated
#
- GCP project set: gcloud config set project YOUR_PROJECT
#
#
Usage: bash scripts/setup-gcs-examples.sh
set
-euo pipefail
PROJECT_ID=
$(
gcloud config get-value project
)
BUCKET_NAME=
"
ruvector-examples
"
REGION=
"
us-central1
"
SA_NAME=
"
rvf-examples-sync
"
SA_EMAIL=
"
${SA_NAME}
@
${PROJECT_ID}
.iam.gserviceaccount.com
"
echo
"
=== RVF Examples GCS Setup ===
"
echo
"
Project:
$PROJECT_ID
"
echo
"
Bucket: gs://
$BUCKET_NAME
"
echo
"
Region:
$REGION
"
echo
"
"
#
1. Create bucket
echo
"
Creating GCS bucket...
"
gcloud storage buckets create
"
gs://
$BUCKET_NAME
"
\
--location=
"
$REGION
"
\
--uniform-bucket-level-access \
--public-access-prevention=inherited \
2>
/dev/null
||
echo
"
Bucket already exists
"
#
2. Enable public read access
echo
"
Setting public read access...
"
gcloud storage buckets add-iam-policy-binding
"
gs://
$BUCKET_NAME
"
\
--member=allUsers \
--role=roles/storage.objectViewer \
2>
/dev/null
||
echo
"
Already set
"
#
3. Set CORS policy for browser access
echo
"
Setting CORS policy...
"
cat
>
/tmp/cors.json
<<
'
CORS
'
[
{
"origin": ["*"],
"method": ["GET", "HEAD"],
"responseHeader": ["Content-Type", "Content-Length", "Content-Disposition"],
"maxAgeSeconds": 3600
}
]
CORS
gsutil cors
set
/tmp/cors.json
"
gs://
$BUCKET_NAME
"
rm /tmp/cors.json
#
4. Set lifecycle policy (archive old versions after 90 days)
echo
"
Setting lifecycle policy...
"
cat
>
/tmp/lifecycle.json
<<
'
LIFECYCLE
'
{
"rule": [
{
"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
"condition": {"age": 90, "matchesPrefix": ["v"]}
},
{
"action": {"type": "Delete"},
"condition": {"age": 365, "matchesPrefix": ["v"]}
}
]
}
LIFECYCLE
gsutil lifecycle
set
/tmp/lifecycle.json
"
gs://
$BUCKET_NAME
"
rm /tmp/lifecycle.json
#
5. Create service account for CI/CD
echo
"
Creating service account...
"
gcloud iam service-accounts create
"
$SA_NAME
"
\
--display-name=
"
RVF Examples Sync
"
\
2>
/dev/null
||
echo
"
Already exists
"
#
6. Grant write access to service account
echo
"
Granting write access...
"
gcloud storage buckets add-iam-policy-binding
"
gs://
$BUCKET_NAME
"
\
--member=
"
serviceAccount:
$SA_EMAIL
"
\
--role=roles/storage.objectAdmin \
2>
/dev/null
||
echo
"
Already set
"
#
7. Setup Workload Identity Federation for GitHub Actions
echo
"
Setting up Workload Identity Federation...
"
POOL_NAME=
"
github-pool
"
PROVIDER_NAME=
"
github-provider
"
gcloud iam workload-identity-pools create
"
$POOL_NAME
"
\
--location=global \
--display-name=
"
GitHub Actions Pool
"
\
2>
/dev/null
||
echo
"
Pool already exists
"
gcloud iam workload-identity-pools providers create-oidc
"
$PROVIDER_NAME
"
\
--location=global \
--workload-identity-pool=
"
$POOL_NAME
"
\
--issuer-uri=
"
https://token.actions.githubusercontent.com
"
\
--attribute-mapping=
"
google.subject=assertion.sub,attribute.repository=assertion.repository
"
\
--attribute-condition=
"
assertion.repository == 'ruvnet/ruvector'
"
\
2>
/dev/null
||
echo
"
Provider already exists
"
gcloud iam service-accounts add-iam-policy-binding
"
$SA_EMAIL
"
\
--role=roles/iam.workloadIdentityUser \
--member=
"
principalSet://iam.googleapis.com/projects/
$(
gcloud projects describe
$PROJECT_ID
--format=
'
value(projectNumber)
'
)
/locations/global/workloadIdentityPools/
$POOL_NAME
/attribute.repository/ruvnet/ruvector
"
\
2>
/dev/null
||
echo
"
Binding already set
"
echo
"
"
echo
"
=== Setup Complete ===
"
echo
"
"
echo
"
GitHub Secrets to configure:
"
echo
"
GCP_WIF_PROVIDER: projects/
$(
gcloud projects describe
$PROJECT_ID
--format=
'
value(projectNumber)
'
)
/locations/global/workloadIdentityPools/
$POOL_NAME
/providers/
$PROVIDER_NAME
"
echo
"
GCS_SERVICE_ACCOUNT:
$SA_EMAIL
"
echo
"
"
echo
"
To upload examples now:
"
echo
"
python3 scripts/generate-rvf-manifest.py -i examples/rvf/output/ -v
\$
(jq -r .version npm/packages/ruvector/package.json) -o examples/rvf/manifest.json
"
echo
"
gsutil -m cp examples/rvf/output/*.rvf gs://
$BUCKET_NAME
/v
\$
(jq -r .version npm/packages/ruvector/package.json)/
"
echo
"
gsutil cp examples/rvf/manifest.json gs://
$BUCKET_NAME
/manifest.json
"
You can’t perform that action at this time.