Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OCI labels, also reformatted files. #55

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
indent_style = space
52 changes: 26 additions & 26 deletions bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,60 @@
#------------------------------------ test -----------------------------------

group "test" {
targets=["enterprise_debian11_amd64", "enterprise_debian11_arm64", "federal_debian11_amd64", "community_debian11_amd64", "community_debian11_arm64"]
targets=["enterprise_debian11_amd64", "enterprise_debian11_arm64", "federal_debian11_amd64", "community_debian11_amd64", "community_debian11_arm64"]
}

target "enterprise_debian11_amd64" {
tags=["aerospike/aerospike-server-enterprise-amd64:6.3.0.12", "aerospike/aerospike-server-enterprise-amd64:latest"]
platforms=["linux/amd64"]
context="./enterprise/debian11"
tags=["aerospike/aerospike-server-enterprise-amd64:6.3.0.12", "aerospike/aerospike-server-enterprise-amd64:latest"]
platforms=["linux/amd64"]
context="./enterprise/debian11"
}

target "enterprise_debian11_arm64" {
tags=["aerospike/aerospike-server-enterprise-arm64:6.3.0.12", "aerospike/aerospike-server-enterprise-arm64:latest"]
platforms=["linux/arm64"]
context="./enterprise/debian11"
tags=["aerospike/aerospike-server-enterprise-arm64:6.3.0.12", "aerospike/aerospike-server-enterprise-arm64:latest"]
platforms=["linux/arm64"]
context="./enterprise/debian11"
}

target "federal_debian11_amd64" {
tags=["aerospike/aerospike-server-federal-amd64:6.3.0.12", "aerospike/aerospike-server-federal-amd64:latest"]
platforms=["linux/amd64"]
context="./federal/debian11"
tags=["aerospike/aerospike-server-federal-amd64:6.3.0.12", "aerospike/aerospike-server-federal-amd64:latest"]
platforms=["linux/amd64"]
context="./federal/debian11"
}

target "community_debian11_amd64" {
tags=["aerospike/aerospike-server-community-amd64:6.3.0.12", "aerospike/aerospike-server-community-amd64:latest"]
platforms=["linux/amd64"]
context="./community/debian11"
tags=["aerospike/aerospike-server-community-amd64:6.3.0.12", "aerospike/aerospike-server-community-amd64:latest"]
platforms=["linux/amd64"]
context="./community/debian11"
}

target "community_debian11_arm64" {
tags=["aerospike/aerospike-server-community-arm64:6.3.0.12", "aerospike/aerospike-server-community-arm64:latest"]
platforms=["linux/arm64"]
context="./community/debian11"
tags=["aerospike/aerospike-server-community-arm64:6.3.0.12", "aerospike/aerospike-server-community-arm64:latest"]
platforms=["linux/arm64"]
context="./community/debian11"
}

#------------------------------------ push -----------------------------------

group "push" {
targets=["enterprise_debian11", "federal_debian11", "community_debian11"]
targets=["enterprise_debian11", "federal_debian11", "community_debian11"]
}

target "enterprise_debian11" {
tags=["aerospike/aerospike-server-enterprise:6.3.0.12", "aerospike/aerospike-server-enterprise:6.3.0.12_1"]
platforms=["linux/amd64,linux/arm64"]
context="./enterprise/debian11"
tags=["aerospike/aerospike-server-enterprise:6.3.0.12", "aerospike/aerospike-server-enterprise:6.3.0.12_1"]
platforms=["linux/amd64,linux/arm64"]
context="./enterprise/debian11"
}

target "federal_debian11" {
tags=["aerospike/aerospike-server-federal:6.3.0.12", "aerospike/aerospike-server-federal:6.3.0.12_1"]
platforms=["linux/amd64"]
context="./federal/debian11"
tags=["aerospike/aerospike-server-federal:6.3.0.12", "aerospike/aerospike-server-federal:6.3.0.12_1"]
platforms=["linux/amd64"]
context="./federal/debian11"
}

