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
This action provides the following functionality for GitHub Actions users:
3
+
## Overview
4
4
5
-
- Installing a version of [Cloud Foundry CLI](https://github.com/cloudfoundry/cli) and adding it to the PATH
6
-
- Authenticating to the Cloud Foundry API using different grant types:
5
+
The `setup-cf` GitHub Action enables seamless integration with Cloud Foundry in your CI/CD pipelines. It simplifies the process of installing the Cloud Foundry CLI (cf cli), authenticating with Cloud Foundry services, and targeting specific organizations and spaces.
6
+
7
+
This action is particularly useful for teams who deploy applications to Cloud Foundry platforms and want to automate their deployment workflows.
8
+
9
+
## Features
10
+
11
+
-**Installation**: Automatically installs a specified version of [Cloud Foundry CLI](https://github.com/cloudfoundry/cli) and adds it to the PATH
12
+
-**Authentication**: Supports multiple authentication grant types:
7
13
- Password
8
14
- Client Credentials
9
15
- Client Credentials with JWT
10
16
- JWT Bearer Token Grant
11
-
- Target Org and Space
17
+
-**Targeting**: Automatically targets specified organization and space
18
+
-**GitHub OIDC Integration**: Works with GitHub's OpenID Connect (OIDC) for secure authentication
12
19
13
-
## Basic usage
20
+
## Basic Usage
14
21
15
-
See [action.yml](action.yml)
22
+
See [action.yml](action.yml) for complete action definition.
16
23
17
24
```yaml
18
25
steps:
@@ -28,113 +35,69 @@ steps:
28
35
run: cf apps
29
36
```
30
37
31
-
## Parameter
32
-
* `api`
33
-
* Url of the cloud controller api
34
-
* required
35
-
* `audience`
36
-
* audience for requesting the GitHub `id_token`
37
-
* `client_id`
38
-
* client id for `client_credentals` or `jwt-bearer`
39
-
* `client_secret`
40
-
* client secret for `client_credentals` or `jwt-bearer`
41
-
* `grant_type`
42
-
* grant type for access
43
-
* required
44
-
* default: `password`
45
-
* valid values:
46
-
* `password`
47
-
* `client_credentals`
48
-
* `jwt-bearer`
49
-
* `jwt`
50
-
* jwt for usage with `client_credentals` or `jwt-bearer`. If omitted, a GitHub `id_token` will be requested
To allow a workflow to request an `id_token`, the workflow needs to have the correct permissions:
38
+
## Parameters
76
39
77
-
```
78
-
permissions:
79
-
id-token: write # This is required for requesting the JWT
80
-
contents: read # This is required for actions/checkout
81
-
```
82
-
83
-
> The `sub` may not be used for the `user_name` attribute mapping, as it can include unsupported characters like `/` and `:`.
40
+
| Parameter | Description | Required | Default |
41
+
|-----------|-------------|:--------:|:-------:|
42
+
| `api` | URL of the Cloud Foundry API endpoint | Yes | - |
43
+
| `audience` | Audience for requesting the GitHub `id_token` | No | - |
44
+
| `client_id` | Client ID for `client_credentials` or `jwt-bearer` grant types | No | - |
45
+
| `client_secret` | Client secret for `client_credentials` or `jwt-bearer` grant types | No | - |
46
+
| `grant_type` | Authentication grant type (`password`, `client_credentials`, or `jwt-bearer`) | Yes | `password` |
47
+
| `jwt` | JWT token for use with `client_credentials` or `jwt-bearer`. If omitted with these grant types, a GitHub `id_token` will be requested automatically | No | - |
48
+
| `org` | Cloud Foundry organization name to target | No | - |
49
+
| `origin` | Identity provider origin to use for authentication with `jwt-bearer` or `password` | No | - |
50
+
| `username` | Username for `password` grant type | No | - |
51
+
| `password` | Password for `password` grant type | No | - |
52
+
| `skip_ssl_validation` | Skip verification of the API endpoint (not recommended for production) | No | `false` |
53
+
| `space` | Cloud Foundry space name to target | No | - |
54
+
| `version` | Cloud Foundry CLI version to install | Yes | `8.12.0` |
84
55
85
-
The sub can be customized https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-subject-claims-for-an-organization-or-repository
56
+
## Authentication Methods
86
57
87
-
### setup UAA for JWT Bearer Token Grant with GitHub
58
+
### Password Authentication
88
59
89
-
Add the GitHub OIDC provider and use e.g. the `repository_owner` claim as the `user_name`:
60
+
The simplest authentication method using username and password:
Subject and Audience need to adapted to your repo and workflow.
203
+
204
+
### GitHub OIDC Configuration
205
+
206
+
To use GitHub's OIDC provider, your workflow must have the appropriate permissions:
207
+
208
+
```yaml
209
+
permissions:
210
+
id-token: write # Required for requesting the JWT
211
+
contents: read # Required for actions/checkout
212
+
```
213
+
214
+
Note: The `sub` claim from GitHub may contain characters like `/` and `:` which are not supported for the `user_name` attribute. Consider using alternative claims or customizing the subject as described in [GitHub's documentation](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-subject-claims-for-an-organization-or-repository).
215
+
216
+
## Troubleshooting
217
+
218
+
### Common Issues
219
+
220
+
1. **Authentication Failures**
221
+
- Verify your credentials are correct
222
+
- Check that your client has the necessary authorities and grant types
223
+
- Ensure the UAA version is 77.20.4 or higher for JWT-based auth
224
+
225
+
2. **Permission Issues**
226
+
- For GitHub OIDC, make sure the workflow has `id-token: write` permission
227
+
- Verify the client or user has appropriate Cloud Foundry permissions
228
+
229
+
3. **Targeting Issues**
230
+
- Confirm the organization and space exist
231
+
- Check that the authenticated user/client has access to the specified org/space
232
+
233
+
### Debugging
234
+
235
+
Add the following to your workflow to see more detailed output:
236
+
237
+
```yaml
238
+
env:
239
+
CF_LOG_LEVEL: DEBUG
240
+
```
241
+
242
+
## Development
243
+
244
+
To update the action:
166
245
167
246
```
168
247
npm i -g @vercel/ncc
169
248
npm run format
170
249
npm run build
171
250
```
251
+
252
+
## License
253
+
254
+
This project is licensed under the MIT License - see the LICENSE file for details.
0 commit comments