summaryrefslogtreecommitdiffstats
path: root/fluent-bit/.github/actions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /fluent-bit/.github/actions
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/.github/actions')
-rw-r--r--fluent-bit/.github/actions/generate-package-build-matrix/action.yaml119
-rw-r--r--fluent-bit/.github/actions/sync-to-bucket/action.yaml88
2 files changed, 207 insertions, 0 deletions
diff --git a/fluent-bit/.github/actions/generate-package-build-matrix/action.yaml b/fluent-bit/.github/actions/generate-package-build-matrix/action.yaml
new file mode 100644
index 000000000..f8355e4bb
--- /dev/null
+++ b/fluent-bit/.github/actions/generate-package-build-matrix/action.yaml
@@ -0,0 +1,119 @@
+name: Composite action to generate the matrix of targets to build packages for.
+description: Remove any duplication of this information so we only have to update in one place.
+
+# Remember to add any new checks and target creation required.
+# For example, when 2.0 comes out we should detect it and add any target changes.
+
+inputs:
+ target:
+ description: Override to build a single target for debug/test only.
+ required: false
+ default: ""
+ ref:
+ description: The commit, tag or branch of Fluent Bit to checkout for building we then use to determine version for.
+ required: true
+outputs:
+ build-matrix:
+ description: The total build matrix we have created.
+ value: ${{ steps.set-matrix.outputs.matrix }}
+ deb-build-matrix:
+ description: The targets that provide DEB artefacts.
+ value: ${{ steps.set-matrix.outputs.debmatrix }}
+ rpm-build-matrix:
+ description: The targets that provide RPN artefacts.
+ value: ${{ steps.set-matrix.outputs.rpmmatrix }}
+runs:
+ using: "composite"
+ steps:
+ - name: Checkout code for version check
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ inputs.ref }}
+ path: version-check
+
+ - name: Determine target type
+ id: determine-build-type
+ run: |
+ BUILD_TYPE="legacy"
+ if [[ -f "packaging/build-config.json" ]]; then
+ BUILD_TYPE="modern"
+ fi
+ echo "Detected type: $BUILD_TYPE"
+ echo "BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_OUTPUT
+ shell: bash
+ working-directory: version-check
+
+ - name: 2.0+ targets
+ if: steps.determine-build-type.outputs.BUILD_TYPE == 'modern'
+ run: |
+ matrix=$(echo '{ "distro" : '$(jq -cr '.linux_targets|map(.target)' packaging/build-config.json)'}'|jq -c .)
+ echo "MATRIX=$matrix" >> $GITHUB_ENV
+
+ # The following are only used by release so exclude architecture as well
+
+ debtargets=$(jq -cr '[.linux_targets[] | select(.target|contains("arm64v8")|not) | select(.type=="deb") | .target ]' packaging/build-config.json)
+ debmatrix=$(echo "{ \"distro\" : $debtargets }"|jq -c .)
+ echo "DEB_MATRIX=$debmatrix" >> $GITHUB_ENV
+
+ rpmtargets=$(jq -cr '[.linux_targets[] | select(.target|contains("arm64v8")|not) | select(.type=="rpm") | .target ]' packaging/build-config.json)
+ rpmmatrix=$(echo "{ \"distro\" : $rpmtargets}"|jq -c .)
+ echo "RPM_MATRIX=$rpmmatrix" >> $GITHUB_ENV
+ shell: bash
+
+ - name: 1.9 targets
+ if: steps.determine-build-type.outputs.BUILD_TYPE == 'legacy'
+ run: |
+ matrix=$((
+ echo '{ "distro" : ['
+ echo '"amazonlinux/2", "amazonlinux/2.arm64v8",'
+ echo '"centos/7", "centos/7.arm64v8", "centos/8", "centos/8.arm64v8",'
+ echo '"debian/buster", "debian/buster.arm64v8", "debian/bullseye", "debian/bullseye.arm64v8",'
+ echo '"ubuntu/16.04", "ubuntu/18.04", "ubuntu/20.04", "ubuntu/22.04",'
+ echo '"ubuntu/18.04.arm64v8", "ubuntu/20.04.arm64v8", "ubuntu/22.04.arm64v8",'
+ echo '"raspbian/buster", "raspbian/bullseye"'
+ echo ']}'
+ ) | jq -c .)
+ echo "MATRIX=$matrix" >> $GITHUB_ENV
+ debmatrix=$((
+ echo '{ "distro" : ['
+ echo '"debian/buster", "debian/bullseye",'
+ echo '"ubuntu/16.04", "ubuntu/18.04", "ubuntu/20.04", "ubuntu/22.04",'
+ echo '"raspbian/buster", "raspbian/bullseye"'
+ echo ']}'
+ ) | jq -c .)
+ echo "DEB_MATRIX=$debmatrix" >> $GITHUB_ENV
+ rpmmatrix=$((
+ echo '{ "distro" : ['
+ echo '"amazonlinux/2",'
+ echo '"centos/7", "centos/8"'
+ echo ']}'
+ ) | jq -c .)
+ echo "RPM_MATRIX=$rpmmatrix" >> $GITHUB_ENV
+ shell: bash
+
+ - name: Manual override of target
+ if: inputs.target != ''
+ run: |
+ if [ -n "${{ inputs.target || '' }}" ]; then
+ echo "Overriding matrix to build: ${{ inputs.target }}"
+ matrix=$((
+ echo '{ "distro" : ['
+ echo '"${{ inputs.target }}"'
+ echo ']}'
+ ) | jq -c .)
+ fi
+ echo "MATRIX=$matrix" >> $GITHUB_ENV
+ shell: bash
+
+ - id: set-matrix
+ run: |
+ echo $MATRIX
+ echo $MATRIX| jq .
+ echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
+ echo $DEB_MATRIX
+ echo $DEB_MATRIX| jq .
+ echo "debmatrix=$DEB_MATRIX" >> $GITHUB_OUTPUT
+ echo $RPM_MATRIX
+ echo $RPM_MATRIX| jq .
+ echo "rpmmatrix=$RPM_MATRIX" >> $GITHUB_OUTPUT
+ shell: bash
diff --git a/fluent-bit/.github/actions/sync-to-bucket/action.yaml b/fluent-bit/.github/actions/sync-to-bucket/action.yaml
new file mode 100644
index 000000000..e79c0b3d6
--- /dev/null
+++ b/fluent-bit/.github/actions/sync-to-bucket/action.yaml
@@ -0,0 +1,88 @@
+name: Composite action to sync S3 buckets
+description: Carry out all the tasks to sync to a bucket and make reusable.
+
+inputs:
+ bucket:
+ description: The name of the S3 (US-East) bucket to sync packages from.
+ required: true
+ access_key_id:
+ description: The S3 access key id for the bucket.
+ required: true
+ secret_access_key:
+ description: The S3 secret access key for the bucket.
+ required: true
+ bucket-directory:
+ description: The directory in the bucket to sync to.
+ required: true
+ source-directory:
+ description: The source directory to sync from.
+ required: true
+ aws-region:
+ description: The default region to use.
+ required: false
+ default: "us-east-1"
+ aws-custom-endpoint:
+ # To use with Minio locally (or update to whatever endpoint you want)
+ # '--endpoint http://localhost:9000'
+ description: A custom endpoint for S3 commands, e.g. for Minio.
+ required: false
+
+runs:
+ using: "composite"
+ steps:
+ - name: Local - Check and sync
+ run: |
+ if [[ ! -d "$SOURCE_DIR" ]]; then
+ echo "No source directory: $SOURCE_DIR"
+ ls -lR
+ exit 1
+ fi
+ echo "Valid source directory: $SOURCE_DIR"
+ ls -lR "$SOURCE_DIR"
+ env:
+ SOURCE_DIR: ${{ inputs.source-directory }}
+ shell: bash
+
+ - name: AWS - Check and sync
+ run: |
+ # For Minio, etc.
+ if [ -n "${AWS_S3_ENDPOINT}" ]; then
+ ENDPOINT="--endpoint-url ${AWS_S3_ENDPOINT}"
+ fi
+
+ # Check for non-empty values
+ if [ -z "$AWS_S3_BUCKET" ]; then
+ echo "Invalid (empty) bucket defined, check running on right environment to allow access to any secrets"
+ exit 1
+ fi
+ echo "$AWS_S3_BUCKET bucket is defined"
+
+ # Verify bucket access
+ bucketstatus=$(aws --region "$AWS_REGION" s3api head-bucket --bucket "${AWS_S3_BUCKET}" ${ENDPOINT} 2>&1)
+ echo "Response: $bucketstatus"
+ if echo "${bucketstatus}" | grep 'Not Found'; then
+ echo "$AWS_S3_BUCKET: bucket does not exist";
+ exit 1
+ elif echo "${bucketstatus}" | grep 'Forbidden'; then
+ echo "$AWS_S3_BUCKET: bucket exists but not owned"
+ exit 1
+ elif echo "${bucketstatus}" | grep 'Bad Request'; then
+ echo "$AWS_S3_BUCKET: bucket name specified is less than 3 or greater than 63 characters"
+ exit 1
+ else
+ echo "$AWS_S3_BUCKET: bucket owned and exists";
+ fi
+
+ # Sync to bucket
+ aws --region "$AWS_REGION" s3 sync "${SOURCE_DIR}" "s3://${AWS_S3_BUCKET}/${DEST_DIR}" --follow-symlinks --no-progress ${ENDPOINT}
+ env:
+ SOURCE_DIR: ${{ inputs.source-directory }}
+ DEST_DIR: ${{ inputs.bucket-directory }}
+ # Make sure to run in an environment with access to any secrets that are passed in.
+ # Otherwise they will be empty.
+ AWS_S3_BUCKET: ${{ inputs.bucket }}
+ AWS_REGION: ${{ inputs.aws-region }}
+ AWS_ACCESS_KEY_ID: ${{ inputs.access_key_id }}
+ AWS_SECRET_ACCESS_KEY: ${{ inputs.secret_access_key }}
+ AWS_S3_ENDPOINT: ${{ inputs.aws-custom-endpoint }}
+ shell: bash