jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.57k stars 390 forks source link

BinderHub reported version is always `.dirty` #1621

Open manics opened 1 year ago

manics commented 1 year ago

Bug description

The reported BinderHub version in the /versions endpoint on K8s always has the .dirty suffix

Expected behaviour

"binderhub": "0.2.0+1142.g2811d52"

Actual behaviour

https://gke.mybinder.org/versions

{
  "builder": "quay.io/jupyterhub/repo2docker:2022.10.0-89.g49162fc",
  "binderhub": "0.2.0+1142.g2811d52.dirty"
}
consideRatio commented 1 year ago

Diagnosis

I did chartpress and got the following changes after the build completed, but just after it started I had also seen the changes in Chart.yaml.

+++ b/helm-chart/binderhub/Chart.yaml
@@ -1,7 +1,7 @@
 # Chart.yaml v2 reference: https://helm.sh/docs/topics/charts/#the-chartyaml-file
 apiVersion: v2
 name: binderhub
-version: 0.0.1-set.by.chartpress
+version: 1.0.0-0.dev.git.3020.h9f545b7
 dependencies:
   # Source code:    https://github.com/jupyterhub/zero-to-jupyterhub-k8s
   # Latest version: https://github.com/jupyterhub/zero-to-jupyterhub-k8s/tags
diff --git a/helm-chart/binderhub/values.yaml b/helm-chart/binderhub/values.yaml
index 131472e..50fcf1a 100644
--- a/helm-chart/binderhub/values.yaml
+++ b/helm-chart/binderhub/values.yaml
@@ -18,7 +18,7 @@ tolerations: []

 image:
   name: jupyterhub/k8s-binderhub
-  tag: "set-by-chartpress"
+  tag: "1.0.0-0.dev.git.3020.h9f545b7"
   pullPolicy: ""
   pullSecrets: []

@@ -320,16 +320,14 @@ ingress:
     type: kube-lego
   hosts: []
   ingressClassName:
-  annotations:
-    {}
+  annotations: {}
     # kubernetes.io/ingress.class: nginx
     # kubernetes.io/tls-acme: "true"
   pathSuffix:
     # Suffix added to Ingress's routing path pattern.
     # Specify `*` if your ingress matches path by glob pattern.
   pathType: Prefix
-  tls:
-    []
+  tls: []
     # Secrets must be manually created in the namespace.
     # - secretName: chart-example-tls
     #   hosts:

From my logs from chartpress, I see that Chart.yaml was written to early, while values.yaml was written to late.

