Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context-subdir input #532

Closed
wants to merge 1 commit into from
Closed

Add context-subdir input #532

wants to merge 1 commit into from

Conversation

actualben
Copy link

This is an alternative to #531, that PR implements the magic var which you described in #460 (comment) .

This approach instead uses a new input context-subdir which gets appended to the context URL. This new input is ignored (with a warning) if the user also specifies a context input such (as a path). The potential benefit to this approach is that it might be a little easier for users than utilizing a magic var.

magic var:

name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
  push: true
  tags: user/app:latest
  context: {{defaultContext}}:docker

vs

new input:

name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
  push: true
  tags: user/app:latest
  context-subdir: docker

Closes #460
Closes #528

Adds a `context-subdir` input which gets appended to the context URL. This new input is ignored (with a warning) if the user gives a non-default `context` input such as a path.

Signed-off-by: actualben <actualben@users.noreply.github.com>
@@ -97,7 +99,15 @@ export async function getArgs(inputs: Inputs, defaultContext: string, buildxVers
let args: Array<string> = ['buildx'];
args.push.apply(args, await getBuildArgs(inputs, defaultContext, buildxVersion));
args.push.apply(args, await getCommonArgs(inputs, buildxVersion));
args.push(inputs.context);
let context: string = inputs.context;
if (inputs.contextSubdir) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the ability to add a subdirectory is only available in BuildX starting with v0.7.0, shouldn't you check that buildxVersion satisfies that? 🤔

@actualben
Copy link
Author

closing in favor of #531

@actualben actualben closed this Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Action doesn't perform git checkout Feature request: Allow specifying subdirectory with default git context
2 participants