Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/__test-action-docker-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,83 @@ jobs:
exit 1
fi

tests-without-cache:
name: Test for "docker/build-image" action without cache
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Arrange - Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Arrange - Ensure token is set
run: |
if [ -z "${{ github.token }}" ]; then
echo "GitHub token is not set"
exit 1
fi

- name: Act - Build image
id: build-image
uses: ./actions/docker/build-image
with:
oci-registry: ghcr.io
oci-registry-password: ${{ github.token }}
context: "."
dockerfile: "./tests/application/Dockerfile"
target: "prod"
platform: "linux/amd64"
image: application-test
cache-type: ""

- name: Assert - Check built image output
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
BUILT_IMAGE_OUTPUT: ${{ steps.build-image.outputs.built-image }}
with:
script: |
const assert = require("assert");

const builtImageOutput = process.env.BUILT_IMAGE_OUTPUT;
assert(builtImageOutput, `"built-image" output is empty`);

let builtImage;
try {
builtImage = JSON.parse(builtImageOutput);
} catch (error) {
assert.fail(`Failed to parse built image output: ${error}`);
}

assert(builtImage, `"built-image" output is empty`);
assert.equal(builtImage.name, "application-test", `"name" output is not valid`);
assert.match(
builtImage.digest,
/^sha256:[a-f0-9]{64}$/,
`"digest" output is not valid`
);

- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Assert - Check docker image
env:
BUILT_IMAGE_OUTPUT: ${{ steps.build-image.outputs.built-image }}
run: |
IMAGE=$(echo "$BUILT_IMAGE_OUTPUT" | jq -r '.image')
if ! docker pull "$IMAGE"; then
echo "Failed to pull $IMAGE"
exit 1
fi

if ! docker manifest inspect "$IMAGE"; then
echo "Failed to inspect $IMAGE"
exit 1
fi

# jscpd:ignore-end
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
# Default: `${{ github.repository_owner }}`
build-secret-github-app-owner: ${{ github.repository_owner }}

# Cache type.
# Cache type. Set to `false` or empty to disable cache entirely.
# See https://docs.docker.com/build/cache/backends.
#
# Default: `gha`
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
| | See <https://github.com/actions/create-github-app-token>. | | | |
| **`build-secret-github-app-owner`** | The owner of the GitHub App installation. | **false** | **string** | `${{ github.repository_owner }}` |
| | See <https://github.com/actions/create-github-app-token>. | | | |
| **`cache-type`** | Cache type. | **false** | **string** | `gha` |
| **`cache-type`** | Cache type. Set to `false` or empty to disable cache entirely. | **false** | **string** | `gha` |
| | See <https://docs.docker.com/build/cache/backends>. | | | |
| **`buildkitd-config-inline`** | Inline BuildKit daemon configuration. | **false** | **string** | - |
| | See <https://github.com/docker/setup-buildx-action#inputs>. | | | |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ on: # yamllint disable-line rule:truthy
default: ${{ github.repository_owner }}
cache-type:
description: |
Cache type.
Cache type. Set to `false` or empty to disable cache entirely.
See https://docs.docker.com/build/cache/backends.
default: "gha"
type: string
Expand Down
4 changes: 2 additions & 2 deletions actions/docker/build-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ permissions:
# See https://docs.docker.com/build/ci/github-actions/secrets/.
secret-envs: ""

# Cache type.
# Cache type. Set to `false` or empty to disable cache entirely.
# See https://docs.docker.com/build/cache/backends.
#
# Default: `gha`
Expand Down Expand Up @@ -202,7 +202,7 @@ permissions:
| | See <https://docs.docker.com/build/ci/github-actions/secrets/>. | | |
| **`secret-envs`** | List of secret environment variables to expose to the build (e.g., `key=envname, MY_SECRET=MY_ENV_VAR`). | **false** | - |
| | See <https://docs.docker.com/build/ci/github-actions/secrets/>. | | |
| **`cache-type`** | Cache type. | **false** | `gha` |
| **`cache-type`** | Cache type. Set to `false` or empty to disable cache entirely. | **false** | `gha` |
| | See <https://docs.docker.com/build/cache/backends>. | | |
| **`buildkitd-config-inline`** | Inline BuildKit daemon configuration. | **false** | - |
| | See <https://github.com/docker/setup-buildx-action#inputs>. | | |
Expand Down
25 changes: 17 additions & 8 deletions actions/docker/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ inputs:
required: false
cache-type:
description: |
Cache type.
Cache type. Set to `false` or empty to disable cache entirely.
See https://docs.docker.com/build/cache/backends.
default: "gha"
required: false
Expand Down Expand Up @@ -237,7 +237,12 @@ runs:
const tagSuffix = `-${slugifiedPlatform}`;
core.setOutput('cache-flavor', `suffix=${tagSuffix}`);