target "community_debian11" {
tags=["aerospike/aerospike-server:6.3.0.12", "aerospike/aerospike-server:6.3.0.12_1"]
platforms=["linux/amd64,linux/arm64"]
context="./community/debian11"
tags=["aerospike/aerospike-server:6.3.0.12", "aerospike/aerospike-server:6.3.0.12_1"]
platforms=["linux/amd64,linux/arm64"]
context="./community/debian11"
}

193 changes: 101 additions & 92 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source lib/support.sh
source lib/verbose_call.sh

function usage() {
cat <<EOF
cat <<EOF
Usage: $0 -h -d <linux distro> -e <server edition>

-h display this help.
Expand All @@ -28,100 +28,109 @@ EOF
}

function parse_args() {
g_linux_distro=
g_server_edition=
g_test_build='false'
g_push_build='false'

while getopts "hd:e:tp" opt; do
case "${opt}" in
h)
usage
exit 0
;;
d)
g_linux_distro="${OPTARG}"
;;
e)
g_server_edition="${OPTARG}"
;;
t)
g_test_build='true'
;;
p)
g_push_build='true'
;;
*)
log_warn "** Invalid argument **"
usage
exit 1
;;
esac
done

shift $((OPTIND - 1))

log_info "g_linux_distro: '${g_linux_distro}'"
log_info "g_server_edition: '${g_server_edition}'"
log_info "g_test_build: '${g_test_build}'"
log_info "g_push_build: '${g_push_build}'"

if [ "${g_test_build}" = "false" ] && [ "${g_push_build}" = "false" ]; then
log_warn "Must provide either '-t' or '-p' option"
exit 1
fi

if [ "${g_test_build}" = "true" ] && [ "${g_push_build}" = "true" ]; then
log_warn "Must provide either '-t' or '-p' option, not both"
exit 1
fi
g_linux_distro=
g_server_edition=
g_test_build='false'
g_push_build='false'

while getopts "hd:e:tp" opt; do
case "${opt}" in
h)
usage
exit 0
;;
d)
g_linux_distro="${OPTARG}"
;;
e)
g_server_edition="${OPTARG}"
;;
t)
g_test_build='true'
;;
p)
g_push_build='true'
;;
*)
log_warn "** Invalid argument **"
usage
exit 1
;;
esac
done

shift $((OPTIND - 1))

log_info "g_linux_distro: '${g_linux_distro}'"
log_info "g_server_edition: '${g_server_edition}'"
log_info "g_test_build: '${g_test_build}'"
log_info "g_push_build: '${g_push_build}'"

if [ "${g_test_build}" = "false" ] && [ "${g_push_build}" = "false" ]; then
log_warn "Must provide either '-t' or '-p' option"
exit 1
fi

if [ "${g_test_build}" = "true" ] && [ "${g_push_build}" = "true" ]; then
log_warn "Must provide either '-t' or '-p' option, not both"
exit 1
fi
}

