Skip to content

Commit a945d18

Browse files
committed
update readme and implement go release pipeline
1 parent fc55d01 commit a945d18

6 files changed

Lines changed: 417 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on tags like v0.1.0, v0.2.1, etc.
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Required by GoReleaser for changelogs/tags
22+
23+
- name: Fetch all tags
24+
run: git fetch --force --tags
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version-file: "go.mod"
30+
cache: true
31+
32+
- name: Run GoReleaser
33+
uses: goreleaser/goreleaser-action@v6
34+
with:
35+
distribution: goreleaser
36+
version: '~> v2'
37+
args: release --clean
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
# TODO: publish to Homebrew tap
41+
# HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
coverage.*
1717
*.coverprofile
1818
profile.cov
19-
19+
dist
2020
# Dependency directories (remove the comment below to include it)
2121
# vendor/
2222

.goreleaser.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- main: ./cmd/otc-cli
9+
binary: otc-cli
10+
goos: [linux, darwin, windows]
11+
goarch: [amd64, arm64]
12+
env:
13+
- CGO_ENABLED=0
14+
ldflags:
15+
- -s -w
16+
- -X main.version={{.Version}}
17+
- -X main.commit={{.Commit}}
18+
- -X main.date={{.Date}}
19+
ignore:
20+
- goos: windows
21+
goarch: arm64
22+
23+
archives:
24+
- format: tar.gz
25+
name_template: >-
26+
{{ .ProjectName }}_
27+
{{- title .Os }}_
28+
{{- if eq .Arch "amd64" }}x86_64
29+
{{- else if eq .Arch "386" }}i386
30+
{{- else }}{{ .Arch }}{{ end }}
31+
{{- if .Arm }}v{{ .Arm }}{{ end }}
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
files:
36+
- README.md
37+
- LICENSE
38+
- otc-cli.md
39+
40+
checksum:
41+
name_template: 'checksums.txt'
42+
43+
snapshot:
44+
name_template: "{{ incpatch .Version }}-next"
45+
46+
changelog:
47+
sort: asc
48+
use: github
49+
filters:
50+
exclude:
51+
- '^docs:'
52+
- '^test:'
53+
- '^chore:'
54+
- 'merge conflict'
55+
- Merge pull request
56+
- Merge remote-tracking branch
57+
- Merge branch
58+
- go mod tidy
59+
groups:
60+
- title: Features
61+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
62+
order: 0
63+
- title: 'Bug fixes'
64+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
65+
order: 1
66+
- title: 'Performance improvements'
67+
regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$'
68+
order: 2
69+
- title: Others
70+
order: 999
71+
72+
release:
73+
github:
74+
owner: abdo-farag
75+
name: otc-cli
76+
draft: false
77+
prerelease: auto
78+
mode: append
79+
header: |
80+
## OTC CLI {{ .Tag }} ({{ .Date }})
81+
82+
Welcome to this new release of OTC CLI!
83+
footer: |
84+
## Installation
85+
86+
### Using Go Install
87+
```bash
88+
go install github.com/abdo-farag/otc-cli@{{ .Tag }}
89+
```
90+
91+
### Manual Installation
92+
Download the appropriate binary for your platform from the assets below.
93+
94+
**Full Changelog**: https://github.com/abdo-farag/otc-cli/compare/{{ .PreviousTag }}...{{ .Tag }}

README.md

