Skip to content

Commit 093ca62

Browse files
authored
Add install-local command for portable CI/CD installation (#8)
1 parent 082c6c2 commit 093ca62

5 files changed

Lines changed: 430 additions & 5 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,10 @@ enc_keys/
6969
test_dec_keys/
7070
secureflow.yaml
7171

72+
# Local installation (optional - can be committed for portable CI/CD)
73+
# Uncomment these lines if you don't want to commit the local installation:
74+
# .secureflow/
75+
# secureflow.sh
76+
7277
# End of file
7378

README.md

Lines changed: 180 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,68 @@ go build -o secureflow
120120
sudo mv secureflow /usr/local/bin/
121121
```
122122

123+
### Local Installation for CI/CD
124+
125+
SecureFlow provides a convenient `install-local` command that sets up a portable installation without requiring system-wide installation. This is perfect for CI/CD pipelines where you can't or don't want to install binaries globally.
126+
127+
```bash
128+
# Run this once to set up local installation
129+
secureflow install-local
130+
```
131+
132+
This command will:
133+
- Download platform-specific executables (Linux, macOS, Windows) to `.secureflow/` directory
134+
- Create a `secureflow.sh` launcher script in the current directory
135+
- The launcher automatically detects your platform and runs the correct executable
136+
137+
**Usage in CI/CD:**
138+
139+
```bash
140+
# In your CI/CD pipeline
141+
./secureflow.sh decrypt --password "$SECUREFLOW_PASSWORD" --non-interactive
142+
./secureflow.sh encrypt --password "$SECUREFLOW_PASSWORD" --non-interactive
143+
```
144+
145+
**Benefits:**
146+
- ✅ No system installation required
147+
- ✅ Works across different platforms automatically
148+
- ✅ Portable - commit `.secureflow/` and `secureflow.sh` to your repo
149+
- ✅ Perfect for CI/CD environments with restricted permissions
150+
151+
**Example: Using in GitHub Actions**
152+
153+
**Option A: Install during CI/CD run**
154+
```yaml
155+
steps:
156+
- uses: actions/checkout@v3
157+
158+
- name: Setup SecureFlow locally
159+
run: |
160+
wget https://github.com/MayR-Labs/secureflow-go/releases/latest/download/secureflow-linux-amd64
161+
chmod +x secureflow-linux-amd64
162+
./secureflow-linux-amd64 install-local
163+
164+
- name: Decrypt secrets
165+
run: ./secureflow.sh decrypt --password "${{ secrets.SECUREFLOW_PASSWORD }}" --non-interactive
166+
```
167+
168+
**Option B: Commit installation to repo (no CI/CD setup needed)**
169+
```bash
170+
# Run locally once
171+
secureflow install-local
172+
git add .secureflow/ secureflow.sh
173+
git commit -m "Add portable SecureFlow"
174+
```
175+
176+
Then your CI/CD workflow is simply:
177+
```yaml
178+
steps:
179+
- uses: actions/checkout@v3
180+
181+
- name: Decrypt secrets
182+
run: ./secureflow.sh decrypt --password "${{ secrets.SECUREFLOW_PASSWORD }}" --non-interactive
183+
```
184+
123185
### Verify Installation
124186
125187
```bash
@@ -241,9 +303,11 @@ secureflow test --password "your_password" --non-interactive
241303

242304
```bash
243305
secureflow --help
306+
secureflow init --help
244307
secureflow encrypt --help
245308
secureflow decrypt --help
246309
secureflow test --help
310+
secureflow install-local --help
247311
```
248312

249313
---
@@ -314,7 +378,86 @@ See the [Configuration Guide](./docs/configuration.md) for detailed examples inc
314378

315379
SecureFlow is designed to work seamlessly in CI/CD pipelines with its non-interactive mode.
316380

317-
### Quick CI/CD Example (GitHub Actions)
381+
### Method 1: Local Installation (Recommended)
382+
383+
The easiest approach for CI/CD is to use `install-local` which creates a portable installation.
384+
385+
**Approach A: Download and install during each CI/CD run**
386+
387+
```yaml
388+
name: Deploy
389+
390+
on:
391+
push:
392+
branches: [main]
393+
394+
jobs:
395+
deploy:
396+
runs-on: ubuntu-latest
397+
398+
steps:
399+
- uses: actions/checkout@v3
400+
401+
# Download and setup SecureFlow (no sudo required)
402+
- name: Setup SecureFlow
403+
run: |
404+
wget https://github.com/MayR-Labs/secureflow-go/releases/latest/download/secureflow-linux-amd64
405+
chmod +x secureflow-linux-amd64
406+
./secureflow-linux-amd64 install-local
407+
408+
# Use the launcher script
409+
- name: Decrypt secrets
410+
run: |
411+
./secureflow.sh decrypt --password "${{ secrets.SECUREFLOW_PASSWORD }}" --non-interactive
412+
413+
# Build and deploy
414+
- name: Build & Deploy
415+
run: |
416+
npm run build
417+
./deploy.sh
418+
```
419+
420+
**Approach B: Commit the local installation to your repo (Recommended for simplicity)**
421+
422+
Run `secureflow install-local` once locally, then commit the files:
423+
424+
```bash
425+
# Run locally (one-time setup)
426+
secureflow install-local
427+
git add .secureflow/ secureflow.sh
428+
git commit -m "Add portable SecureFlow installation"
429+
git push
430+
```
431+
432+
Your CI/CD workflow becomes very simple (no installation step needed):
433+
434+
```yaml
435+
name: Deploy
436+
437+
on:
438+
push:
439+
branches: [main]
440+
441+
jobs:
442+
deploy:
443+
runs-on: ubuntu-latest
444+
445+
steps:
446+
- uses: actions/checkout@v3
447+
448+
# No installation needed - files are already in the repo!
449+
- name: Decrypt secrets
450+
run: |
451+
./secureflow.sh decrypt --password "${{ secrets.SECUREFLOW_PASSWORD }}" --non-interactive
452+
453+
# Build and deploy
454+
- name: Build & Deploy
455+
run: |
456+
npm run build
457+
./deploy.sh
458+
```
459+
460+
### Method 2: Global Installation
318461

319462
```yaml
320463
name: Deploy
@@ -330,7 +473,7 @@ jobs:
330473
steps:
331474
- uses: actions/checkout@v3
332475
333-
# Install SecureFlow
476+
# Install SecureFlow globally
334477
- name: Install SecureFlow
335478
run: |
336479
wget https://github.com/MayR-Labs/secureflow-go/releases/latest/download/secureflow-linux-amd64
@@ -479,13 +622,44 @@ secureflow decrypt
479622

480623
### CI/CD Deployment
481624

482-
Add to your CI/CD pipeline (example: GitHub Actions):
625+
**Option 1: Using install-local (recommended)**
626+
627+
```bash
628+
# One-time setup
629+
secureflow install-local
630+
631+
# In your CI/CD pipeline
632+
./secureflow.sh decrypt --password ${{ secrets.SECUREFLOW_PASSWORD }} --non-interactive
633+
```
634+
635+
**Option 2: Global installation**
483636

484637
```yaml
485638
- name: Decrypt secrets
486639
run: secureflow decrypt --password ${{ secrets.SECUREFLOW_PASSWORD }} --non-interactive
487640
```
488641

642+
### Portable CI/CD Setup
643+
644+
For teams that want a fully portable solution, commit the local installation to your repo:
645+
646+
```bash
647+
# One-time setup in your repository
648+
secureflow install-local
649+
git add .secureflow/ secureflow.sh
650+
git commit -m "Add portable SecureFlow installation"
651+
652+
# Your CI/CD config becomes very simple:
653+
# - name: Decrypt secrets
654+
# run: ./secureflow.sh decrypt --password "$PASSWORD" --non-interactive
655+
```
656+
657+
This approach:
658+
- ✅ No installation step needed in CI/CD
659+
- ✅ Works across all platforms automatically
660+
- ✅ Consistent versions across all environments
661+
- ✅ Faster CI/CD runs (no download/install time)
662+
489663
### Team Onboarding
490664

491665
New team member joining:
@@ -523,7 +697,9 @@ secureflow-go/
523697
│ ├── encrypt.go # Encryption command
524698
│ ├── decrypt.go # Decryption command
525699
│ ├── test.go # Test decryption command
526-
│ └── init.go # Initialize config command
700+
│ ├── init.go # Initialize config command
701+
│ ├── install_local.go # Local installation command
702+
│ └── secureflow.sh # Launcher script template
527703
528704
├── internal/ # Internal packages
529705
│ ├── crypto/ # Encryption/decryption logic

0 commit comments

Comments
 (0)