Updating binderhub/Chart.yaml: version: 1.0.0-0.dev.git.3020.h9f545b7
$> docker build -t jupyterhub/k8s-binderhub:1.0.0-0.dev.git.3020.h9f545b7 .. -f images/binderhub/Dockerfile
[+] Building 71.4s (18/18) FINISHED                                                                                                                                          
 => [internal] load .dockerignore                                                                                                                                       0.1s
 => => transferring context: 70B                                                                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                                                                    0.0s
 => => transferring dockerfile: 2.48kB                                                                                                                                  0.0s
 => resolve image config for docker.io/docker/dockerfile:1.3                                                                                                            2.0s
 => docker-image://docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2                                              0.6s
 => => resolve docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2                                                  0.0s
 => => sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2 2.00kB / 2.00kB                                                                          0.0s
 => => sha256:93f32bd6dd9004897fed4703191f48924975081860667932a4df35ba567d7426 528B / 528B                                                                              0.0s
 => => sha256:e532695ddd93ca7c85a816c67afdb352e91052fab7ac19a675088f80915779a7 1.21kB / 1.21kB                                                                          0.0s
 => => sha256:24a639a53085eb680e1d11618ac62f3977a3926fedf5b8471ace519b8c778030 9.67MB / 9.67MB                                                                          0.4s
 => => extracting sha256:24a639a53085eb680e1d11618ac62f3977a3926fedf5b8471ace519b8c778030                                                                               0.1s
 => [internal] load metadata for docker.io/library/python:3.11-slim-bullseye                                                                                            1.8s
 => [internal] load metadata for docker.io/library/python:3.11-bullseye                                                                                                 1.9s
 => [stage-1 1/5] FROM docker.io/library/python:3.11-slim-bullseye@sha256:28e5366ce5c423639950d3962b668730535da08cd235bdacef32171e26cd2b5c                              8.4s
 => => resolve docker.io/library/python:3.11-slim-bullseye@sha256:28e5366ce5c423639950d3962b668730535da08cd235bdacef32171e26cd2b5c                                      0.0s
 => => sha256:28e5366ce5c423639950d3962b668730535da08cd235bdacef32171e26cd2b5c 1.65kB / 1.65kB                                                                          0.0s
 => => sha256:d36b86a6a56b7376171651de411cb7393d2f02841c149665c2ddff4c0f322855 1.37kB / 1.37kB                                                                          0.0s
 => => sha256:281d606e8b48b0e265d39e3919e8c3ad5917c9336914c29eee9d6ac5e9b0b3a1 7.79kB / 7.79kB                                                                          0.0s
 => => sha256:bb263680fed18eecdc67f885094df6f589bafc19004839d7fdf141df236a61aa 31.41MB / 31.41MB                                                                        7.1s
 => => sha256:43900b2bbd7f3a41cc0b3afe622d03b882980d3997c006ab4309a4b2f2126ad4 1.08MB / 1.08MB                                                                          5.2s
 => => sha256:c0f518b07058604f622d11565a9df96156fd0e9f6d8af0d94d3821c352575f69 12.10MB / 12.10MB                                                                        6.2s
 => => sha256:494044b06174a7f1d2105668e38dbb7b061fc1e632f2181d6a45c3649775270e 233B / 233B                                                                              6.4s
 => => sha256:f1abba28b5514ad3ac061ba8d7542ab6c2c553686385dfe88d53db98121f90b6 3.35MB / 3.35MB                                                                          6.8s
 => => extracting sha256:bb263680fed18eecdc67f885094df6f589bafc19004839d7fdf141df236a61aa                                                                               0.5s
 => => extracting sha256:43900b2bbd7f3a41cc0b3afe622d03b882980d3997c006ab4309a4b2f2126ad4                                                                               0.1s
 => => extracting sha256:c0f518b07058604f622d11565a9df96156fd0e9f6d8af0d94d3821c352575f69                                                                               0.2s
 => => extracting sha256:494044b06174a7f1d2105668e38dbb7b061fc1e632f2181d6a45c3649775270e                                                                               0.0s
 => => extracting sha256:f1abba28b5514ad3ac061ba8d7542ab6c2c553686385dfe88d53db98121f90b6                                                                               0.1s
 => [internal] load build context                                                                                                                                       1.3s
 => => transferring context: 73.35MB                                                                                                                                    1.3s
 => [build-stage 1/5] FROM docker.io/library/python:3.11-bullseye@sha256:52a87b9725a0f0f9b2bc269c89b771ea8dbd1f37db19ae359d9937808d13ab50                              12.5s
 => => resolve docker.io/library/python:3.11-bullseye@sha256:52a87b9725a0f0f9b2bc269c89b771ea8dbd1f37db19ae359d9937808d13ab50                                           0.0s
 => => sha256:52a87b9725a0f0f9b2bc269c89b771ea8dbd1f37db19ae359d9937808d13ab50 1.65kB / 1.65kB                                                                          0.0s
 => => sha256:f92346e0c39e6d8ba8c28e9528cc3e6e19df19be2fd733de4d38d6f899648ba5 8.82kB / 8.82kB                                                                          0.0s
 => => sha256:1e4aec178e0864db93a6f97a20bde3445871a4562c1801185eca1238d3a0e80d 55.05MB / 55.05MB                                                                        2.3s
 => => sha256:6c1024729feeb2893dad43684fe7679c4d866c3640dfc3912bbd93c5a51f32d2 5.17MB / 5.17MB                                                                          1.0s
 => => sha256:6128ea86db7f6b1b286d2c01646d599352f6ddd9893420eb815a06c3b90619f8 2.22kB / 2.22kB                                                                          0.0s
 => => sha256:c3aa11fbc85a2a9660c98cfb4d0a2db8cde983ce3c87565c356cfdf1ddf2654c 10.88MB / 10.88MB                                                                        1.0s
 => => sha256:aa54add66b3a47555c8b761f60b15f818236cc928109a30032111efc98c6fcd4 54.59MB / 54.59MB                                                                        5.0s
 => => sha256:9e3a60c2bce7eed21ed40f067f9b3491ae3e0b7a6edbc8ed5d9dc7dd9e4a0f92 196.90MB / 196.90MB                                                                      8.9s
 => => extracting sha256:1e4aec178e0864db93a6f97a20bde3445871a4562c1801185eca1238d3a0e80d                                                                               0.7s
 => => sha256:3b2123ce9d0d2bd342b25346114cc451ccecb2641ed7132b1fd30a6545aa6e67 6.29MB / 6.29MB                                                                          2.8s
 => => sha256:05df7720fcb8ca003f8439f8dca64f9635b410244c5f1237a549d09e3380f2fb 21.20MB / 21.20MB                                                                        4.4s
 => => extracting sha256:6c1024729feeb2893dad43684fe7679c4d866c3640dfc3912bbd93c5a51f32d2                                                                               0.2s
 => => extracting sha256:c3aa11fbc85a2a9660c98cfb4d0a2db8cde983ce3c87565c356cfdf1ddf2654c                                                                               0.1s
 => => sha256:972ab8743e388f6561615a2a9c9337cb578cec0ab9bebbe00d01a81432447850 233B / 233B                                                                              4.6s
 => => sha256:ae9f20f2cd37234e5f6420112b88bbaa20bd1f1d8582ce3a60b10fc5acbf314d 3.06MB / 3.06MB                                                                          5.0s
 => => extracting sha256:aa54add66b3a47555c8b761f60b15f818236cc928109a30032111efc98c6fcd4                                                                               0.8s
 => => extracting sha256:9e3a60c2bce7eed21ed40f067f9b3491ae3e0b7a6edbc8ed5d9dc7dd9e4a0f92                                                                               2.5s
 => => extracting sha256:3b2123ce9d0d2bd342b25346114cc451ccecb2641ed7132b1fd30a6545aa6e67                                                                               0.1s
 => => extracting sha256:05df7720fcb8ca003f8439f8dca64f9635b410244c5f1237a549d09e3380f2fb                                                                               0.3s
 => => extracting sha256:972ab8743e388f6561615a2a9c9337cb578cec0ab9bebbe00d01a81432447850                                                                               0.0s
 => => extracting sha256:ae9f20f2cd37234e5f6420112b88bbaa20bd1f1d8582ce3a60b10fc5acbf314d                                                                               0.1s
 => [stage-1 2/5] RUN apt-get update  && apt-get upgrade --yes  && apt-get install --yes         git         libcurl4         tini  && rm -rf /var/lib/apt/lists/*     10.9s
 => [build-stage 2/5] RUN echo "deb https://deb.nodesource.com/node_16.x bullseye main" > /etc/apt/sources.list.d/nodesource.list  && curl -s https://deb.nodesource.c  3.6s
 => [build-stage 3/5] RUN apt-get update  && apt-get install --yes         nodejs  && rm -rf /var/lib/apt/lists/*                                                       6.5s
 => [stage-1 3/5] COPY helm-chart/images/binderhub/requirements.txt /tmp/requirements.txt                                                                               0.0s
 => [build-stage 4/5] COPY . .                                                                                                                                          1.2s
 => [build-stage 5/5] RUN --mount=type=cache,target=/tmp/pip-cache     pip install build  && pip wheel --wheel-dir=/tmp/wheels         .         pycurl         -r he  28.6s
 => [stage-1 4/5] RUN --mount=type=cache,target=/tmp/pip-cache     --mount=type=cache,from=build-stage,source=/tmp/wheels,target=/tmp/wheels     pip install --find-l  12.2s
 => [stage-1 5/5] RUN python -c "import pycurl, binderhub.app"                                                                                                          1.1s
 => exporting to image                                                                                                                                                  0.8s
 => => exporting layers                                                                                                                                                 0.7s
 => => writing image sha256:1230e5301da7fb5737e1e35ff1f99a354cc70394c0c57ec5c9970769137bac64                                                                            0.0s
 => => naming to docker.io/jupyterhub/k8s-binderhub:1.0.0-0.dev.git.3020.h9f545b7                                                                                       0.0s
Updating binderhub/values.yaml: image.tag: {'repository': 'jupyterhub/k8s-binderhub', 'tag': '1.0.0-0.dev.git.3020.h9f545b7'}

The version reported it set by versioneer in https://github.com/jupyterhub/binderhub/blob/main/binderhub/_version.py, we have done COPY . . when building the binderhub wheel, so I assume versioneer sees the uncommited change to Chart.yaml and considers it dirty.

If we would do COPY x y where we reduce whats copied, we wouldn't get the .git state which probably makes versioneer fail to determine a version.

I'm not sure what makes sense to do.

manics commented 1 year ago

See https://github.com/jupyterhub/chartpress/issues/205