Commit Graph

366 Commits

Author SHA1 Message Date
Tianon Gravi 145add96da Fix minor typo 2017-09-05 07:36:47 -07:00
Tianon Gravi 3b0c4503cb Use the Hub v2 API for a dramatic no-op push speedup
This also has the benefit of only triggering automated builds when there have been actual changes to the image.

This works by comparing the Hub's `last_updated` timestamp to the `Created` timestamp of local images (in the case of `bashbrew push`), or to the `last_updated` timestamp of the images which make up the `SharedTags` and/or multiarch images (in the case of `bashbrew put-shared`).

This is a dramatic speedup because the Hub v2 API is faster (and has no auth for public repos) than the registry API.  If there are any errors in the fetching of `last_updated` from the Hub, we massage the timestamps such that the push simply always happens, as before (which will be the case for pushes to non-Hub registries, for example).
2017-08-28 09:46:47 -07:00
Tianon Gravi c4108a0534 Update go-dockerlibrary to pull in the new "getenv" function
See https://github.com/docker-library/go-dockerlibrary/pull/15.
2017-07-12 16:15:18 -07:00
yosifkit 994859128e Merge pull request #15 from infosiftr/getenv
Add new "getenv" templatelib function
2017-07-12 16:12:56 -07:00
Tianon Gravi 57f0420223 Add new "getenv" templatelib function
Three usages:

- getenv "FOO"
- getenv "FOO" "default"
- getenv "FOO" "set" "unset"
2017-07-12 16:06:44 -07:00
Tianon Gravi b9d7a8b7e7 Update manifest-tool to 0.6.0 and take advantage of new "tags:" support (for increased efficiency in pushing aliases) 2017-07-05 13:42:27 -07:00
Tianon Gravi 7634587e56 Add a separate ArchDockerFrom function for better template granularity
Here's an example diff I plan to apply over in the docs with this: (with an example output from `python`)

