-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Build: implement build.jobs
config file key
#9016
Conversation
build.jobs
config file keybuild.jobs
config file key
Allow people to use `build.jobs` to execute pre/post steps. ```yaml build: jobs: pre_install: - echo `date` - python path/to/myscript.py pre_build: - sed -i **/*.rst -e "s|{version}|v3.5.1|g" ```
74063f7
to
50980c7
Compare
Put all the job steps under a helper called `run_build_job` to simplify the code.
Pass `READTHEDOCS_VERSION_TYPE` and `READTHEDOCS_VERSION_NAME` that were missed because a merge conflict. These variables were added in #8237
9adc275
to
1fcd354
Compare
Blocking this PR because I'm going on vacation next week and it makes sense to help with deployment and QA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start. I'm excited to get this out.
I'd like to see the docs included in this PR, which I think would help explain the use case. Also probably some kind of guide content or similar that shows what is possible here, with a few examples and suggestions.
if job not in ("pre_checkout", "post_checkout"): | ||
environment = self.build_environment | ||
|
||
commands = getattr(self.data.config.build.jobs, job, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use .get()
instead of getattr()
? Is it not a dict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not a dict. It's a BuildJobs
instance. The config itself is an object and each of its attributes are objects 🤷🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all jobs should be already defined by this step, you can omit the getattr
step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stsewd hrm, but how do you access the field name stored in the variable job
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, job is a variable, then the default from []
could be removed, that way we can also catch errors if we pass a wrong job name.
getattr(self.data.config.build, "jobs", None) is None | ||
or getattr(self.data.config.build.jobs, job, None) is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can write this as if self.data.config.using_build_tools:
, and all jobs should already be defined by this step, so no need for getattr on the right side of this expression.
Hrm, I'd swear that I wrote a comment about this already. Here is my second attempt 😄 I made the requested changes and answered all the questions you had. I think this PR is ready to be merged after it gets approval. Let me know if there is anything else to be done before merging. I tested it locally with test-builds and it worked. However, I'm sure there may be more use cases to test. If you have one in mind, please create the branch in test-builds so we can test it and track it. |
@humitos I don't see any docs in this PR. Is the idea here that we'll ship the code without docs to be able to test it? I'd still like to understand a bit more the UX of the proposed code via docs, so perhaps we could make another PR that adds docs but isn't merged in the same release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, and I'm excited to get it out to our users. Next step is trying to tell people that they are supported & promote it's usage!
I'd love to have a KPI here on projects using this feature as a test for future "go to market" of new features. I expect this one will be quickly adopted if we do our jobs right. Can we do this easily in metabase these days?
I've used "contains" over the In any case, the short answer is "yes, we can get that data into metabase". |
Co-authored-by: Eric Holscher <[email protected]>
Hrm, I thought of deploying this first but I wasn't able to shape it before yesterday. So, if we can write the docs and deploy everything together next week that sounds good to me. Otherwise, we can deploy just the code, for now, to start testing it. I wrote a basic reference documentation following what we have in that page and open a PR in #9056 I'm not sure what could doubt you may have regarding the UX but if you have any specific questions about it, let me know, so we can cover them in a guide. I think it will be good to cover common cases like "Unshallow repository" and "Incorrect version detection" at least. |
…mitos/build-jobs-config-object
Allow people to use
build.jobs
to execute pre/post steps.Decisions made
build.jobs
can't be used withoutbuild.os
/build.tools
. This is done on purpose to avoid maintaining old/deprecated features (config file v1 and v2 withbuild.image
)checkout
,install
,build
, etc) can be overwritten in this initial version. We will need a defined contract (e.g.metadata.yaml
) to allow thisdocs
)root
Closes #8201
Closes #5989