|
| 1 | +#!/bin/bash |
| 2 | +set -xeuo pipefail |
| 3 | + |
| 4 | +# Initialize variables |
| 5 | +next_token="" |
| 6 | +all_tags=() |
| 7 | + |
| 8 | +# Get all amazonlinux container image tags |
| 9 | +while true; do |
| 10 | + if [ -z "$next_token" ]; then |
| 11 | + response=$(curl -sSL \ |
| 12 | + --header "Content-Type: application/json" \ |
| 13 | + --request POST \ |
| 14 | + --data '{"registryAliasName":"amazonlinux","repositoryName":"amazonlinux","maxResults":250}' \ |
| 15 | + https://api.us-east-1.gallery.ecr.aws/describeImageTags) |
| 16 | + else |
| 17 | + response=$(curl -sSL \ |
| 18 | + --header "Content-Type: application/json" \ |
| 19 | + --request POST \ |
| 20 | + --data "{\"registryAliasName\":\"amazonlinux\",\"repositoryName\":\"amazonlinux\",\"nextToken\":\"$next_token\",\"maxResults\":250}" \ |
| 21 | + https://api.us-east-1.gallery.ecr.aws/describeImageTags) |
| 22 | + fi |
| 23 | + |
| 24 | + # Extract tags and add them to the array |
| 25 | + tags=$(echo "$response" | jq -r '.imageTagDetails[].imageTag') |
| 26 | + all_tags+=($tags) |
| 27 | + |
| 28 | + # Check if there's a next token |
| 29 | + next_token=$(echo "$response" | jq -r '.nextToken') |
| 30 | + if [[ "$next_token" == "null" ]]; then |
| 31 | + break |
| 32 | + fi |
| 33 | +done |
| 34 | + |
| 35 | +# Find the most recent AL2 tag |
| 36 | +most_recent_al2=$(printf '%s\n' "${all_tags[@]}" | grep '^2\.' | grep -v minimal | grep -v arm | grep -v amd | sort -V | tail -n 1) |
| 37 | + |
| 38 | +# Read the JSON file |
| 39 | +json_file="linux.version" |
| 40 | +json_content=$(cat "$json_file") |
| 41 | + |
| 42 | +# Extract values using jq |
| 43 | +version=$(echo "$json_content" | jq -r '.linux.version') |
| 44 | +fluent_bit_version=$(echo "$json_content" | jq -r '.linux."fluent-bit"') |
| 45 | +cloudwatch_plugin_version=$(echo "$json_content" | jq -r '.linux."cloudwatch-plugin"') |
| 46 | +kinesis_plugin_version=$(echo "$json_content" | jq -r '.linux."kinesis-plugin"') |
| 47 | +firehose_plugin_version=$(echo "$json_content" | jq -r '.linux."firehose-plugin"') |
| 48 | + |
| 49 | +# Generate the changelog entry |
| 50 | +cat << EOF |
| 51 | +### $version |
| 52 | +This release includes: |
| 53 | +* Fluent Bit [$fluent_bit_version](https://github.com/fluent/fluent-bit/tree/v$fluent_bit_version) |
| 54 | +* Amazon CloudWatch Logs for Fluent Bit ${cloudwatch_plugin_version#v} |
| 55 | +* Amazon Kinesis Streams for Fluent Bit ${kinesis_plugin_version#v} |
| 56 | +* Amazon Kinesis Firehose for Fluent Bit ${firehose_plugin_version#v} |
| 57 | +* Amazon Linux base container image version: $most_recent_al2 |
| 58 | +
|
| 59 | +Compared to the previous release, this release adds: |
| 60 | +* Fix - TODO blah blah [#TODO](https://github.com/amazon-contributing/upstream-to-fluent-bit/pull/TODO) |
| 61 | +* Enhancement - TODO blah blah [#TODO](https://github.com/aws/aws-for-fluent-bit/pull/TODO) |
| 62 | +EOF |
0 commit comments