```diff
diff --git a/.template-helpers/generate-dockerfile-links-partial.tmpl b/.template-helpers/generate-dockerfile-links-partial.tmpl
index 5c13047a..996b9d60 100644
--- a/.template-helpers/generate-dockerfile-links-partial.tmpl
+++ b/.template-helpers/generate-dockerfile-links-partial.tmpl
@@ -4,21 +4,13 @@ This template defines the "Supported tags and Dockerfile links" portion of an im

 */ -}}

-{{- define "dockerfilePath" -}}
-	{{- $dir := .ArchDirectory arch -}}
-	{{- if ne $dir "." -}}
-		{{- $dir -}}
-		/
-	{{- end -}}
-	Dockerfile
-{{- end -}}
-
 {{- range $i, $e := $.Entries -}}
-	{{- if $e.HasArchitecture arch -}}
+	{{- $arch := ternary (ternary arch ($e.Architectures | first) ($e.HasArchitecture arch)) arch (eq arch "amd64") -}}
+	{{- if $e.HasArchitecture $arch -}}
 		{{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
-		{{- $from := $.DockerFrom $e -}}
+		{{- $from := $.ArchDockerFrom $arch $e -}}

-		{{- $gitRepo := $e.ArchGitRepo arch -}}
+		{{- $gitRepo := $e.ArchGitRepo $arch -}}
 		{{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
 		{{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}

@@ -28,9 +20,11 @@ This template defines the "Supported tags and Dockerfile links" portion of an im

 		- {{- "\t" -}}
 		{{- if $isGitHub -}} [ {{- end -}}
-		` {{- $e.Tags | join "`, `" -}} ` (* {{- template "dockerfilePath" $e -}} *)
-		{{- $gitCommit := $e.ArchGitCommit arch -}}
-		{{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- template "dockerfilePath" $e -}} ) {{- end -}}
+		{{- $dir := .ArchDirectory $arch -}}
+		{{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}}
+		` {{- $e.Tags | join "`, `" -}} ` (* {{- $dockerfilePath -}} *)
+		{{- $gitCommit := $e.ArchGitCommit $arch -}}
+		{{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
 		{{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
 	{{- end -}}
 {{- end -}}
diff --git a/python/README.md b/python/README.md
index c23f79f0..410b8525 100644
--- a/python/README.md
+++ b/python/README.md
@@ -22,6 +22,7 @@ WARNING:
 -	[`2.7.13-alpine3.6`, `2.7-alpine3.6`, `2-alpine3.6` (*2.7/alpine3.6/Dockerfile*)](e81758e60c/2.7/alpine3.6/Dockerfile)
 -	[`2.7.13-wheezy`, `2.7-wheezy`, `2-wheezy` (*2.7/wheezy/Dockerfile*)](1ca4a57b20/2.7/wheezy/Dockerfile)
 -	[`2.7.13-onbuild`, `2.7-onbuild`, `2-onbuild` (*2.7/onbuild/Dockerfile*)](7663560df7/2.7/onbuild/Dockerfile)
+-	[`2.7.13-windowsservercore`, `2.7-windowsservercore`, `2-windowsservercore` (*2.7/windows/windowsservercore/Dockerfile*)](db2d58d730/2.7/windows/windowsservercore/Dockerfile)
 -	[`3.3.6`, `3.3` (*3.3/Dockerfile*)](88ba87d31a/3.3/Dockerfile)
 -	[`3.3.6-slim`, `3.3-slim` (*3.3/slim/Dockerfile*)](88ba87d31a/3.3/slim/Dockerfile)
 -	[`3.3.6-alpine`, `3.3-alpine` (*3.3/alpine/Dockerfile*)](88ba87d31a/3.3/alpine/Dockerfile)
@@ -36,16 +37,19 @@ WARNING:
 -	[`3.5.3-slim`, `3.5-slim` (*3.5/slim/Dockerfile*)](88ba87d31a/3.5/slim/Dockerfile)
 -	[`3.5.3-alpine`, `3.5-alpine` (*3.5/alpine/Dockerfile*)](88ba87d31a/3.5/alpine/Dockerfile)
 -	[`3.5.3-onbuild`, `3.5-onbuild` (*3.5/onbuild/Dockerfile*)](9a9021f213/3.5/onbuild/Dockerfile)
+-	[`3.5.3-windowsservercore`, `3.5-windowsservercore` (*3.5/windows/windowsservercore/Dockerfile*)](db2d58d730/3.5/windows/windowsservercore/Dockerfile)
 -	[`3.6.1`, `3.6`, `3`, `latest` (*3.6/Dockerfile*)](88ba87d31a/3.6/Dockerfile)
 -	[`3.6.1-slim`, `3.6-slim`, `3-slim`, `slim` (*3.6/slim/Dockerfile*)](88ba87d31a/3.6/slim/Dockerfile)
 -	[`3.6.1-alpine`, `3.6-alpine`, `3-alpine`, `alpine` (*3.6/alpine/Dockerfile*)](88ba87d31a/3.6/alpine/Dockerfile)
 -	[`3.6.1-alpine3.6`, `3.6-alpine3.6`, `3-alpine3.6`, `alpine3.6` (*3.6/alpine3.6/Dockerfile*)](88ba87d31a/3.6/alpine3.6/Dockerfile)
 -	[`3.6.1-onbuild`, `3.6-onbuild`, `3-onbuild`, `onbuild` (*3.6/onbuild/Dockerfile*)](7eca63adca/3.6/onbuild/Dockerfile)
+-	[`3.6.1-windowsservercore`, `3.6-windowsservercore`, `3-windowsservercore`, `windowsservercore` (*3.6/windows/windowsservercore/Dockerfile*)](db2d58d730/3.6/windows/windowsservercore/Dockerfile)
 -	[`3.6.2rc1`, `3.6-rc`, `rc` (*3.6-rc/Dockerfile*)](73d283d3dc/3.6-rc/Dockerfile)
 -	[`3.6.2rc1-slim`, `3.6-rc-slim`, `rc-slim` (*3.6-rc/slim/Dockerfile*)](73d283d3dc/3.6-rc/slim/Dockerfile)
 -	[`3.6.2rc1-alpine`, `3.6-rc-alpine`, `rc-alpine` (*3.6-rc/alpine/Dockerfile*)](73d283d3dc/3.6-rc/alpine/Dockerfile)
 -	[`3.6.2rc1-alpine3.6`, `3.6-rc-alpine3.6`, `rc-alpine3.6` (*3.6-rc/alpine3.6/Dockerfile*)](73d283d3dc/3.6-rc/alpine3.6/Dockerfile)
 -	[`3.6.2rc1-onbuild`, `3.6-rc-onbuild`, `rc-onbuild` (*3.6-rc/onbuild/Dockerfile*)](73d283d3dc/3.6-rc/onbuild/Dockerfile)
+-	[`3.6.2rc1-windowsservercore`, `3.6-rc-windowsservercore`, `rc-windowsservercore` (*3.6-rc/windows/windowsservercore/Dockerfile*)](73d283d3dc/3.6-rc/windows/windowsservercore/Dockerfile)

 # Quick reference

```
2017-06-20 08:36:41 -07:00
Tianon Gravi 679388e80b Add "--apply-constraints" in Travis so that "bashbrew from" doesn't fail on "windows-amd64" 2017-06-14 11:16:39 -07:00
Tianon Gravi da2823db4d Validate (and deduplicate) Architectures values 2017-06-14 10:31:28 -07:00
yosifkit 29d359eaa1 Merge pull request #14 from infosiftr/invalid-arches
Add Architectures sorting, deduplication, and validation
2017-06-14 10:17:09 -07:00
Tianon Gravi 21d68d83eb Add Architectures sorting, deduplication, and validation 2017-06-13 14:34:23 -07:00
Tianon Gravi 1853c28093 Add an initial "manifest-tool" implementation 2017-06-13 09:33:53 -07:00
yosifkit 4fd80f3c84 Merge pull request #13 from infosiftr/supported-arches
Add a package for converting from a "bashbrew arch" to a full OCI "platform" object (os+arch+variant)
2017-06-12 12:58:06 -07:00
Tianon Gravi 9c538e056d Update to manifest-tool 0.5.0 and verify signatures 2017-06-08 14:35:04 -07:00
Tianon Gravi b33efdf4ad Add a package for converting from a "bashbrew arch" to a full OCI "platform" object (os+arch+variant)
This also includes a list of standard mappings (intended for both input validation and output conversion).
2017-06-06 23:27:51 -07:00
Tianon Gravi 1066e05a1f Add "arch" function for "bashbrew cat" to access the current architecture string
```console
$ bashbrew cat --format '{{ arch }}' ubuntu
amd64
$ bashbrew --arch=s390x cat --format '{{ arch }}' ubuntu
s390x
$ BASHBREW_ARCH=s390x bashbrew cat --format '{{ arch }}' ubuntu
s390x
```
2017-06-06 11:21:23 -07:00
Tianon Gravi e73133d8de Add a "BASHBREW_PULL" environment variable to control the "pull policy" during build 2017-06-06 11:04:01 -07:00
Tianon Gravi cfe6c96010 Refactor bashbrew release Dockerfile to use "bashbrew arches" in the released binary names
```
+ file bin/bashbrew-amd64 bin/bashbrew-arm32v5 bin/bashbrew-arm32v6 bin/bashbrew-arm32v7 bin/bashbrew-arm64v8 bin/bashbrew-darwin-amd64 bin/bashbrew-i386 bin/bashbrew-ppc64le bin/bashbrew-s390x bin/bashbrew-windows-amd64.exe bin/manifest-tool-amd64 bin/manifest-tool-arm64v8 bin/manifest-tool-darwin-amd64 bin/manifest-tool-ppc64le bin/manifest-tool-s390x bin/manifest-tool-windows-amd64.exe
bin/bashbrew-amd64:                  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
bin/bashbrew-arm32v5:                ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
bin/bashbrew-arm32v6:                ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
bin/bashbrew-arm32v7:                ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
bin/bashbrew-arm64v8:                ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
bin/bashbrew-darwin-amd64:           Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
bin/bashbrew-i386:                   ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
bin/bashbrew-ppc64le:                ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
bin/bashbrew-s390x:                  ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
bin/bashbrew-windows-amd64.exe:      PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
bin/manifest-tool-amd64:             ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9c5441ad0c18e839627e0b61c2369292831c18a5, not stripped
bin/manifest-tool-arm64v8:           ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped
bin/manifest-tool-darwin-amd64:      Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
bin/manifest-tool-ppc64le:           ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, not stripped
bin/manifest-tool-s390x:             ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, not stripped
bin/manifest-tool-windows-amd64.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
 ---> 0acd3cdb36b1
Removing intermediate container ee37fa20846d
Successfully built 0acd3cdb36b1
```
2017-06-05 16:15:26 -07:00
Tianon Gravi 51bb97f72d Fix architecture-specific values inherited from the global entry 2017-06-05 15:40:37 -07:00
Tianon Gravi ce3ef0e05c Merge pull request #12 from infosiftr/arch-values-fixes
Add new functions to ensure global arch-specific values are inherited properly
2017-06-05 12:57:44 -07:00
Tianon Gravi ce6f973ced Add new functions to ensure global arch-specific values are inherited properly 2017-06-05 12:54:57 -07:00
Tianon Gravi e3f0b23913 Add "--depth" flag to "bashbrew children" and "bashbrew parents"
```console
$ diff -u <(bashbrew children --depth 2 alpine) <(bashbrew children --depth 3 alpine)
--- /dev/fd/63	2017-06-02 07:29:56.871863245 -0700
+++ /dev/fd/62	2017-06-02 07:29:56.872863215 -0700
@@ -578,6 +578,20 @@
 zookeeper:3.4.10
 zookeeper:3.4
 zookeeper:latest
+maven:3.5.0-jdk-7-onbuild-alpine
+maven:3.5-jdk-7-onbuild-alpine
+maven:3-jdk-7-onbuild-alpine
+maven:3.5.0-jdk-8-onbuild-alpine
+maven:3.5.0-onbuild-alpine
+maven:3.5-jdk-8-onbuild-alpine
+maven:3.5-onbuild-alpine
+maven:3-jdk-8-onbuild-alpine
+maven:3-onbuild-alpine
+maven:onbuild-alpine
+orientdb:2.2.21-spatial
+clojure:lein-2.7.1-alpine-onbuild
+clojure:lein-alpine-onbuild
+clojure:alpine-onbuild
 notary:server
 notary:server-0.5.0
 notary:signer

$ bashbrew parents maven:onbuild-alpine
maven:3-jdk-8-alpine
openjdk:8-jdk-alpine
alpine:3.6

$ bashbrew parents --depth 1 maven:onbuild-alpine
maven:3-jdk-8-alpine

$ bashbrew parents --depth 2 maven:onbuild-alpine
maven:3-jdk-8-alpine
openjdk:8-jdk-alpine
```
2017-06-02 07:31:52 -07:00
Tianon Gravi fdf3501d49 Add initial Architectures support (and the beginnings of a "put-shared" subcommand for bringing all the SharedTags and arch-specific images together with manifest lists/indexes) 2017-06-01 16:56:04 -07:00
Tianon Gravi 663a091da1 Add a few missing bits 2017-06-01 16:37:35 -07:00
Tianon Gravi 08c08a33e1 Add GitRepo and GitCommit setters 2017-06-01 14:58:09 -07:00
Tianon Gravi 68838fa86d Add new "DefaultArchitecture" value 2017-06-01 14:24:33 -07:00
Tianon Gravi 840158dfc5 Merge pull request #11 from infosiftr/fix-accidental-additive-default-values
Fix the case of default Architectures being added to any Global Architectures
2017-06-01 14:16:37 -07:00
Tianon Gravi 6c0c78bdb5 Fix the case of default Architectures being added to any Global Architectures 2017-06-01 14:13:35 -07:00
Tianon Gravi 235f7e455d Merge pull request #10 from infosiftr/arches
Add new "Architectures" field
2017-06-01 11:57:08 -07:00
Tianon Gravi d84bfcca38 Add a few new fields for slightly more code coverage 2017-06-01 11:38:22 -07:00
Tianon Gravi 40117df115 Add more tweaks, functionality, and tests to the Architectures implementation 2017-06-01 11:16:29 -07:00
Joe Ferguson 76cdafaca6 Add arch-specific fields 2017-05-24 16:12:36 -07:00
Tianon Gravi 362855e06f Add simple Dockerfile for cross-building bashbrew 2017-05-02 14:38:01 -07:00
Tianon Gravi 61055e431c Merge pull request #9 from infosiftr/TestParseError
Add a simple test for a "manifest.Parse" error
2017-05-02 10:40:10 -07:00
Tianon Gravi ae1ac322eb Add a simple test for a "manifest.Parse" error 2017-05-02 10:36:50 -07:00
Tianon Gravi 65c107f228 Merge pull request #8 from infosiftr/codecov
Add codecov.io
2017-05-02 10:23:52 -07:00
Tianon Gravi 704e5d9d68 Add codecov.io 2017-05-02 10:21:40 -07:00
Tianon Gravi 5c0cbe7322 Add an example of reading a local manifest file too 2017-04-03 15:37:39 -07:00
Tianon Gravi 02a23d8a95 Increase coverage further by adding an example for "manifest.Fetch" 2017-04-03 15:29:23 -07:00
Tianon Gravi 6355cdbae8 Apply gofmt 2017-04-03 15:20:35 -07:00
Tianon Gravi ef736bc836 Add example Constraints for another 0.4% test coverage increase 2017-04-03 15:17:09 -07:00
Tianon Gravi 499d4731a3 Add "line-based" maintainers to our example for a 0.4% coverage increase 2017-04-03 15:13:42 -07:00
Tianon Gravi 9536e92ebd Convert "example.go" into a real Go "Example" function (77% test coverage right off the bat!) 2017-04-03 15:10:40 -07:00
Tianon Gravi 818247f8b4 Add examples/tests for "pkg/execpipe" (100% coverage!) 2017-04-03 15:02:26 -07:00
Tianon Gravi b7dd34a9b2 Update coverage in "pkg/templatelib" to 100% 2017-04-03 12:57:27 -07:00
Tianon Gravi 3da366f1ac Rename example functions so they actually show up 2017-04-03 12:29:03 -07:00
Tianon Gravi fa89a44b4d Rename example functions so they show up in godoc properly 2017-04-03 12:25:50 -07:00
Tianon Gravi 8177bb8839 Add some examples/tests for "pkg/templatelib" (94.9% coverage) 2017-04-03 12:20:49 -07:00
yosifkit e9173c5800 Merge pull request #7 from infosiftr/race-cover
Add explicit Travis script for "-race -cover"
2017-04-03 12:07:07 -07:00
Tianon Gravi 5f5ae8d25b Merge pull request #6 from infosiftr/100-percent-stripper-coverage
Update "pkg/stripper" coverage to 100% with a smaller buffer size
2017-04-03 11:27:55 -07:00