stackit-cli/README.md
jaime merino 87ef60f2fc
Some checks failed
Test STACKIT Auth Action / test (push) Failing after 33s
set latest stackit cli version as default
2026-04-28 09:34:07 +02:00

60 lines
1.9 KiB
Markdown

# STACKIT Auth Action
This Forgejo/GitHub Action installs the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli) and authenticates it using a STACKIT Service Account. It also retrieves a Bearer Token and exports it for use in subsequent steps.
## Features
- Installs the STACKIT CLI on Linux-based runners.
- Authenticates using a Service Account Key (JSON).
- Scopes the access token to a specific Project ID if provided.
- Masks the Bearer Token in logs for security.
- Exports `STACKIT_BEARER_TOKEN` as an environment variable and an action output.
## Usage
Add the following step to your `.forgejo/workflows/` (or `.github/workflows/`) file:
```yaml
jobs:
my-job:
runs-on: stackit-ubuntu-22
steps:
- name: Authenticate with STACKIT
uses: stackit-auth-action@v1
id: stackit-auth
with:
service-account-key: ${{ secrets.STACKIT_SERVICE_ACCOUNT_KEY }}
project-id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
- name: Use STACKIT CLI
run: |
stackit project list
- name: Use Bearer Token with curl
run: |
curl -H "Authorization: Bearer ${{ steps.stackit-auth.outputs.bearer-token }}" \
https://api.stackit.cloud/ske/v1/projects/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/clusters
```
## Inputs
| Name | Description | Required | Default |
|------|-------------|----------|----------|
| `service-account-key` | The JSON content of your STACKIT Service Account Key. | Yes | N/A |
| `project-id` | STACKIT Project ID to scope the token. | No | N/A |
| `cli-version` | Version of STACKIT CLI to install (without "v" prefix). | No | `latest` |
## Outputs
| Name | Description |
|------|-------------|
| `bearer-token` | The generated STACKIT Bearer Token (masked in logs). |
## Environment Variables
This action sets the following environment variable for subsequent steps:
- `STACKIT_BEARER_TOKEN`
## License
MIT