mirror of
https://github.com/hoverkraft-tech/compose-action.git
synced 2026-07-04 12:42:51 +08:00
Compare commits
5 Commits
1a9be0d085
...
47413f941e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47413f941e | ||
|
|
077eccb7f2 | ||
|
|
d2bee4f07e | ||
|
|
b542f028fa | ||
|
|
506c87e9c6 |
44
.github/workflows/__check-action.yml
vendored
44
.github/workflows/__check-action.yml
vendored
@ -170,6 +170,14 @@ jobs:
|
||||
docker compose -f ./test/docker-compose.yml ps | grep test-service-a-1 || (echo "Service service-a is not running under custom context" && exit 1)
|
||||
(docker compose -f ./test/docker-compose.yml ps | grep test-service-b-1 && echo "Service service-b should not be running without profile" && exit 1) || true
|
||||
|
||||
- name: Given OCI compose artifact when running action
|
||||
assertion-name: "Then the OCI compose application runs"
|
||||
compose-file: oci://localhost:5000/compose-action-test:latest
|
||||
publish-oci-artifact: true
|
||||
source-compose-file: ./test/docker-compose.yml
|
||||
assertion: |
|
||||
docker compose -f "$OCI_COMPOSE_FILE" ps service-a | grep service-a | grep "Up" || (echo "Service service-a is not running from the OCI artifact" && exit 1)
|
||||
|
||||
env:
|
||||
DOCKER_COMPOSE_VERSION: ${{ matrix.expected-compose-version || '' }}
|
||||
steps:
|
||||
@ -190,7 +198,7 @@ jobs:
|
||||
|
||||
- name: "Arrange: retrieve latest version of docker compose"
|
||||
if: ${{ matrix.fetch-latest-compose }}
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const dockerComposeVersion = (await github.rest.repos.getLatestRelease({
|
||||
@ -200,6 +208,39 @@ jobs:
|
||||
|
||||
core.exportVariable('DOCKER_COMPOSE_VERSION', dockerComposeVersion);
|
||||
|
||||
- name: "Arrange: start local OCI registry"
|
||||
if: ${{ matrix.publish-oci-artifact }}
|
||||
# Keep the registry alive until the job ends because the action post hook
|
||||
# reuses the OCI reference for docker compose logs and down.
|
||||
run: |
|
||||
OCI_REGISTRY_IMAGE=registry:2.8.3
|
||||
OCI_REGISTRY_MAX_RETRIES=10
|
||||
OCI_REGISTRY_RETRY_DELAY_SECONDS=1
|
||||
|
||||
# Keep the registry on port 5000 so it matches the OCI reference configured in the test matrix.
|
||||
OCI_REGISTRY_CONTAINER_ID=$(docker run -d -p 5000:5000 "$OCI_REGISTRY_IMAGE")
|
||||
echo "OCI_REGISTRY_CONTAINER_ID=$OCI_REGISTRY_CONTAINER_ID" >> "$GITHUB_ENV"
|
||||
|
||||
retry_count=0
|
||||
while [ "$retry_count" -lt "$OCI_REGISTRY_MAX_RETRIES" ]; do
|
||||
if curl --fail --silent http://localhost:5000/v2/ >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
retry_count=$((retry_count + 1))
|
||||
sleep "$OCI_REGISTRY_RETRY_DELAY_SECONDS"
|
||||
done
|
||||
|
||||
echo "Local OCI registry did not become ready on localhost:5000"
|
||||
exit 1
|
||||
|
||||
- name: "Arrange: publish compose application as OCI artifact"
|
||||
if: ${{ matrix.publish-oci-artifact }}
|
||||
run: |
|
||||
OCI_REPOSITORY="${{ matrix.compose-file }}"
|
||||
OCI_PUBLISH_TARGET="${OCI_REPOSITORY#oci://}"
|
||||
docker compose -f "${{ matrix.source-compose-file }}" publish "$OCI_PUBLISH_TARGET"
|
||||
|
||||
- name: "Arrange: ensure original docker compose version is not the expected one"
|
||||
if: ${{ matrix.ensure-version-mismatch }}
|
||||
run: |
|
||||
@ -230,3 +271,4 @@ jobs:
|
||||
run: ${{ matrix.assertion }}
|
||||
env:
|
||||
IMAGE_NAME: ${{ matrix.image-name || '' }}
|
||||
OCI_COMPOSE_FILE: ${{ matrix.compose-file || '' }}
|
||||
|
||||
8
.github/workflows/prepare-release.yml
vendored
8
.github/workflows/prepare-release.yml
vendored
@ -15,12 +15,8 @@ permissions: {}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: hoverkraft-tech/ci-github-publish/.github/workflows/prepare-release.yml@5ff7d4c3910971ed53834becd5967271b4e228cf # 0.21.1
|
||||
uses: hoverkraft-tech/ci-github-publish/.github/workflows/prepare-release.yml@b56be562f38e0e3e712f09691a8fe930aae9db1b # 0.22.0
|
||||
permissions:
|
||||
contents: write
|
||||
contents: read
|
||||
id-token: write
|
||||
pull-requests: write
|
||||
with:
|
||||
github-app-id: ${{ vars.CI_BOT_APP_ID }}
|
||||
secrets:
|
||||
github-app-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
|
||||
|
||||
44
README.md
44
README.md
@ -49,12 +49,12 @@ Some extra options can be passed to the `docker compose down` command using the
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
- uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
# Additional options to pass to `docker` command.
|
||||
docker-flags: ""
|
||||
|
||||
# Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd).
|
||||
# Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd), or an OCI artifact reference starting with `oci://`.
|
||||
# Default: `./docker-compose.yml`
|
||||
compose-file: ./docker-compose.yml
|
||||
|
||||
@ -96,21 +96,21 @@ Some extra options can be passed to the `docker compose down` command using the
|
||||
|
||||
## Inputs
|
||||
|
||||
| **Input** | **Description** | **Required** | **Default** |
|
||||
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------- |
|
||||
| **`docker-flags`** | Additional options to pass to `docker` command. | **false** | - |
|
||||
| **`compose-file`** | Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd). | **false** | `./docker-compose.yml` |
|
||||
| **`services`** | Services to perform `docker compose up`. | **false** | - |
|
||||
| **`up-flags`** | Additional options to pass to `docker compose up` command. | **false** | - |
|
||||
| **`down-flags`** | Additional options to pass to `docker compose down` command. | **false** | - |
|
||||
| **`compose-flags`** | Additional options to pass to `docker compose` command. | **false** | - |
|
||||
| **`cwd`** | Current working directory | **false** | `${{ github.workspace }}` |
|
||||
| **`compose-version`** | Compose version to use. | **false** | - |
|
||||
| | If null (default), it will use the current installed version. | | |
|
||||
| | If "latest", it will install the latest version. | | |
|
||||
| **`services-log-level`** | The log level used for Docker Compose service logs. | **false** | `debug` |
|
||||
| | Can be one of "debug", "info". | | |
|
||||
| **`github-token`** | The GitHub token used to create an authenticated client (to fetch the latest version of Docker Compose). | **false** | `${{ github.token }}` |
|
||||
| **Input** | **Description** | **Required** | **Default** |
|
||||
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------- |
|
||||
| **`docker-flags`** | Additional options to pass to `docker` command. | **false** | - |
|
||||
| **`compose-file`** | Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd), or an OCI artifact reference starting with `oci://`. | **false** | `./docker-compose.yml` |
|
||||
| **`services`** | Services to perform `docker compose up`. | **false** | - |
|
||||
| **`up-flags`** | Additional options to pass to `docker compose up` command. | **false** | - |
|
||||
| **`down-flags`** | Additional options to pass to `docker compose down` command. | **false** | - |
|
||||
| **`compose-flags`** | Additional options to pass to `docker compose` command. | **false** | - |
|
||||
| **`cwd`** | Current working directory | **false** | `${{ github.workspace }}` |
|
||||
| **`compose-version`** | Compose version to use. | **false** | - |
|
||||
| | If null (default), it will use the current installed version. | | |
|
||||
| | If "latest", it will install the latest version. | | |
|
||||
| **`services-log-level`** | The log level used for Docker Compose service logs. | **false** | `debug` |
|
||||
| | Can be one of "debug", "info". | | |
|
||||
| **`github-token`** | The GitHub token used to create an authenticated client (to fetch the latest version of Docker Compose). | **false** | `${{ github.token }}` |
|
||||
|
||||
<!-- inputs:end -->
|
||||
|
||||
@ -139,7 +139,7 @@ jobs:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
|
||||
- name: Run docker compose
|
||||
uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
|
||||
@ -153,7 +153,7 @@ jobs:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
- uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
env:
|
||||
@ -168,7 +168,7 @@ Perform `docker compose up` to some given service instead of all of them
|
||||
steps:
|
||||
# need checkout before using compose-action
|
||||
- uses: actions/checkout@v3
|
||||
- uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
- uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
services: |
|
||||
@ -206,7 +206,7 @@ A full list of flags can be found in the [Docker compose documentation](https://
|
||||
steps:
|
||||
# need checkout before using compose-action
|
||||
- uses: actions/checkout@v3
|
||||
- uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
- uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
compose-flags: "--profile profile-1"
|
||||
@ -220,7 +220,7 @@ This is useful when you have a base compose file and additional files for differ
|
||||
steps:
|
||||
# need checkout before using compose-action
|
||||
- uses: actions/checkout@v3
|
||||
- uses: hoverkraft-tech/compose-action@4894d2492015c1774ee5a13a95b1072093087ec3 # v2.5.0
|
||||
- uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
||||
with:
|
||||
compose-file: |
|
||||
./docker/docker-compose.yml
|
||||
|
||||
@ -25,7 +25,7 @@ inputs:
|
||||
description: "Additional options to pass to `docker` command."
|
||||
required: false
|
||||
compose-file:
|
||||
description: "Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd)."
|
||||
description: "Path to compose file(s). It can be a list of files. It can be absolute or relative to the current working directory (cwd), or an OCI artifact reference starting with `oci://`."
|
||||
required: false
|
||||
default: "./docker-compose.yml"
|
||||
services:
|
||||
|
||||
25
dist/index.js
generated
vendored
25
dist/index.js
generated
vendored
@ -43808,9 +43808,13 @@ class InputService {
|
||||
getComposeFiles() {
|
||||
const cwd = this.getCwd();
|
||||
const composeFiles = getMultilineInput(InputNames.ComposeFile).filter((composeFile) => {
|
||||
if (!composeFile.trim().length) {
|
||||
const trimmedComposeFile = composeFile.trim();
|
||||
if (!trimmedComposeFile.length) {
|
||||
return false;
|
||||
}
|
||||
if (trimmedComposeFile.startsWith("oci://")) {
|
||||
return true;
|
||||
}
|
||||
const possiblePaths = [(0,external_node_path_namespaceObject.join)(cwd, composeFile), composeFile];
|
||||
for (const path of possiblePaths) {
|
||||
if ((0,external_node_fs_namespaceObject.existsSync)(path)) {
|
||||
@ -44063,6 +44067,19 @@ function getProxyFetch(destinationUrl) {
|
||||
function getApiBaseUrl() {
|
||||
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
|
||||
}
|
||||
function getUserAgentWithOrchestrationId(baseUserAgent) {
|
||||
var _a;
|
||||
const orchId = (_a = process.env['ACTIONS_ORCHESTRATION_ID']) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
if (orchId) {
|
||||
const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
|
||||
const tag = `actions_orchestration_id/${sanitizedId}`;
|
||||
if (baseUserAgent === null || baseUserAgent === void 0 ? void 0 : baseUserAgent.includes(tag))
|
||||
return baseUserAgent;
|
||||
const ua = baseUserAgent ? `${baseUserAgent} ` : '';
|
||||
return `${ua}${tag}`;
|
||||
}
|
||||
return baseUserAgent;
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
;// CONCATENATED MODULE: ./node_modules/universal-user-agent/index.js
|
||||
function getUserAgent() {
|
||||
@ -48174,6 +48191,7 @@ const defaults = {
|
||||
}
|
||||
};
|
||||
const GitHub = Octokit.plugin(restEndpointMethods, paginateRest).defaults(defaults);
|
||||
|
||||
/**
|
||||
* Convience function to correctly format Octokit Options to pass into the constructor.
|
||||
*
|
||||
@ -48187,6 +48205,11 @@ function getOctokitOptions(token, options) {
|
||||
if (auth) {
|
||||
opts.auth = auth;
|
||||
}
|
||||
// Orchestration ID
|
||||
const userAgent = getUserAgentWithOrchestrationId(opts.userAgent);
|
||||
if (userAgent) {
|
||||
opts.userAgent = userAgent;
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
6
dist/post.js
generated
vendored
6
dist/post.js
generated
vendored
@ -40060,9 +40060,13 @@ class InputService {
|
||||
getComposeFiles() {
|
||||
const cwd = this.getCwd();
|
||||
const composeFiles = getMultilineInput(InputNames.ComposeFile).filter((composeFile) => {
|
||||
if (!composeFile.trim().length) {
|
||||
const trimmedComposeFile = composeFile.trim();
|
||||
if (!trimmedComposeFile.length) {
|
||||
return false;
|
||||
}
|
||||
if (trimmedComposeFile.startsWith("oci://")) {
|
||||
return true;
|
||||
}
|
||||
const possiblePaths = [(0,external_node_path_namespaceObject.join)(cwd, composeFile), composeFile];
|
||||
for (const path of possiblePaths) {
|
||||
if ((0,external_node_fs_namespaceObject.existsSync)(path)) {
|
||||
|
||||
34
package-lock.json
generated
34
package-lock.json
generated
@ -10,7 +10,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.0",
|
||||
"@actions/github": "^9.0.0",
|
||||
"@actions/github": "^9.1.0",
|
||||
"@actions/tool-cache": "^4.0.0",
|
||||
"@octokit/action": "^8.0.4",
|
||||
"docker-compose": "^1.4.2"
|
||||
@ -45,9 +45,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/github": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-9.0.0.tgz",
|
||||
"integrity": "sha512-yJ0RoswsAaKcvkmpCE4XxBRiy/whH2SdTBHWzs0gi4wkqTDhXMChjSdqBz/F4AeiDlP28rQqL33iHb+kjAMX6w==",
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-9.1.0.tgz",
|
||||
"integrity": "sha512-u0hDGQeCS+7VNoLA8hYG65RLdPLMaPGfka0sZ0up7P0AiShqfX6xcuXNteGkQ7X7Tod7AMNwHd4p7DS63i8zzA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^3.0.2",
|
||||
@ -129,7 +129,6 @@
|
||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.0",
|
||||
"@babel/generator": "^7.29.0",
|
||||
@ -1001,6 +1000,7 @@
|
||||
"integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint/object-schema": "^2.1.7",
|
||||
"debug": "^4.3.1",
|
||||
@ -1016,6 +1016,7 @@
|
||||
"integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0"
|
||||
},
|
||||
@ -1116,6 +1117,7 @@
|
||||
"integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
@ -1126,6 +1128,7 @@
|
||||
"integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0",
|
||||
"levn": "^0.4.1"
|
||||
@ -1778,7 +1781,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
|
||||
"integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^6.0.0",
|
||||
"@octokit/graphql": "^9.0.3",
|
||||
@ -2437,7 +2439,6 @@
|
||||
"integrity": "sha512-S9jlY/ELKEUwwQnqWDO+f+m6sercqOPSqXM5Go94l7DOmxHVDgmSFGWEzeE/gwgTAr0W103BWt0QLe/7mabIvA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
@ -2689,7 +2690,6 @@
|
||||
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.18.0"
|
||||
}
|
||||
@ -2724,7 +2724,6 @@
|
||||
"integrity": "sha512-RLkVSiNuUP1C2ROIWfqX+YcUfLaSnxGE/8M+Y57lopVwg9VTYYfhuz15Yf1IzCKgZj6/rIbYTmJCUSqr76r0Wg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
"@typescript-eslint/scope-manager": "8.58.0",
|
||||
@ -2764,7 +2763,6 @@
|
||||
"integrity": "sha512-rLoGZIf9afaRBYsPUMtvkDWykwXwUPL60HebR4JgTI8mxfFe2cQTu3AGitANp4b9B2QlVru6WzjgB2IzJKiCSA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.58.0",
|
||||
"@typescript-eslint/types": "8.58.0",
|
||||
@ -3307,7 +3305,6 @@
|
||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@ -3756,7 +3753,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.9.0",
|
||||
"caniuse-lite": "^1.0.30001759",
|
||||
@ -4258,7 +4254,6 @@
|
||||
"integrity": "sha512-hr4ihw+DBqcvrsEDioRO31Z17x71pUYoNe/4h6Z0wB72p7MU7/9gH8Q3s12NFhHPfYBBOV3qyfUxmr/Yn3shnQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"env-paths": "^2.2.1",
|
||||
"import-fresh": "^3.3.0",
|
||||
@ -5266,6 +5261,7 @@
|
||||
"integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^5.2.0"
|
||||
@ -5296,6 +5292,7 @@
|
||||
"integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
@ -5312,7 +5309,8 @@
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/espree": {
|
||||
"version": "10.4.0",
|
||||
@ -6980,7 +6978,6 @@
|
||||
"integrity": "sha512-AkXIIFcaazymvey2i/+F94XRnM6TsVLZDhBMLsd1Sf/W0wzsvvpjeyUrCZD6HGG4SDYPgDJDBKeiJTBb10WzMg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jest/core": "30.3.0",
|
||||
"@jest/types": "30.3.0",
|
||||
@ -7696,7 +7693,6 @@
|
||||
"integrity": "sha512-75EA7EWZExL/j+MDKQrRbdzcRI2HOkRlmUw8fZJc1ioqFEOvBsq7Rt+A6yCxOt9w/TYNpkt52gC6nm/g5tFIng==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"acorn": "^8.5.0",
|
||||
"eslint-visitor-keys": "^5.0.0",
|
||||
@ -7952,7 +7948,8 @@
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.mergewith": {
|
||||
"version": "4.6.2",
|
||||
@ -8763,7 +8760,6 @@
|
||||
"integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
@ -9813,7 +9809,6 @@
|
||||
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@ -10079,7 +10074,6 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.0",
|
||||
"@actions/github": "^9.0.0",
|
||||
"@actions/github": "^9.1.0",
|
||||
"@actions/tool-cache": "^4.0.0",
|
||||
"@octokit/action": "^8.0.4",
|
||||
"docker-compose": "^1.4.2"
|
||||
|
||||
@ -139,6 +139,31 @@ describe("InputService", () => {
|
||||
expect(inputs.composeFiles).toEqual(["./compose.yml"]);
|
||||
});
|
||||
|
||||
it("should accept OCI compose files without checking the file system", () => {
|
||||
getMultilineInputMock.mockImplementation((inputName) => {
|
||||
switch (inputName) {
|
||||
case InputNames.ComposeFile:
|
||||
return ["oci://docker.io/hoverkraft/compose-app:latest"];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
getInputMock.mockImplementation((inputName) => {
|
||||
switch (inputName) {
|
||||
case InputNames.Cwd:
|
||||
return "/current/working/directory";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
const inputs = service.getInputs();
|
||||
|
||||
expect(inputs.composeFiles).toEqual(["oci://docker.io/hoverkraft/compose-app:latest"]);
|
||||
expect(existsSyncMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should throws an error when a compose file does not exist", () => {
|
||||
getMultilineInputMock.mockImplementation((inputName) => {
|
||||
switch (inputName) {
|
||||
|
||||
@ -54,10 +54,16 @@ export class InputService {
|
||||
private getComposeFiles(): string[] {
|
||||
const cwd = this.getCwd();
|
||||
const composeFiles = getMultilineInput(InputNames.ComposeFile).filter((composeFile: string) => {
|
||||
if (!composeFile.trim().length) {
|
||||
const trimmedComposeFile = composeFile.trim();
|
||||
|
||||
if (!trimmedComposeFile.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (trimmedComposeFile.startsWith("oci://")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const possiblePaths = [join(cwd, composeFile), composeFile];
|
||||
|
||||
for (const path of possiblePaths) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user