Skip to content

Commit

Permalink
added distribution upload
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed May 16, 2024
1 parent 9252aab commit 2d43046
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions .buildkite/filebeat/scripts/packaging/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,39 @@ VERSION="$(make get-version)"
SOURCE_TAG+="${VERSION}${IMG_POSTFIX}"
BEAT_NAME="filebeat"
TARGET="observability-ci/${BEAT_NAME}"
# Remove following once beats fully migrated
BK_IMG_POSTFIX="-BK-SNAPSHOT"
BK_SOURCE_TAG+="${VERSION}${BK_IMG_POSTFIX}"

echo "--- Creating package"
mage -d filebeat package

echo "--- Distribution list"
ls -la filebeat/build/distributions
dir="filebeat/build/distributions"
buildkite-agent artifact upload "$dir/*.tar.gz;$dir/*.tar.gz.sha512"

echo "--- Docker image list"
docker images

define_tags
check_is_arm

echo "--- Tag & Push"
for variant in "${VARIANTS[@]}"; do

source="beats/${BEAT_NAME}${variant}"

for tag in "${tags[@]}"; do
targetTag=$tag${is_arm}

sourceName="${DOCKER_REGISTRY}/${source}:${SOURCE_TAG}"
targetName="${DOCKER_REGISTRY}/${TARGET}:${targetTag}"
# Remove following lines once beats fully migrated
targetName="${targetName}-buildkite"

if docker image inspect "${sourceName}" &>/dev/null; then
echo "--- Tag & Push"
echo "Source name: $sourceName"
echo "Target name: $targetName"

# Remove following lines once beats fully migrated
bkSourceName="${DOCKER_REGISTRY}/${source}:${BK_SOURCE_TAG}"
docker tag "$sourceName" "$bkSourceName"
# Replace bkSourceName to sourceName once beats fully migrated
docker tag "${bkSourceName}" "${targetName}"
# docker push "${targetName}"
echo "Source name: $sourceName Target name: $targetName"
docker tag "$sourceName" "$targetName"
# docker push "$targetName"

else
echo "Docker image ${sourceName} does not exist"
fi
done
done
done

0 comments on commit 2d43046

Please sign in to comment.