Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Allow rules_k8s targets to be invoked within other Bazel targets #634

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

EdSchouten
Copy link
Contributor

The current logic for finding the runfiles directory only works when the
targets created by rules_k8s are invoked directly. Creating a
sh_binary() that chains multiple commands together doesn't work, as the
placement of the script relative to the runfiles directory will be
different.

This issue also affected rules_docker at some point in the past. This
change basically imports the new guess_runfiles() logic that
rules_docker uses.

The current logic for finding the runfiles directory only works when the
targets created by rules_k8s are invoked directly. Creating a
sh_binary() that chains multiple commands together doesn't work, as the
placement of the script relative to the runfiles directory will be
different.

This issue also affected rules_docker at some point in the past. This
change basically imports the new guess_runfiles() logic that
rules_docker uses.
@k8s-ci-robot
Copy link

Hi @EdSchouten. Thanks for your PR.

I'm waiting for a bazelbuild member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

popd > /dev/null 2>&1
if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
# Runfiles are adjacent to the current script.
echo "$( cd ${BASH_SOURCE[0]}.runfiles && pwd )"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could also be written as:

(cd ${BASH_SOURCE[0]}.runfiles && pwd)

But I'd rather not deviate from what rules_docker does.

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chases2, EdSchouten

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@EdSchouten
Copy link
Contributor Author

/retest

@k8s-ci-robot
Copy link

@EdSchouten: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@EdSchouten
Copy link
Contributor Author

Looks like CI failed due to flakiness, and I can't retrigger this myself. :-(

@fejta
Copy link
Contributor

fejta commented Apr 30, 2021

/test all

@fejta
Copy link
Contributor

fejta commented Apr 30, 2021

Looks like CI failed due to flakiness, and I can't retrigger this myself. :-(

You can most definitely trigger it yourself! See the Rurun command in the failure table and/or just type /retest

@fejta
Copy link
Contributor

fejta commented Apr 30, 2021

/ok-to-test

@fejta
Copy link
Contributor

fejta commented Apr 30, 2021

Thank you!

@fejta fejta merged commit 0ad1527 into bazelbuild:master Apr 30, 2021
@EdSchouten
Copy link
Contributor Author

Screenshot 2021-05-03 at 08 27 44

@EdSchouten EdSchouten deleted the eschouten/20210125-runfiles branch May 3, 2021 06:28
@fejta
Copy link
Contributor

fejta commented May 3, 2021

The message says you need to wait for an /ok-to-test which you received.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants