Skip to content

Replace "_bashbrew-arches" and "_bashbrew-shared-tags" with a ~sorted "bashbrew cat" clone in diff-pr.sh#7966

Merged
yosifkit merged 3 commits intodocker-library:masterfrom
infosiftr:better-diff
May 11, 2020
Merged

Replace "_bashbrew-arches" and "_bashbrew-shared-tags" with a ~sorted "bashbrew cat" clone in diff-pr.sh#7966
yosifkit merged 3 commits intodocker-library:masterfrom
infosiftr:better-diff

Conversation

@tianon
Copy link
Member

@tianon tianon commented May 8, 2020

See https://github.com/docker-library/official-images/pull/7965/files vs #7965 (comment) for an example of the improvement in reviewability this can generate!

diff-pr.sh Outdated
{{- end -}}
'
done
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is made possible by docker-library/bashbrew@0fc0b09 which allows me to reimplement https://github.com/docker-library/go-dockerlibrary/blob/c5db18cf68eb1bd2c52046d244bb629d3ed3b109/manifest/rfc2822.go#L229-L242, but with sort -V piped to --build-order in the middle which should give us ~version sorted entries while still being in the right "build order" and still looking just like bashbrew cat foo (but such that a complete reordering of library/foo's entries should give ~the same output 😄 🤘).

Copy link
Member Author

@tianon tianon May 8, 2020

Choose a reason for hiding this comment

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

Hmm, if I pipe the output of this through something like sed 's/, /,\n /g', we get diffs like this:

Diff:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 22f7cfc..27a895e 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,48 +1,42 @@
 Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon), Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
 GitRepo: https://github.com/docker-library/gcc.git
 
-Tags: 6.5.0,
-  6.5,
-  6
-Architectures: amd64,
-  arm32v5,
-  arm32v7
-GitCommit: e17fd3097b743216f292e50ea8e84b3b3bcc4e53
-Directory: 6
-
-Tags: 7.5.0,
-  7.5,
-  7
+Tags: 8.4.0,
+  8.4,
+  8
 Architectures: amd64,
   arm32v5,
   arm32v7,
   arm64v8,
+  mips64le,
   ppc64le,
   s390x
-GitCommit: aab71caeb1be048b44fd140a102cb7f17f995276
-Directory: 7
+GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+Directory: 8
 
-Tags: 8.4.0,
-  8.4,
-  8
+Tags: 9.3.0,
+  9.3,
+  9
 Architectures: amd64,
   arm32v5,
   arm32v7,
   arm64v8,
+  mips64le,
   ppc64le,
   s390x
-GitCommit: f3db0f591ce42dd2ac3aec240ca47c87762bc385
-Directory: 8
+GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+Directory: 9
 
-Tags: 9.3.0,
-  9.3,
-  9,
+Tags: 10.1.0,
+  10.1,
+  10,
   latest
 Architectures: amd64,
   arm32v5,
   arm32v7,
   arm64v8,
+  mips64le,
   ppc64le,
   s390x
-GitCommit: d9a58942c8ff2c5c5a01e16bf0ffdf5e5dc61277
-Directory: 9
+GitCommit: 97b046b578bd86cae5414d80b3ad0027c590aebd
+Directory: 10

I'm not convinced it's better, but it does have some nice properties.

Copy link
Member

Choose a reason for hiding this comment

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

That does seem interesting, but I'd vote to stick with the unedited output.

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to split this out to a separate script in case someone wanted to get this "sorted" bashbrew cat output?

Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason I completely missed this second comment in my email. 😕

Yeah, I think that's not a bad idea, although ideally it would live in the https://github.com/docker-library/bashbrew repo, which would complicate using it here. I guess we'll start with it being a script here and go from there.

@tianon
Copy link
Member Author

tianon commented May 8, 2020

That latest commit (9142251) leads to output like the following for a PR like #7611:

Diff:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index bdfae4a..19e5b19 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1 +1,5 @@
-Maintainers: New Image! :D (@docker-library-bot)
+Maintainers: Thijs Feryn <thijs@varni.sh> (@thijsferyn)
+GitRepo: https://github.com/varnish/docker-hitch.git
+
+Tags: 1, 1.5, 1.5.0, 1.5.0-1, latest
+GitCommit: eefa62b493b7dc4370f30dd278f3f37043769148
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..1bcc30b 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,5 @@
+hitch:1
+hitch:1.5
+hitch:1.5.0
+hitch:1.5.0-1
+hitch:latest
diff --git a/hitch_latest/Dockerfile b/hitch_latest/Dockerfile
new file mode 100644
index 0000000..1b5b210
--- /dev/null
+++ b/hitch_latest/Dockerfile
@@ -0,0 +1,24 @@
+FROM debian:buster-slim
+
+ENV FRONTEND_PORT 443
+ENV FRONTEND_HOST *
+ENV BACKEND_PORT 8443
+ENV BACKEND_HOST localhost
+ENV PROXY_PROTOCOL --write-proxy-v2
+
+RUN apt-get update; \
+	apt-get install -y --no-install-recommends openssl hitch=1.5.0-1; \
+	rm -rf /var/lib/apt/lists/*; \
+	mkdir /etc/hitch/certs
+
+WORKDIR /etc/hitch
+
+COPY example.com /etc/hitch/certs
+COPY hitch.conf /etc/hitch
+COPY docker-hitch-entrypoint /usr/local/bin/
+
+ENTRYPOINT ["docker-hitch-entrypoint"]
+
+EXPOSE 443
+
+CMD hitch --config=/etc/hitch/hitch.conf --frontend="[$FRONTEND_HOST]:$FRONTEND_PORT" --backend="[$BACKEND_HOST]:$BACKEND_PORT" $PROXY_PROTOCOL
diff --git a/hitch_latest/docker-hitch-entrypoint b/hitch_latest/docker-hitch-entrypoint
new file mode 100755
index 0000000..4ee2a81
--- /dev/null
+++ b/hitch_latest/docker-hitch-entrypoint
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+
+# this will check if the first argument is a flag
+# but only works if all arguments require a hyphenated flag
+# -v; -SL; -f arg; etc will work, but not arg1 arg2
+if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
+    set -- hitch "$@"
+fi
+
+exec "$@"
diff --git a/hitch_latest/example.com b/hitch_latest/example.com
new file mode 100644
index 0000000..c367680
--- /dev/null
+++ b/hitch_latest/example.com
@@ -0,0 +1,58 @@
+-----BEGIN CERTIFICATE-----
+MIIDwzCCAqugAwIBAgIUe4v+PgBZeohddbh92DAKmy8N6nAwDQYJKoZIhvcNAQEL
+BQAwVjELMAkGA1UEBhMCTk8xEzARBgNVBAgMClNvbWUtU3RhdGUxHDAaBgNVBAoM
+E1Zhcm5pc2ggU29mdHdhcmUgQVMxFDASBgNVBAMMC2V4YW1wbGUuY29tMB4XDTIw
+MDEzMDEwMDMzOFoXDTQ3MDYxNzEwMDMzOFowVjELMAkGA1UEBhMCTk8xEzARBgNV
+BAgMClNvbWUtU3RhdGUxHDAaBgNVBAoME1Zhcm5pc2ggU29mdHdhcmUgQVMxFDAS
+BgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
+AQEA3/STgvtdRnVPnuiONY4ZtUXexHgOUAhiYnm7GuLKrJCqC1DoSwjeA8Fr/sly
+nrkS0QdrHDh3tZ/9JO4JUChy+hISBjer32JOpmwwsKyuM4YkQ9YI9NeAJQX4vSeF
+krdau2OxuKn9L0e/D8TddzAQ39AOjrE+Y2lCzvoGF2cEesxMNS66JStDFR2w2I7e
+EdTydyXYT7mK6iqhk/3RB3XdwvdQj8DzPQSVFe6/pCa+dzpSSLI8YEHkB8azaz3H
+jsFp4flSPJJMX+pChbs8NBtekuHWDIExKIeyIpEBd37eoZR9+41PZJOsvya/JIhR
+BmVa/t66NHg8ETqUdZYn35pBwQIDAQABo4GIMIGFMCUGA1UdEQQeMByCC2V4YW1w
+bGUuY29tgg0qLmV4YW1wbGUuY29tMB0GA1UdDgQWBBSNwlE7yKISR2VwKF/ODERV
+528ppTAfBgNVHSMEGDAWgBSNwlE7yKISR2VwKF/ODERV528ppTAPBgNVHRMBA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xe0TEdTsSL0JNnssS2HNVKjqagfB3wJ/DWeBsXy71o15XLz7Ygv
+dxAp72jiD6D18+iFlv91fAToMDV8+4lNphiLgNGomeuI9SYYdo/zUGQ1NtewHpAg
+A58XFebBCrBL6zUjh1pMrz4nlFfrhubgEl6lqr+PIvCnMuAOk3L2d2Py8f4hta/Q
+Nmmm5mI9VRF1kkg8QzSJpnxub/qn2nN6DnY3ZJKNBK+BEBdHphNAJPioVspoeHQD
+5WCt+VSpyF+FPXNpbhkMJ6stl8Y0TbhFSKxMtzVWQ43Ul29RgatC8YlGPlIy/WCZ
+YX/oJSsiRcMYqfqwlRnnldpbdp7LOn6LOwIBAg==
+-----END DH PARAMETERS-----
diff --git a/hitch_latest/hitch.conf b/hitch_latest/hitch.conf
new file mode 100644
index 0000000..0b35f41
--- /dev/null
+++ b/hitch_latest/hitch.conf
@@ -0,0 +1,2 @@
+pem-file = "/etc/hitch/certs/example.com"
+user = "_hitch"

@tianon tianon mentioned this pull request May 8, 2020
9 tasks
@yosifkit yosifkit merged commit 3305d2c into docker-library:master May 11, 2020
@yosifkit yosifkit deleted the better-diff branch May 11, 2020 17:34
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.

2 participants