├── 7 └── Dockerfile ├── 8 └── Dockerfile ├── .github └── workflows │ ├── ci.yml │ ├── diff.yml │ └── history.sh ├── Dockerfile.template ├── LICENSE ├── README.md ├── generate-stackbrew-library.sh └── update.sh /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | 15 | generate-jobs: 16 | name: Generate Jobs 17 | runs-on: ubuntu-latest 18 | outputs: 19 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: docker-library/bashbrew@HEAD 23 | - id: generate-jobs 24 | name: Generate Jobs 25 | run: | 26 | strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" 27 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 28 | jq . <<<"$strategy" # sanity check / debugging aid 29 | 30 | test: 31 | needs: generate-jobs 32 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 33 | name: ${{ matrix.name }} 34 | runs-on: ${{ matrix.os }} 35 | steps: 36 | - uses: actions/checkout@v3 37 | - name: Prepare Environment 38 | run: ${{ matrix.runs.prepare }} 39 | - name: Pull Dependencies 40 | run: ${{ matrix.runs.pull }} 41 | - name: Build ${{ matrix.name }} 42 | run: ${{ matrix.runs.build }} 43 | - name: History ${{ matrix.name }} 44 | run: ${{ matrix.runs.history }} 45 | - name: Test ${{ matrix.name }} 46 | run: ${{ matrix.runs.test }} 47 | - name: '"docker images"' 48 | run: ${{ matrix.runs.images }} 49 | -------------------------------------------------------------------------------- /.github/workflows/diff.yml: -------------------------------------------------------------------------------- 1 | name: Upstream Diff 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | 15 | generate: 16 | name: Generate Matrix 17 | runs-on: ubuntu-latest 18 | outputs: 19 | versions: ${{ steps.generate.outputs.versions }} 20 | steps: 21 | - uses: actions/checkout@v3 22 | - id: generate 23 | name: Generate Matrix 24 | run: | 25 | versions=( */ ) 26 | versions=( "${versions[@]%/}" ) 27 | IFS=$'\n' 28 | versionsJson="$(IFS=$'\n'; jq <<<"${versions[*]}" -csR 'rtrimstr("\n") | split("\n")')" 29 | echo "::set-output name=versions::$versionsJson" 30 | 31 | diff: 32 | needs: generate 33 | strategy: 34 | matrix: 35 | version: ${{ fromJson(needs.generate.outputs.versions) }} 36 | fail-fast: false 37 | name: ${{ matrix.version }} 38 | runs-on: ubuntu-latest 39 | env: 40 | version: ${{ matrix.version }} 41 | steps: 42 | - uses: actions/checkout@v3 43 | - name: Gather Data 44 | run: | 45 | upstreamImage="$(awk '$1 == "FROM" { print $2; exit }' "$version/Dockerfile")" 46 | [ -n "$upstreamImage" ] # sanity check 47 | echo "upstreamImage=$upstreamImage" >> "$GITHUB_ENV" 48 | buildImage="$GITHUB_REPOSITORY:$version" 49 | echo "buildImage=$buildImage" >> "$GITHUB_ENV" 50 | dockerBuild="$(gawk '$1 == "#" && $2 == "docker" && $3 == "build" { gsub(/^#[[:space:]]+/, ""); print }' "$version/Dockerfile")" 51 | [ -n "$dockerBuild" ] # sanity check 52 | dockerBuild+=" --pull --tag '$buildImage'" 53 | echo "dockerBuild=$dockerBuild" >> "$GITHUB_ENV" 54 | - name: Pull 55 | run: | 56 | docker pull "$upstreamImage" 57 | - name: Build 58 | run: | 59 | eval "$dockerBuild" 60 | - name: Diff 61 | run: | 62 | diff -u <(.github/workflows/history.sh "$upstreamImage") <(.github/workflows/history.sh "$buildImage") 63 | - name: Overall Size 64 | run: | 65 | docker image ls "${upstreamImage%%:*}" 66 | docker image ls "${buildImage%%:*}" 67 | - name: Full History 68 | run: | 69 | docker image history "$upstreamImage" 70 | docker image history "$buildImage" 71 | -------------------------------------------------------------------------------- /.github/workflows/history.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | # "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs 5 | 6 | docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \ 7 | | tac \ 8 | | sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \ 9 | | gawk ' 10 | # munge the checksum of the first ADD of the base image (base image changes unnecessarily break our diffs) 11 | $1 == "ADD" && $4 == "/" { $2 = "-" } 12 | 13 | # remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350) 14 | $1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") } 15 | 16 | # remove several buildkit-isms 17 | /# buildkit$/ { 18 | sub(/^RUN[[:space:]]+/, "") 19 | sub(/^\/bin\/sh[[:space:]]+-c[[:space:]]+/, "") 20 | sub(/[[:space:]]*# buildkit$/, "") 21 | } 22 | $1 == "EXPOSE" { gsub(/map\[|\/tcp:\{\}|\]/, "") } 23 | # buildkit makes COPY expressions hyper-simplified ("COPY --chown=1000:0 --from=foo /foo /bar" becomes just "COPY /foo /bar" vs "COPY --chown=1000:0 dir:xxxx in /bar") 24 | $1 == "COPY" { $0 = gensub(/^[[:space:]]*(COPY)[[:space:]]+([^[:space:]]+[[:space:]]+)+([^[:space:]]+)[[:space:]]*$/, "\\1 ... \\3", 1) } 25 | 26 | # in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash" 27 | /localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") } 28 | 29 | # sane and sanitized, print it! 30 | { print } 31 | ' 32 | -------------------------------------------------------------------------------- /7/Dockerfile: -------------------------------------------------------------------------------- 1 | # Logstash 7.17.15 2 | 3 | # This image re-bundles the Docker image from the upstream provider, Elastic. 4 | FROM docker.elastic.co/logstash/logstash:7.17.15@sha256:a7a5cb1ead281fc31404c70e413b1bc93a04ef33ca92a1de62a1528d7a10a7b4 5 | # Supported Bashbrew Architectures: amd64 arm64v8 6 | 7 | # The upstream image was built by: 8 | # https://github.com/elastic/dockerfiles/tree/v7.17.15/logstash 9 | 10 | # The build can be reproduced locally via: 11 | # docker build 'https://github.com/elastic/dockerfiles.git#v7.17.15:logstash' 12 | 13 | # For a full list of supported images and tags visit https://www.docker.elastic.co 14 | 15 | # For Logstash documentation visit https://www.elastic.co/guide/en/logstash/current/docker.html 16 | 17 | # See https://github.com/docker-library/official-images/pull/5039 for more details. 18 | -------------------------------------------------------------------------------- /8/Dockerfile: -------------------------------------------------------------------------------- 1 | # Logstash 8.11.2 2 | 3 | # This image re-bundles the Docker image from the upstream provider, Elastic. 4 | FROM docker.elastic.co/logstash/logstash:8.11.2@sha256:cf38efaeac4d5479862bbbb212bac8534823c61351596a8813fa27e77164e98e 5 | # Supported Bashbrew Architectures: amd64 arm64v8 6 | 7 | # The upstream image was built by: 8 | # https://github.com/elastic/dockerfiles/tree/v8.11.2/logstash 9 | 10 | # The build can be reproduced locally via: 11 | # docker build 'https://github.com/elastic/dockerfiles.git#v8.11.2:logstash' 12 | 13 | # For a full list of supported images and tags visit https://www.docker.elastic.co 14 | 15 | # For Logstash documentation visit https://www.elastic.co/guide/en/logstash/current/docker.html 16 | 17 | # See https://github.com/docker-library/official-images/pull/5039 for more details. 18 | -------------------------------------------------------------------------------- /Dockerfile.template: -------------------------------------------------------------------------------- 1 | # Logstash %%VERSION%% 2 | 3 | # This image re-bundles the Docker image from the upstream provider, Elastic. 4 | FROM %%UPSTREAM_IMAGE_DIGEST%% 5 | # Supported Bashbrew Architectures: %%UPSTREAM_IMAGE_ARCHITECTURES%% 6 | 7 | # The upstream image was built by: 8 | # %%UPSTREAM_DOCKERFILE_LINK%% 9 | 10 | # The build can be reproduced locally via: 11 | # docker build '%%UPSTREAM_DOCKER_BUILD%%' 12 | 13 | # For a full list of supported images and tags visit https://www.docker.elastic.co 14 | 15 | # For Logstash documentation visit https://www.elastic.co/guide/en/logstash/current/docker.html 16 | 17 | # See https://github.com/docker-library/official-images/pull/5039 for more details. 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | Copyright 2013 Docker, Inc. 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # https://github.com/elastic/logstash 2 | 3 | ## Maintained by: [the Elastic Team](https://github.com/elastic/logstash) 4 | 5 | This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`logstash`](https://hub.docker.com/_/logstash/) (not to be confused with any official `logstash` image provided by `logstash` upstream). See [the Docker Hub page](https://hub.docker.com/_/logstash/) for the full readme on how to use this Docker image and for information regarding contributing and issues. 6 | 7 | The [full image description on Docker Hub](https://hub.docker.com/_/logstash/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `logstash` directory](https://github.com/docker-library/docs/tree/master/logstash). 8 | 9 | ## See a change merged here that doesn't show up on Docker Hub yet? 10 | 11 | For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what). 12 | 13 | For outstanding `logstash` image PRs, check [PRs with the "library/logstash" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Flogstash). For the current "source of truth" for [`logstash`](https://hub.docker.com/_/logstash/), see [the `library/logstash` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/logstash). 14 | 15 | --- 16 | 17 | - [![build status badge](https://img.shields.io/github/actions/workflow/status/docker-library/logstash/ci.yml?branch=master&label=GitHub%20CI)](https://github.com/docker-library/logstash/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) 18 | - [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/logstash.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/logstash/) 19 | 20 | | Build | Status | Badges | (per-arch) | 21 | |:-:|:-:|:-:|:-:| 22 | | [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/logstash.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/logstash/) | [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/logstash.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/logstash/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/logstash.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/logstash/) | 23 | 24 | 25 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | self="$(basename "$BASH_SOURCE")" 5 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 6 | 7 | versions=( */ ) 8 | versions=( "${versions[@]%/}" ) 9 | 10 | # sort version numbers with highest first 11 | IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -rV) ); unset IFS 12 | 13 | # get the most recent commit which modified any of "$@" 14 | fileCommit() { 15 | git log -1 --format='format:%H' HEAD -- "$@" 16 | } 17 | 18 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 19 | dirCommit() { 20 | local dir="$1"; shift 21 | ( 22 | cd "$dir" 23 | fileCommit \ 24 | Dockerfile \ 25 | $(git show HEAD:./Dockerfile | awk ' 26 | toupper($1) == "COPY" { 27 | for (i = 2; i < NF; i++) { 28 | print $i 29 | } 30 | } 31 | ') 32 | ) 33 | } 34 | 35 | cat <<-EOH 36 | # this file is generated via https://github.com/docker-library/logstash/blob/$(fileCommit "$self")/$self 37 | 38 | Maintainers: Tianon Gravi (@tianon), 39 | Joseph Ferguson (@yosifkit) 40 | GitRepo: https://github.com/docker-library/logstash.git 41 | EOH 42 | 43 | # prints "$2$1$3$1...$N" 44 | join() { 45 | local sep="$1"; shift 46 | local out; printf -v out "${sep//%/%%}%s" "$@" 47 | echo "${out#$sep}" 48 | } 49 | 50 | for version in "${versions[@]}"; do 51 | commit="$(dirCommit "$version")" 52 | 53 | fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "FROM" && $2 ~ /^docker.elastic.co/ { gsub(/^[^:]+:|@.+$/, "", $2); print $2; exit }')" 54 | 55 | versionAliases=( $fullVersion ) 56 | # TODO decide whether to support X.Y aliases as well 57 | 58 | versionArches="$(git show "$commit":"$version/Dockerfile" | awk -F ': ' '$1 == "# Supported Bashbrew Architectures" { print $2; exit }')" 59 | 60 | echo 61 | cat <<-EOE 62 | Tags: $(join ', ' "${versionAliases[@]}") 63 | Architectures: $(join ', ' $versionArches) 64 | GitCommit: $commit 65 | Directory: $version 66 | EOE 67 | done 68 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | versions=( "$@" ) 7 | if [ ${#versions[@]} -eq 0 ]; then 8 | versions=( */ ) 9 | fi 10 | versions=( "${versions[@]%/}" ) 11 | 12 | upstreamProduct='logstash' 13 | 14 | upstreamDockerfileRepo='https://github.com/elastic/dockerfiles' 15 | 16 | tags="$( 17 | git ls-remote --tags "$upstreamDockerfileRepo.git" \ 18 | | cut -d/ -f3 \ 19 | | grep -E '^v' \ 20 | | cut -d^ -f1 \ 21 | | sort -uV 22 | )" 23 | 24 | for version in "${versions[@]}"; do 25 | rcVersion="${version%-rc}" 26 | rcGrepV='-v' 27 | if [ "$version" != "$rcVersion" ]; then 28 | rcGrepV= 29 | fi 30 | 31 | fullVersion="$( 32 | grep -P "^\Qv$rcVersion." <<<"$tags" \ 33 | | grep $rcGrepV -E -- '-(alpha|beta|rc)' \ 34 | | tail -1 35 | )" 36 | if [ -z "$fullVersion" ]; then 37 | echo >&2 "warning: cannot find full version for $version" 38 | continue 39 | fi 40 | fullVersion="${fullVersion#v}" 41 | 42 | echo "$version: $fullVersion" 43 | 44 | upstreamImageRepo="$upstreamProduct/$upstreamProduct" 45 | upstreamImage="docker.elastic.co/$upstreamImageRepo:$fullVersion" 46 | 47 | # Parse image manifest for sha 48 | authToken="$(curl -fsSL "https://docker-auth.elastic.co/auth?service=token-service&scope=repository:$upstreamImageRepo:pull" | jq -r .token)" 49 | manifestList="$( 50 | curl -D- -fsSL \ 51 | -H 'Accept: application/vnd.docker.distribution.manifest.list.v2+json' \ 52 | -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \ 53 | -H "Authorization: Bearer $authToken" \ 54 | "https://docker.elastic.co/v2/$upstreamImageRepo/manifests/$fullVersion" \ 55 | | tr -d '\r' 56 | )" 57 | digest="$(gawk -F ':[[:space:]]+' 'tolower($1) == "docker-content-digest" { print $2; exit }' <<<"$manifestList")" 58 | manifestList="$(gawk '/^$/ { pre = 1; next } pre { print }' <<<"$manifestList")" 59 | 60 | # Format image reference (image@sha) 61 | upstreamImageDigest="$upstreamImage@$digest" 62 | 63 | schemaVersion="$(jq -r '.schemaVersion' <<<"$manifestList")" 64 | [ "$schemaVersion" = 2 ] # sanity check 65 | mediaType="$(jq -r '.mediaType' <<<"$manifestList")" 66 | case "$mediaType" in 67 | 'application/vnd.docker.distribution.manifest.v2+json') 68 | upstreamImageArchitectures='amd64' 69 | ;; 70 | 71 | 'application/vnd.docker.distribution.manifest.list.v2+json') 72 | upstreamImageArchitectures="$( 73 | jq -r ' 74 | .manifests[].platform 75 | | if .os != "linux" then 76 | .os + "-" 77 | else "" end 78 | + if .architecture == "arm" then 79 | "arm32" 80 | elif .architecture == "386" then 81 | "i386" 82 | else .architecture end 83 | + if .variant then 84 | .variant 85 | elif .architecture == "arm64" then 86 | "v8" 87 | else "" end 88 | ' <<<"$manifestList" \ 89 | | sort -u \ 90 | | xargs 91 | )" 92 | ;; 93 | 94 | *) 95 | echo >&2 "error: unknown media type on '$upstreamImageDigest': '$mediaType'" 96 | exit 1 97 | ;; 98 | esac 99 | 100 | upstreamDockerfileTag="v$fullVersion" 101 | upstreamDockerfileLink="https://github.com/elastic/dockerfiles/tree/$upstreamDockerfileTag/$upstreamProduct" 102 | upstreamDockerfile="${upstreamDockerfileLink//tree/raw}/Dockerfile" 103 | 104 | ( 105 | set -x 106 | curl -fsSL -o /dev/null "$upstreamDockerfileLink" # make sure the upstream Dockerfile link exists 107 | curl -fsSL "$upstreamDockerfile" | grep -P "\Q$fullVersion" # ... and that it contains the right version 108 | ) 109 | 110 | upstreamDockerBuild="$upstreamDockerfileRepo.git#$upstreamDockerfileTag:$upstreamProduct" 111 | 112 | sed -e 's!%%VERSION%%!'"$fullVersion"'!g' \ 113 | -e 's!%%UPSTREAM_IMAGE_DIGEST%%!'"$upstreamImageDigest"'!g' \ 114 | -e 's!%%UPSTREAM_IMAGE_ARCHITECTURES%%!'"$upstreamImageArchitectures"'!g' \ 115 | -e 's!%%UPSTREAM_DOCKERFILE_LINK%%!'"$upstreamDockerfileLink"'!g' \ 116 | -e 's!%%UPSTREAM_DOCKER_BUILD%%!'"$upstreamDockerBuild"'!g' \ 117 | Dockerfile.template > "$version/Dockerfile" 118 | done 119 | --------------------------------------------------------------------------------