Lines changed: 226 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,227 @@
1-
# otc-cli
1+
# OTC CLI
2+
23
A command-line interface tool for Open Telekom Cloud (OTC) that provides seamless authentication and resource management with federated Single Sign-On (SSO) support.
4+
5+
## Features
6+
7+
- 🔐 **Federated Authentication** - Login via OIDC/Keycloak SSO or IAM credentials
8+
-**Temporary Credentials** - Generate 24-hour AWS-compatible credentials
9+
- 🔄 **Token Caching** - Automatic token management and refresh
10+
- 📦 **Resource Management** - List and manage OTC resources
11+
- 🌐 **Multi-Project Support** - Work with multiple OTC projects
12+
- 🚀 **CCE Integration** - Get kubeconfig for Kubernetes clusters
13+
14+
## Installation
15+
16+
### From Source
17+
18+
```bash
19+
git clone https://github.com/abdo-farag/otc-cli.git
20+
cd otc-cli
21+
go build -o otc-cli cmd/otc-cli/main.go
22+
sudo mv otc-cli /usr/local/bin/
23+
```
24+
25+
### Using Go Install
26+
27+
```bash
28+
go install github.com/abdo-farag/otc-cli@latest
29+
```
30+
31+
## Quick Start
32+
33+
### Option 1: Login with Federated SSO (OIDC/Keycloak)
34+
35+
1. **Configure environment variables:**
36+
37+
```bash
38+
# OIDC/Keycloak Configuration
39+
export IDP_URL="https://your-keycloak.com/realms/YourRealm"
40+
export IDP_CLIENT_ID="otc-client"
41+
export IDP_CLIENT_SECRET="your-client-secret" # Optional, for confidential clients
42+
export IDP_PROVIDER_NAME="YourSSO"
43+
44+
# OTC Configuration
45+
export OS_DOMAIN_NAME="OTC00000000001000001234"
46+
export OS_REGION="eu-de"
47+
```
48+
49+
2. **Login:**
50+
51+
```bash
52+
otc-cli login
53+
```
54+
55+
This will open your browser for SSO authentication. After successful login, credentials are saved to `otc-credentials.sh`.
56+
57+
3. **Load credentials:**
58+
59+
```bash
60+
source otc-credentials.sh
61+
```
62+
63+
### Option 2: Login with IAM Credentials
64+
65+
1. **Configure environment variables:**
66+
67+
```bash
68+
export OS_USERNAME="your-username"
69+
export OS_PASSWORD="your-password"
70+
export OS_DOMAIN_NAME="OTC00000000001000001234"
71+
export OS_REGION="eu-de"
72+
```
73+
74+
2. **Login:**
75+
76+
```bash
77+
otc-cli login --iam
78+
```
79+
80+
3. **Load credentials:**
81+
82+
```bash
83+
source otc-credentials.sh
84+
```
85+
86+
## Basic Usage
87+
88+
### List Resources
89+
90+
```bash
91+
# List all projects
92+
otc-cli list projects
93+
94+
# List servers/instances
95+
otc-cli list servers
96+
97+
# List servers in specific project
98+
otc-cli list servers -p "Production"
99+
100+
# List VPCs
101+
otc-cli list vpcs
102+
103+
# List subnets
104+
otc-cli list subnets
105+
106+
# List volumes
107+
otc-cli list volumes
108+
109+
# List CCE clusters
110+
otc-cli list cce
111+
```
112+
113+
### Get Kubeconfig
114+
115+
```bash
116+
# Get kubeconfig for CCE cluster
117+
otc-cli get kubeconfig -c cluster-name
118+
119+
# Save to specific file
120+
otc-cli get kubeconfig -c cluster-id -o ~/.kube/otc-config
121+
```
122+
123+
### Logout
124+
125+
Clear cached credentials:
126+
127+
```bash
128+
otc-cli logout
129+
```
130+
131+
## Configuration
132+
133+
### Keycloak OIDC Client Setup
134+
135+
If using federated SSO, configure your Keycloak client:
136+
137+
1. **Create OIDC Client** in Keycloak Admin Console
138+
2. **Client Settings:**
139+
- Client Protocol: `openid-connect`
140+
- Access Type: `public` or `confidential`
141+
- Valid Redirect URIs: `http://localhost:9197/oidc/auth`
142+
- Web Origins: `http://localhost:9197`
143+
3. **Required Scopes:** `openid`, `email`, `profile`, `roles`, `groups`, `offline_access`
144+
145+
### Environment Variables
146+
147+
| Variable | Description | Required | Default |
148+
|----------|-------------|----------|---------|
149+
| `IDP_URL` | Keycloak/OIDC provider URL | For SSO | - |
150+
| `IDP_CLIENT_ID` | OIDC client ID | For SSO | - |
151+
| `IDP_CLIENT_SECRET` | OIDC client secret | No | - |
152+
| `IDP_PROVIDER_NAME` | Identity provider name in OTC | For SSO | - |
153+
| `OS_USERNAME` | IAM username | For IAM | - |
154+
| `OS_PASSWORD` | IAM password | For IAM | - |
155+
| `OS_DOMAIN_NAME` | OTC domain name | Yes | - |
156+
| `OS_REGION` | OTC region | No | `eu-de` |
157+
158+
## Documentation
159+
160+
For advanced usage, detailed examples, and troubleshooting, see the [complete documentation](otc-cli.md).
161+
162+
Topics covered in the advanced docs:
163+
- Working with multiple projects
164+
- JSON output and scripting
165+
- Integration with AWS CLI, Terraform, and boto3
166+
- Detailed troubleshooting guide
167+
- Authentication flow diagrams
168+
- CI/CD integration
169+
170+
## Quick Troubleshooting
171+
172+
### "Could not find OIDC configuration" error
173+
174+
- Verify `IDP_PROVIDER_NAME` matches the Identity Provider name in OTC IAM
175+
- Check that federated identity is properly configured in OTC Console
176+
177+
### "Project not found" error
178+
179+
List available projects first:
180+
```bash
181+
otc-cli list projects
182+
```
183+
184+
### Browser doesn't open
185+
186+
Use no-browser mode:
187+
```bash
188+
otc-cli login --no-browser
189+
```
190+
191+
For more detailed troubleshooting, see [otc-cli.md](otc-cli.md).
192+
193+
## Contributing
194+
195+
Contributions are welcome! Please feel free to submit a Pull Request.
196+
197+
1. Fork the repository
198+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
199+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
200+
4. Push to the branch (`git push origin feature/amazing-feature`)
201+
5. Open a Pull Request
202+
203+
## License
204+
205+
MIT License - see [LICENSE](LICENSE) file for details
206+
207+
## Links
208+
209+
- **Documentation:** [otc-cli.md](otc-cli.md)
210+
- **Issues:** [GitHub Issues](https://github.com/abdo-farag/otc-cli/issues)
211+
- **Repository:** [github.com/abdo-farag/otc-cli](https://github.com/abdo-farag/otc-cli)
212+
213+
## Related Documentation
214+
215+
- **Keycloak Documentation:** [https://www.keycloak.org/documentation](https://www.keycloak.org/documentation)
216+
- [OIDC Client Configuration](https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients)
217+
- [Identity Brokering](https://www.keycloak.org/docs/latest/server_admin/#_identity_broker)
218+
- **Open Telekom Cloud Documentation:** [https://docs.otc.t-systems.com/](https://docs.otc.t-systems.com/)
219+
- [Identity and Access Management (IAM)](https://docs.otc.t-systems.com/identity-access-management/umn/service_overview/what_is_iam.html)
220+
- [IAM Federated Identity Authentication](https://docs.otc.t-systems.com/identity-access-management/umn/user_guide/federated_identity_authentication/index.html)
221+
- [API Reference](https://docs.otc.t-systems.com/api/api-ref.html)
222+
- **Gopher Telekom Cloud SDK:** [https://github.com/opentelekomcloud/gophertelekomcloud](https://github.com/opentelekomcloud/gophertelekomcloud)
223+
- Go SDK for Open Telekom Cloud (this project uses it internally)
224+
225+
---
226+
227+
**Note:** This is an unofficial tool and is not supported by T-Systems or Deutsche Telekom.

0 commit comments

Comments
 (0)