function main() {
parse_args "$@"

local bake_file="bake.hcl"
local distro_in=${g_linux_distro}
local targets=
local params=

if [ -z "${g_server_edition}" ]; then
if [ "${g_test_build}" = "true" ]; then
targets="test"
elif [ "${g_push_build}" = "true" ]; then
targets="push"
fi
else
local distribution_list=("${distro_in}")

if [ -z "${distro_in}" ]; then
tmp_list=("$(find "${g_server_edition}"/* -maxdepth 0 -type d)")
distribution_list=("${tmp_list[@]/#"${g_server_edition}"\//}")
fi

for distribution in "${distribution_list[@]}"; do
local version
version="$(get_version_from_dockerfile "${distribution}" "${g_server_edition}")"
IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${version}" "${g_server_edition}")"

if [ "${g_test_build}" = "true" ]; then
for platform in "${platform_list[@]}"; do
short_platform=${platform#*/}
targets+="${g_server_edition}_${distribution}_${short_platform} "
done
elif [ "${g_push_build}" = "true" ]; then
targets+="${g_server_edition}_${distribution} "
fi
done
fi

if [ "${g_test_build}" = "true" ]; then
params="--load"
elif [ "${g_push_build}" = "true" ]; then
params="--push"
fi

verbose_call docker buildx bake --pull -f "${bake_file}" "${targets}" --progress plain "${params}"
parse_args "$@"

local distro_in=${g_linux_distro}
local targets=

if [ -z "${g_server_edition}" ]; then
if [ "${g_test_build}" = "true" ]; then
targets="test"
elif [ "${g_push_build}" = "true" ]; then
targets="push"
fi
else
local distribution_list=("${distro_in}")

if [ -z "${distro_in}" ]; then
tmp_list=("$(find "${g_server_edition}"/* -maxdepth 0 -type d)")
distribution_list=("${tmp_list[@]/#"${g_server_edition}"\//}")
fi

for distribution in "${distribution_list[@]}"; do
local version
version="$(get_version_from_dockerfile "${distribution}" "${g_server_edition}")"
IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${version}" "${g_server_edition}")"

if [ "${g_test_build}" = "true" ]; then
for platform in "${platform_list[@]}"; do
short_platform=${platform#*/}
targets+="${g_server_edition}_${distribution}_${short_platform} "
done
elif [ "${g_push_build}" = "true" ]; then
targets+="${g_server_edition}_${distribution} "
fi
done
fi

local params=

if [ "${g_test_build}" = "true" ]; then
params="--load"
elif [ "${g_push_build}" = "true" ]; then
params="--push"
kportertx marked this conversation as resolved.
Show resolved Hide resolved
fi

local bake_file="bake.hcl"
local revision=
revision="$(git rev-parse HEAD)"
local created=
created="$(date --rfc-3339=seconds)"

verbose_call docker buildx bake --pull --progress plain ${params} \
--set "\*.labels.org.opencontainers.image.revision=\"${revision}\"" \
--set "\*.labels.org.opencontainers.image.created=\"${created}\"" \
--file "${bake_file}" "${targets}"
}

main "$@"
9 changes: 9 additions & 0 deletions community/debian11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

FROM debian:bullseye-slim

LABEL org.opencontainers.image.title="Aerospike Community Server" \
org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \
org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \
org.opencontainers.image.base.name="docker.io/library/debian:bullseye-slim" \
org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \
org.opencontainers.image.vendor="Aerospike" \
org.opencontainers.image.version="6.3.0.12" \
org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker"

# AEROSPIKE_EDITION - required - must be "community", "enterprise", or
# "federal".
# By selecting "community" you agree to the "COMMUNITY_LICENSE".
Expand Down
9 changes: 9 additions & 0 deletions enterprise/debian11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

FROM debian:bullseye-slim

LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \
org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \
org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \
org.opencontainers.image.base.name="docker.io/library/debian:bullseye-slim" \
org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \
org.opencontainers.image.vendor="Aerospike" \
org.opencontainers.image.version="6.3.0.12" \
org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker"

# AEROSPIKE_EDITION - required - must be "community", "enterprise", or
# "federal".
# By selecting "community" you agree to the "COMMUNITY_LICENSE".
Expand Down
9 changes: 9 additions & 0 deletions federal/debian11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

FROM debian:bullseye-slim

LABEL org.opencontainers.image.title="Aerospike Federal Server" \
org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \
org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \
org.opencontainers.image.base.name="docker.io/library/debian:bullseye-slim" \
org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \
org.opencontainers.image.vendor="Aerospike" \
org.opencontainers.image.version="6.3.0.12" \
org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker"

# AEROSPIKE_EDITION - required - must be "community", "enterprise", or
# "federal".
# By selecting "community" you agree to the "COMMUNITY_LICENSE".
Expand Down
8 changes: 4 additions & 4 deletions lib/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -Eeuo pipefail

function fetch() {
local tag=$1
local link=$2
local tag=$1
local link=$2

log_debug "${tag} - ${link}"
curl -fsSL "${link}" "${@:3}"
log_debug "${tag} - ${link}"
curl -fsSL "${link}" "${@:3}"
}
Loading
Loading