const cacheType = (process.env.CACHE_TYPE_INPUT || '').trim();
const rawCacheType = (process.env.CACHE_TYPE_INPUT || '').trim().toLowerCase();
const cacheDisabled = rawCacheType.length === 0 || rawCacheType === 'false';
const cacheType = cacheDisabled ? '' : rawCacheType;
core.setOutput('cache-disabled', cacheDisabled ? 'true' : 'false');
core.setOutput('cache-type', cacheType);

const metadataImage = process.env.METADATA_IMAGE || '';
const cacheRegistry = (process.env.CACHE_REGISTRY || '').trim();
if (cacheType === 'registry' && !cacheRegistry.length) {
Expand Down Expand Up @@ -309,24 +314,27 @@ runs:
platforms: ${{ inputs.platform }}

# Caching setup
- id: cache-arguments
- if: steps.get-docker-config.outputs.cache-disabled != 'true'
id: cache-arguments
uses: int128/docker-build-cache-config-action@3674b5d646e77fc3913044193ac579c5efd20791 # v1.58.0
with:
image: ${{ steps.get-docker-config.outputs.cache-image }}
flavor: ${{ steps.get-docker-config.outputs.cache-flavor }}
pull-request-cache: true
cache-type: ${{ inputs.cache-type }}
cache-type: ${{ steps.get-docker-config.outputs.cache-type }}
extra-cache-to: "image-manifest=true,oci-mediatypes=true"

- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
- if: steps.get-docker-config.outputs.cache-type == 'gha'
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: cache
with:
path: cache-mount
key: cache-mount-${{ hashFiles(steps.get-docker-config.outputs.dockerfile-path) }}-${{ steps.get-docker-config.outputs.cache-mount-scope }}
restore-keys: |
cache-mount-${{ hashFiles(steps.get-docker-config.outputs.dockerfile-path) }}-

- name: Restore Docker cache mounts
- if: steps.get-docker-config.outputs.cache-type == 'gha'
name: Restore Docker cache mounts
uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723 # v3.4.0
with:
builder: ${{ steps.docker-setup.outputs.buildx-name }}
Expand All @@ -344,8 +352,9 @@ runs:
secrets: ${{ inputs.secrets }}
secret-envs: ${{ inputs.secret-envs }}
platforms: ${{ inputs.platform }}
cache-from: ${{ steps.cache-arguments.outputs.cache-from }}
cache-to: ${{ steps.cache-arguments.outputs.cache-to }}
cache-from: ${{ steps.get-docker-config.outputs.cache-disabled != 'true' && steps.cache-arguments.outputs.cache-from || '' }}
cache-to: ${{ steps.get-docker-config.outputs.cache-disabled != 'true' && steps.cache-arguments.outputs.cache-to || '' }}
no-cache: ${{ steps.get-docker-config.outputs.cache-disabled }}
outputs: |
${{ steps.get-docker-config.outputs.multi-platform && 'type=image,push-by-digest=true,name-canonical=true,push=true' || 'type=image,push=true' }}
labels: ${{ steps.metadata.outputs.labels }}
Expand Down
34 changes: 27 additions & 7 deletions actions/helm/generate-docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions actions/helm/generate-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"name": "generate-docs",
"overrides": {
"markdownlint-cli2": {
"js-yaml": "4.2.0",
"markdown-it": "14.2.0"
}
},
"dependencies": {
"@textlint/textlint-plugin-markdown": "^15.7.1",
"markdownlint-cli2": "^0.22.1",
Expand Down
4 changes: 4 additions & 0 deletions actions/helm/release-chart/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ runs:
const rootChartFileContent = yaml.parse(fs.readFileSync(rootChartFile, 'utf8'));

if (!rootChartFileContent.dependencies || rootChartFileContent.dependencies.length === 0) {
core.debug(`No dependencies found in Chart.yaml file: ${rootChartFile}`);
return;
}

const chartLockFile = process.env.INPUT_PATH + '/Chart.lock';
if (!fs.existsSync(chartLockFile)) {
core.debug(`Chart.lock file not found: ${chartLockFile}`);
return core.setFailed(`Chart.lock file not found: ${chartLockFile}`);
}

Expand All @@ -203,6 +205,7 @@ runs:

for (const dependency of dependencies) {
const isLocalDependency = dependency.repository.startsWith('file://') && dependency.version === '0.0.0';
core.debug(`Dependency ${dependency.name} is local: ${isLocalDependency}`);

if (isLocalDependency) {
dependency.version = process.env.INPUT_TAG;
Expand All @@ -211,6 +214,7 @@ runs:
}

if (!hasLocalDependencies) {
core.debug(`No local dependencies found in Chart.lock file: ${chartLockFile}`);
return;
}

Expand Down
Loading