-
-
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
Use latest docker images as default #5155
Conversation
c18bf2b
to
9041e4a
Compare
@@ -146,6 +146,8 @@ class BuildConfigBase: | |||
'mkdocs', | |||
'submodules', | |||
] | |||
valid_build_images = [k.split(':')[1] for k in DOCKER_IMAGE_SETTINGS] | |||
default_build_image = DOCKER_DEFAULT_VERSION |
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.
The default build image are different from v1 and v2. v1 uses 2.0, v2 uses latest
.
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.
🤔 I think both should use stable
as default image.
Having different image default for v1 and v2 is confusing. Also, defaulting to a fixed version like 2.0
will make us to be tied to that version. Besides, 2.0
is deprecated.
On the other hand, I think that defaulting to latest
is not a good practice since it may be not tested enough to use it widely as default.
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.
We will be changing the builds for users using v1, we shouldn't change the spec.
Using latest was decided in #4084 (comment)
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.
We can default to latest
as that comment says. I don't agree, but it's not a huge problem, though.
Regarding default to 2.0
for v1
is not a good decision to me. I'd like to change that to stable
(this is a non-breaking change and actually is more stable). Right now, we are defaulting to ConfigV1 for new projects, and ConfigV1 is defaulting to 2.0
, so in the end, all new projects will be using a 2.0
which is a deprecated build image.
I'm -1 on defaulting to a deprecated Docker build image for new projects.
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.
If there isn't a technical limitation to why we can't use the same image for both, I agree that both should point to the same image.
However, I don't think that image should be stable
by default. Everyone should be using latest
now, or 3.0
by default. Not continue to use 2.0
. The stable
image was meant as a way for users to opt into an older image if they are having serious problems with the newer image.
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.
To clarify, terminology here has swapped, as per our conversation on docker image versioning. latest
doesn't mean bleeding edge to us, that is what RCs are. latest
is the most recent image that we have vetted and consider production ready.
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.
OK.
stable
is 3.0
at this moment. Anyways, using latest
should not be a problem and will keep our projects up to date, but we will need to careful when releasing new images, since the change will affect the projects immediately.
Considering that we have a feature flag now to use testing
, this will allow us to test RCs easily.
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.
If there isn't a technical limitation to why we can't use the same image for both, I agree that both should point to the same image.
I think there isn't a technical limitation, but I'm not 100% sure yet.
I will default both to latest
an test locally how it behaves as a first step.
readthedocs/config/config.py
Outdated
@@ -146,6 +146,8 @@ class BuildConfigBase: | |||
'mkdocs', | |||
'submodules', | |||
] | |||
valid_build_images = [k.split(':')[1] for k in DOCKER_IMAGE_SETTINGS] |
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.
Each version has different valid images, v1 accepts number versions, v2 only latest and stable (from the user side).
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.
Means we can still override them from the admin
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.
Mmm... this is interesting. I wasn't aware.
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.
v2 only latest and stable (from the user side).
Isn't this line saying that 3.0
and other numbered versions are supported also: https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/config/config.py#L580
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.
Yeah, but they aren't documented. I'm not sure if we will allow users to specify that from the config file, it wasn't clear to me.
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.
From what I linked in the comment above, I guess no
I made the changes that we discussed on the chat and I think this is ready for review. |
readthedocs/config/config.py
Outdated
@@ -146,6 +147,14 @@ class BuildConfigBase: | |||
'mkdocs', | |||
'submodules', | |||
] | |||
|
|||
valid_build_images = {'stable', 'latest'} | |||
for k in DOCKER_IMAGE_SETTINGS: |
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.
We should put this in a function or property
5749259
to
320ea9f
Compare
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.
CI failure is only because of the linter
Remove all the hardcoded valid options/choices from the Config objects and get them from Django settings instead.
V1 reads the versions from DOCKER_IMAGE_SETTINGS and keeps only the numbered ones. V2 only accepts `stable` and `latest` (they are hardcoded because they don't change).
YAML v1 and v2 files allow the same Docker build images now, - 1.0 - 2.0 - 3.0 - 4.0 - stable - latest Any new image added to DOCKER_IMAGE_SETTINGS will be automatically picked as accepted for both YAML files.
By making `latest` as default, and considering that this will be `4.0` which has python `3.7`, the default python selected when using `3` will be `3.7`.
I just fixed the linting issue. This PR is ready to be merged from my point of view. I triggered some builds locally and they worked as expected when using the default values. I loved that @stsewd created so many tests around this. |
8126b74
to
a7770c0
Compare
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.
Looks good. Let's ship it :)
This PR defines latest Docker images released as default in our Django settings.
I had to refactor some things from the
Config
objects (v1
andv2
) because they were hard-coding some values internally in the class. While doing this, I found thatv2
depends on the Docker image used when returning the valid Python versions (get_valid_python_version
) butv1
does not --I left the behavior as it was, though. As I added the new python supported values as valid options forv1
, the default Python version returned when using3
is3.7
, becauselatest
is the default image used when no specified.Summary,
latest
is the default image for YAML v1 and v2latest
is an alias for4.0
(at this moment)python.version==3
is specified,3.7
is usedrcX
images are allowed to be specified in the YAML file1.0
,2.0
,3.0
,4.0
,stable
andlatest
DOCKER_IMAGE_SETTINGS
settingDOCKER_DEFAULT_VERSION