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
@@ -20,27 +20,36 @@ Pipeleak is a CLI tool designed to scan CI/CD logs and artifacts for secrets acr
20
20
pipeleak/
21
21
├── src/pipeleak/ # Main Go module
22
22
│ ├── cmd/ # CLI commands (using Cobra)
23
-
│ │ ├── gitlab/ # GitLab-specific commands
24
-
│ │ ├── github/ # GitHub-specific commands
25
23
│ │ ├── bitbucket/ # BitBucket-specific commands
26
24
│ │ ├── devops/ # Azure DevOps commands
25
+
│ │ ├── docs/ # Documentation command
27
26
│ │ ├── gitea/ # Gitea commands
28
-
│ │ └── docs/ # Documentation command
27
+
│ │ ├── github/ # GitHub-specific commands
28
+
│ │ ├── gitlab/ # GitLab-specific commands
29
29
│ ├── pkg/ # Core business logic packages
30
30
│ │ ├── archive/ # Archive handling
31
+
│ │ ├── bitbucket/ # BitBucket business logic
31
32
│ │ ├── config/ # Configuration management
32
-
│ │ ├── gitlab/ # GitLab functionality
33
-
│ │ ├── github/ # GitHub functionality
34
-
│ │ └── ... # Platform-specific packages
33
+
│ │ ├── devops/ # Azure DevOps business logic
34
+
│ │ ├── docs/ # Documentation generation
35
+
│ │ ├── format/ # Formatting helpers
36
+
│ │ ├── gitea/ # Gitea business logic
37
+
│ │ ├── github/ # GitHub business logic
38
+
│ │ ├── gitlab/ # GitLab business logic
39
+
│ │ ├── httpclient/ # HTTP client helpers
40
+
│ │ ├── logging/ # Logging helpers
41
+
│ │ ├── scan/ # Scan logic
42
+
│ │ ├── scanner/ # Scanner engine
43
+
│ │ ├── system/ # System helpers
35
44
│ ├── tests/ # Test files
36
-
│ │ └── e2e/ # End-to-end tests
37
-
│ ├── main.go # Application entry point
38
-
│ ├── go.mod # Go module definition
39
-
│ └── go.sum # Dependency checksums
45
+
│ │ └── e2e/ # End-to-end tests
46
+
│ ├── main.go # Application entry point
47
+
│ ├── go.mod # Go module definition
48
+
│ └── go.sum # Dependency checksums
40
49
├── docs/ # Documentation (MkDocs)
41
50
├── .github/ # GitHub workflows and configs
42
-
│ └── workflows/ # CI/CD pipelines
43
-
└── goreleaser.yaml # Release configuration
51
+
│ └── workflows/ # CI/CD pipelines
52
+
└── goreleaser.yaml # Release configuration
44
53
```
45
54
46
55
## Building and Testing
@@ -49,32 +58,116 @@ pipeleak/
49
58
50
59
```bash
51
60
cd src/pipeleak
61
+
make build
62
+
# Or directly:
52
63
go build -o pipeleak .
53
64
```
54
65
55
66
### Running Tests
56
67
68
+
**Using Makefile (recommended):**
69
+
```bash
70
+
cd src/pipeleak
71
+
make test# Run all tests (unit + e2e)
72
+
make test-unit # Run unit tests only
73
+
make test-e2e # Run all e2e tests
74
+
```
75
+
57
76
**Unit tests (excluding e2e):**
58
77
```bash
59
78
cd src/pipeleak
79
+
make test-unit
80
+
# Or directly:
60
81
go test$(go list ./... | grep -v /tests/e2e) -v -race
61
82
```
62
83
63
84
**End-to-end tests:**
85
+
86
+
E2E tests are organized by platform in a structured folder hierarchy:
87
+
```
88
+
tests/e2e/
89
+
├── gitlab/ # GitLab-specific tests
90
+
│ ├── cicd/yaml/ # CICD YAML command tests
91
+
│ ├── scan/ # Scan command tests
92
+
│ ├── variables/ # Variables command tests
93
+
│ ├── schedule/ # Schedule command tests
94
+
│ ├── runners/ # Runners list/exploit tests
95
+
│ ├── secureFiles/ # Secure files tests
96
+
│ ├── vuln/ # Vulnerability check tests
97
+
│ ├── renovate/ # Renovate tests
98
+
│ └── unauth/ # Unauthenticated commands (shodan)
99
+
├── github/ # GitHub Actions tests
100
+
├── bitbucket/ # BitBucket tests
101
+
├── devops/ # Azure DevOps tests
102
+
├── gitea/ # Gitea tests
103
+
└── internal/ # Shared test utilities
104
+
└── testutil/ # Common helpers (RunCLI, mock servers, etc.)
105
+
```
106
+
107
+
**Using Makefile (recommended):**
108
+
```bash
109
+
cd src/pipeleak
110
+
make test-e2e # Run all e2e tests
111
+
make test-e2e-gitlab # Run only GitLab e2e tests
112
+
make test-e2e-github # Run only GitHub e2e tests
113
+
make test-e2e-bitbucket # Run only BitBucket e2e tests
114
+
make test-e2e-devops # Run only Azure DevOps e2e tests
115
+
make test-e2e-gitea # Run only Gitea e2e tests
116
+
```
117
+
118
+
**Manual execution:**
119
+
To run e2e tests manually, first build the binary and set `PIPELEAK_BINARY`:
64
120
```bash
65
121
cd src/pipeleak
66
122
go build -o pipeleak .
67
-
PIPELEAK_BINARY=./pipeleak go test ./tests/e2e/... -v -timeout 10m
123
+
PIPELEAK_BINARY=$(pwd)/pipeleak go test ./tests/e2e/... -tags=e2e -v -timeout 10m
68
124
```
69
125
126
+
Run tests for a specific platform:
127
+
```bash
128
+
# GitLab tests only
129
+
PIPELEAK_BINARY=$(pwd)/pipeleak go test ./tests/e2e/gitlab/... -tags=e2e -v
130
+
131
+
# Specific command tests
132
+
PIPELEAK_BINARY=$(pwd)/pipeleak go test ./tests/e2e/gitlab/scan -tags=e2e -v
133
+
```
134
+
135
+
**Important:** E2E tests require the `PIPELEAK_BINARY` environment variable to point to the compiled binary (absolute or relative to module root). Tests use this binary to run commands in isolated subprocesses to avoid Cobra state conflicts.
136
+
137
+
### Test Coverage
138
+
139
+
Generate and view test coverage reports:
140
+
141
+
```bash
142
+
cd src/pipeleak
143
+
144
+
# Generate coverage report with summary
145
+
make coverage
146
+
147
+
# Generate HTML coverage report and open in browser
148
+
make coverage-html
149
+
```
150
+
151
+
Coverage reports are stored as workflow artifacts on CI runs (Linux job). Retrieve `coverage.out` from the run's artifacts section for local inspection or HTML generation.
152
+
70
153
### Linting
71
154
72
155
The project uses golangci-lint:
73
156
```bash
74
157
cd src/pipeleak
158
+
make lint
159
+
# Or directly:
75
160
golangci-lint run --timeout=10m
76
161
```
77
162
163
+
### Documentation
164
+
165
+
Generate and serve CLI documentation locally:
166
+
```bash
167
+
cd src/pipeleak
168
+
make serve-docs # Installs dependencies if needed, generates and serves docs
169
+
```
170
+
78
171
## Code Style and Conventions
79
172
80
173
### General Guidelines
@@ -85,6 +178,7 @@ golangci-lint run --timeout=10m
85
178
4.**Testing**: Write tests for new functionality; maintain existing test coverage
86
179
5.**Documentation**: Update documentation when adding or modifying features
87
180
6.**Comments**: Only add comments that provide useful context and additional understanding; avoid obvious or redundant comments
181
+
7.**File Moves/Copies**: When moving or copying files, always delete any resulting unused or vestigial files to keep the codebase clean and maintainable.
0 commit comments