Skip to content

Commit 50ce2e5

Browse files
Copilotneilime
andcommitted
fix: remove credentials support to resolve CI YAML validation error
Co-authored-by: neilime <[email protected]>
1 parent 51ff63b commit 50ce2e5

File tree

2 files changed

+10
-69
lines changed

2 files changed

+10
-69
lines changed

.github/workflows/continuous-integration.md

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ container: |
207207
"env": {
208208
"NODE_ENV": "production"
209209
},
210-
"options": "--cpus 2",
211-
"credentials": {
212-
"username": "myusername"
213-
}
210+
"options": "--cpus 2"
214211
}
215212
```
216213

@@ -219,29 +216,8 @@ container: |
219216
- `image` (string, required) - Container image name
220217
- `env` (object) - Environment variables
221218
- `options` (string) - Additional Docker options
222-
- `credentials` (object) - Registry credentials with `username` property
223219

224-
**Note:** `ports` and `volumes` are not currently supported due to GitHub Actions workflow syntax limitations.
225-
226-
#### Container Registry Credentials
227-
228-
For private container images, specify the username in the container input's `credentials.username` property and pass the password via the `container-registry-password` secret:
229-
230-
```yaml
231-
jobs:
232-
continuous-integration:
233-
uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@main
234-
secrets:
235-
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
236-
with:
237-
container: |
238-
{
239-
"image": "ghcr.io/myorg/my-private-image:latest",
240-
"credentials": {
241-
"username": "myusername"
242-
}
243-
}
244-
```
220+
**Note:** `ports`, `volumes`, and `credentials` are not currently supported due to GitHub Actions workflow syntax limitations.
245221

246222
See [GitHub's container specification](https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container) for more details.
247223

@@ -251,14 +227,12 @@ When specified, steps will execute inside this container instead of checking out
251227

252228
## Secrets
253229

254-
| **Secret** | **Description** | **Required** |
255-
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
256-
| **`build-secrets`** | Secrets to be used during the build step. | **false** |
257-
| | Must be a multi-line env formatted string. | |
258-
| | Example: | |
259-
| | <!-- textlint-disable --><pre lang="txt">SECRET_EXAMPLE=$\{{ secrets.SECRET_EXAMPLE }}</pre><!-- textlint-enable --> | |
260-
| **`container-registry-password`** | Password or token for authenticating to the container registry. | **false** |
261-
| | Required when using private container images. The username should be specified in the container input's `credentials.username` property. | |
230+
| **Secret** | **Description** | **Required** |
231+
| ------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------ |
232+
| **`build-secrets`** | Secrets to be used during the build step. | **false** |
233+
| | Must be a multi-line env formatted string. | |
234+
| | Example: | |
235+
| | <!-- textlint-disable --><pre lang="txt">SECRET_EXAMPLE=$\{{ secrets.SECRET_EXAMPLE }}</pre><!-- textlint-enable --> | |
262236

263237
<!-- secrets:end -->
264238

@@ -390,19 +364,14 @@ jobs:
390364
id-token: write
391365
security-events: write
392366
contents: read
393-
secrets:
394-
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
395367
with:
396368
container: |
397369
{
398-
"image": "ghcr.io/myorg/node-image:18-alpine",
370+
"image": "node:18-alpine",
399371
"env": {
400372
"NODE_ENV": "production",
401373
"CI": "true"
402374
},
403-
"credentials": {
404-
"username": "myusername"
405-
},
406375
"options": "--cpus 2 --memory 4g"
407376
}
408377
# When using container mode, code-ql and dependency-review are typically disabled

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ on:
104104
```
105105
106106
Supported properties: image (required), env (object), options (string).
107-
Note: ports and volumes are not currently supported due to GitHub Actions limitations.
108-
109-
For container registry credentials (username/password), use the container-registry-username
110-
and container-registry-password secrets.
107+
Note: ports, volumes, and credentials are not currently supported due to GitHub Actions limitations.
111108
112109
See https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container
113110
@@ -126,12 +123,6 @@ on:
126123
SECRET_EXAMPLE=$\{{ secrets.SECRET_EXAMPLE }}
127124
```
128125
required: false
129-
container-registry-password:
130-
description: |
131-
Password or token for authenticating to the container registry.
132-
Required when using private container images.
133-
The username should be specified in the container input's credentials.username property.
134-
required: false
135126
outputs:
136127
build-artifact-id:
137128
description: "ID of the build artifact) uploaded during the build step."
@@ -176,13 +167,6 @@ jobs:
176167
config.env = container.env;
177168
}
178169
179-
// Add credentials username if provided
180-
if (container.credentials && container.credentials.username) {
181-
config.credentials = {
182-
username: container.credentials.username
183-
};
184-
}
185-
186170
// Merge user options with default --user root:root
187171
if (container.options) {
188172
config.options = `${config.options} ${container.options}`;
@@ -228,9 +212,6 @@ jobs:
228212
image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }}
229213
env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }}
230214
options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }}
231-
credentials:
232-
username: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).credentials.username || null }}
233-
password: ${{ secrets.container-registry-password }}
234215
needs: parse-container
235216
if: ${{ always() && !cancelled() && !failure() }}
236217
permissions:
@@ -352,9 +333,6 @@ jobs:
352333
image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }}
353334
env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }}
354335
options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }}
355-
credentials:
356-
username: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).credentials.username || null }}
357-
password: ${{ secrets.container-registry-password }}
358336
needs:
359337
- parse-container
360338
- setup
@@ -414,9 +392,6 @@ jobs:
414392
image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }}
415393
env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }}
416394
options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }}
417-
credentials:
418-
username: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).credentials.username || null }}
419-
password: ${{ secrets.container-registry-password }}
420395
needs:
421396
- parse-container
422397
- setup
@@ -466,9 +441,6 @@ jobs:
466441
image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }}
467442
env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }}
468443
options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }}
469-
credentials:
470-
username: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).credentials.username || null }}
471-
password: ${{ secrets.container-registry-password }}
472444
needs:
473445
- parse-container
474446
- setup

0 commit comments

Comments
 (0)