refactor: consolidate compatibility JSON generation into Python script
Some checks failed
Test Module Build / Nginx 1.22.1 (linux-armv7) (push) Failing after 12m0s
Test Module Build / Nginx 1.22.1 (linux-x86_64) (push) Failing after 9m49s
Test Module Build / Nginx 1.22.1 (linux-arm64) (push) Failing after 13m7s
Test Module Build / Nginx 1.24.0 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.24.0 (linux-armv7) (push) Failing after 11m56s
Test Module Build / Nginx 1.24.0 (linux-x86_64) (push) Failing after 9m46s
Test Module Build / Nginx 1.26.3 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.26.3 (linux-armv7) (push) Failing after 12m1s
Test Module Build / Nginx 1.26.3 (linux-x86_64) (push) Failing after 9m46s
Test Module Build / Nginx 1.28.0 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.28.0 (linux-armv7) (push) Failing after 12m0s
Test Module Build / Nginx 1.28.0 (linux-x86_64) (push) Failing after 9m45s
Test Module Build / Nginx 1.30.0 (linux-arm64) (push) Failing after 12m0s
Test Module Build / Nginx 1.30.0 (linux-armv7) (push) Failing after 12m1s
Test Module Build / Nginx 1.30.0 (linux-x86_64) (push) Failing after 9m45s
Test Module Build / Distro package compatibility (debian:12) (push) Failing after 6s
Test Module Build / Distro package compatibility (debian:13) (push) Failing after 8s
Test Module Build / Distro package compatibility (ubuntu:24.04) (push) Failing after 6s
Some checks failed
Test Module Build / Nginx 1.22.1 (linux-armv7) (push) Failing after 12m0s
Test Module Build / Nginx 1.22.1 (linux-x86_64) (push) Failing after 9m49s
Test Module Build / Nginx 1.22.1 (linux-arm64) (push) Failing after 13m7s
Test Module Build / Nginx 1.24.0 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.24.0 (linux-armv7) (push) Failing after 11m56s
Test Module Build / Nginx 1.24.0 (linux-x86_64) (push) Failing after 9m46s
Test Module Build / Nginx 1.26.3 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.26.3 (linux-armv7) (push) Failing after 12m1s
Test Module Build / Nginx 1.26.3 (linux-x86_64) (push) Failing after 9m46s
Test Module Build / Nginx 1.28.0 (linux-arm64) (push) Failing after 12m1s
Test Module Build / Nginx 1.28.0 (linux-armv7) (push) Failing after 12m0s
Test Module Build / Nginx 1.28.0 (linux-x86_64) (push) Failing after 9m45s
Test Module Build / Nginx 1.30.0 (linux-arm64) (push) Failing after 12m0s
Test Module Build / Nginx 1.30.0 (linux-armv7) (push) Failing after 12m1s
Test Module Build / Nginx 1.30.0 (linux-x86_64) (push) Failing after 9m45s
Test Module Build / Distro package compatibility (debian:12) (push) Failing after 6s
Test Module Build / Distro package compatibility (debian:13) (push) Failing after 8s
Test Module Build / Distro package compatibility (ubuntu:24.04) (push) Failing after 6s
This commit is contained in:
@@ -345,95 +345,118 @@ dsc_sha256="$(sha256sum "$dsc_path" | awk '{ print $1 }')"
|
|||||||
nginx_v_text="$metadata_dir/nginx-V.txt"
|
nginx_v_text="$metadata_dir/nginx-V.txt"
|
||||||
nginx -V > "$nginx_v_text" 2>&1
|
nginx -V > "$nginx_v_text" 2>&1
|
||||||
|
|
||||||
|
if [[ -n "$nginx_abi" ]]; then
|
||||||
|
deb_depends_json="$(
|
||||||
|
python3 -c 'import json, sys; print(json.dumps(sys.argv[1:]))' \
|
||||||
|
"$nginx_abi" \
|
||||||
|
"$nginx_binary_package (= $nginx_binary_version)" \
|
||||||
|
"libc6"
|
||||||
|
)"
|
||||||
|
else
|
||||||
|
deb_depends_json="$(
|
||||||
|
python3 -c 'import json, sys; print(json.dumps(sys.argv[1:]))' \
|
||||||
|
"$nginx_binary_package (= $nginx_binary_version)" \
|
||||||
|
"libc6"
|
||||||
|
)"
|
||||||
|
fi
|
||||||
|
|
||||||
compatibility_json="$metadata_dir/compatibility.json"
|
compatibility_json="$metadata_dir/compatibility.json"
|
||||||
jq -n \
|
COMPATIBILITY_JSON="$compatibility_json" \
|
||||||
--slurpfile nginxBuild "$nginx_build_info" \
|
NGINX_BUILD_INFO="$nginx_build_info" \
|
||||||
--arg schema "1" \
|
SCHEMA=1 \
|
||||||
--arg module "$MODULE_NAME" \
|
MODULE_NAME="$MODULE_NAME" \
|
||||||
--arg debPackage "$DEB_PACKAGE_NAME" \
|
DEB_PACKAGE_NAME="$DEB_PACKAGE_NAME" \
|
||||||
--arg debVersion "$deb_version" \
|
DEB_VERSION="$deb_version" \
|
||||||
--arg releaseTag "$NEXT_TAG" \
|
NEXT_TAG="$NEXT_TAG" \
|
||||||
--arg releaseVersion "$NEXT_VERSION" \
|
NEXT_VERSION="$NEXT_VERSION" \
|
||||||
--arg previousTag "$LATEST_TAG" \
|
LATEST_TAG="$LATEST_TAG" \
|
||||||
--arg gitRef "$GITHUB_REF" \
|
GITHUB_REF="$GITHUB_REF" \
|
||||||
--arg gitSha "$GITHUB_SHA" \
|
GITHUB_SHA="$GITHUB_SHA" \
|
||||||
--arg distroImage "$DISTRO_IMAGE" \
|
DISTRO_IMAGE="$DISTRO_IMAGE" \
|
||||||
--arg dockerPlatform "$DOCKER_PLATFORM" \
|
DOCKER_PLATFORM="$DOCKER_PLATFORM" \
|
||||||
--arg targetArch "$TARGET_ARCH" \
|
TARGET_ARCH="$TARGET_ARCH" \
|
||||||
--arg osId "$distro_id" \
|
OS_ID="$distro_id" \
|
||||||
--arg osVersion "$distro_version" \
|
OS_VERSION="$distro_version" \
|
||||||
--arg osCodename "$distro_codename" \
|
OS_CODENAME="$distro_codename" \
|
||||||
--arg debArch "$deb_arch" \
|
DEB_ARCH="$deb_arch" \
|
||||||
--arg nginxBinaryPackage "$nginx_binary_package" \
|
NGINX_BINARY_PACKAGE="$nginx_binary_package" \
|
||||||
--arg nginxBinaryVersion "$nginx_binary_version" \
|
NGINX_BINARY_VERSION="$nginx_binary_version" \
|
||||||
--arg nginxSourcePackage "$source_package" \
|
NGINX_SOURCE_PACKAGE="$source_package" \
|
||||||
--arg nginxSourceVersion "$source_version" \
|
NGINX_SOURCE_VERSION="$source_version" \
|
||||||
--arg nginxAbi "$nginx_abi" \
|
NGINX_ABI="$nginx_abi" \
|
||||||
--arg modulesPath "$modules_path" \
|
MODULES_PATH="$modules_path" \
|
||||||
--arg dscPath "$(basename "$dsc_path")" \
|
DSC_PATH="$(basename "$dsc_path")" \
|
||||||
--arg dscSha256 "$dsc_sha256" \
|
DSC_SHA256="$dsc_sha256" \
|
||||||
--arg moduleSha256 "$module_sha256" \
|
MODULE_SHA256="$module_sha256" \
|
||||||
--arg builtAt "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
BUILT_AT="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||||
--arg artifactBase "$artifact_base" \
|
ARTIFACT_BASE="$artifact_base" \
|
||||||
--arg debFile "$deb_file" \
|
DEB_FILE="$deb_file" \
|
||||||
--arg tarballFile "$tarball_file" \
|
TARBALL_FILE="$tarball_file" \
|
||||||
'{
|
DEB_DEPENDS_JSON="$deb_depends_json" \
|
||||||
schema: ($schema | tonumber),
|
python3 - <<'PY'
|
||||||
module: $module,
|
import json
|
||||||
release: {
|
import os
|
||||||
tag: $releaseTag,
|
|
||||||
version: $releaseVersion,
|
with open(os.environ["NGINX_BUILD_INFO"], "r", encoding="utf-8") as f:
|
||||||
previous_tag: $previousTag,
|
nginx_build = json.load(f)
|
||||||
git_ref: $gitRef,
|
|
||||||
git_sha: $gitSha
|
artifact_base = os.environ["ARTIFACT_BASE"]
|
||||||
},
|
data = {
|
||||||
target: {
|
"schema": int(os.environ["SCHEMA"]),
|
||||||
os_id: $osId,
|
"module": os.environ["MODULE_NAME"],
|
||||||
os_version: $osVersion,
|
"release": {
|
||||||
os_codename: $osCodename,
|
"tag": os.environ["NEXT_TAG"],
|
||||||
architecture: $debArch,
|
"version": os.environ["NEXT_VERSION"],
|
||||||
requested_target: $targetArch,
|
"previous_tag": os.environ["LATEST_TAG"],
|
||||||
docker_image: $distroImage,
|
"git_ref": os.environ["GITHUB_REF"],
|
||||||
docker_platform: $dockerPlatform
|
"git_sha": os.environ["GITHUB_SHA"],
|
||||||
},
|
},
|
||||||
nginx: {
|
"target": {
|
||||||
binary_package: $nginxBinaryPackage,
|
"os_id": os.environ["OS_ID"],
|
||||||
binary_version: $nginxBinaryVersion,
|
"os_version": os.environ["OS_VERSION"],
|
||||||
source_package: $nginxSourcePackage,
|
"os_codename": os.environ["OS_CODENAME"],
|
||||||
source_version: $nginxSourceVersion,
|
"architecture": os.environ["DEB_ARCH"],
|
||||||
abi: $nginxAbi,
|
"requested_target": os.environ["TARGET_ARCH"],
|
||||||
modules_path: $modulesPath,
|
"docker_image": os.environ["DISTRO_IMAGE"],
|
||||||
build: $nginxBuild[0]
|
"docker_platform": os.environ["DOCKER_PLATFORM"],
|
||||||
},
|
},
|
||||||
build: {
|
"nginx": {
|
||||||
method: "distro-source-package",
|
"binary_package": os.environ["NGINX_BINARY_PACKAGE"],
|
||||||
dsc_file: $dscPath,
|
"binary_version": os.environ["NGINX_BINARY_VERSION"],
|
||||||
dsc_sha256: $dscSha256,
|
"source_package": os.environ["NGINX_SOURCE_PACKAGE"],
|
||||||
module_sha256: $moduleSha256,
|
"source_version": os.environ["NGINX_SOURCE_VERSION"],
|
||||||
built_at: $builtAt
|
"abi": os.environ["NGINX_ABI"],
|
||||||
},
|
"modules_path": os.environ["MODULES_PATH"],
|
||||||
artifacts: {
|
"build": nginx_build,
|
||||||
base_name: $artifactBase,
|
},
|
||||||
deb_package: $debPackage,
|
"build": {
|
||||||
deb_version: $debVersion,
|
"method": "distro-source-package",
|
||||||
deb_file: $debFile,
|
"dsc_file": os.environ["DSC_PATH"],
|
||||||
tarball_file: $tarballFile,
|
"dsc_sha256": os.environ["DSC_SHA256"],
|
||||||
compatibility_file: ($artifactBase + ".compatibility.json")
|
"module_sha256": os.environ["MODULE_SHA256"],
|
||||||
},
|
"built_at": os.environ["BUILT_AT"],
|
||||||
packaging: {
|
},
|
||||||
deb_depends: (
|
"artifacts": {
|
||||||
if $nginxAbi == "" then
|
"base_name": artifact_base,
|
||||||
[($nginxBinaryPackage + " (= " + $nginxBinaryVersion + ")"), "libc6"]
|
"deb_package": os.environ["DEB_PACKAGE_NAME"],
|
||||||
else
|
"deb_version": os.environ["DEB_VERSION"],
|
||||||
[$nginxAbi, ($nginxBinaryPackage + " (= " + $nginxBinaryVersion + ")"), "libc6"]
|
"deb_file": os.environ["DEB_FILE"],
|
||||||
end
|
"tarball_file": os.environ["TARBALL_FILE"],
|
||||||
)
|
"compatibility_file": artifact_base + ".compatibility.json",
|
||||||
},
|
},
|
||||||
validation: {
|
"packaging": {
|
||||||
packaged_nginx_config_test: false,
|
"deb_depends": json.loads(os.environ["DEB_DEPENDS_JSON"]),
|
||||||
packaged_nginx_endpoint_smoke: false
|
},
|
||||||
}
|
"validation": {
|
||||||
}' > "$compatibility_json"
|
"packaged_nginx_config_test": False,
|
||||||
|
"packaged_nginx_endpoint_smoke": False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
with open(os.environ["COMPATIBILITY_JSON"], "w", encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, indent=2, sort_keys=True)
|
||||||
|
f.write("\n")
|
||||||
|
PY
|
||||||
|
|
||||||
cat > "$doc_dir/INSTALL.md" <<EOF
|
cat > "$doc_dir/INSTALL.md" <<EOF
|
||||||
# ${MODULE_NAME} for ${distro_id} ${distro_version} ${deb_arch}
|
# ${MODULE_NAME} for ${distro_id} ${distro_version} ${deb_arch}
|
||||||
@@ -501,15 +524,28 @@ dpkg-deb --build --root-owner-group "$package_root" "$deb_path"
|
|||||||
apt-get install -y --no-install-recommends "$deb_path"
|
apt-get install -y --no-install-recommends "$deb_path"
|
||||||
validate_module "${modules_path}/${MODULE_NAME}.so" "$build_root/runtime"
|
validate_module "${modules_path}/${MODULE_NAME}.so" "$build_root/runtime"
|
||||||
|
|
||||||
jq \
|
COMPATIBILITY_JSON="$compatibility_json" \
|
||||||
--arg debFile "$deb_file" \
|
DEB_FILE="$deb_file" \
|
||||||
--arg validationTime "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
VALIDATION_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||||
'.artifacts.deb_file = $debFile
|
python3 - <<'PY'
|
||||||
| .validation.packaged_nginx_config_test = true
|
import json
|
||||||
| .validation.packaged_nginx_endpoint_smoke = true
|
import os
|
||||||
| .validation.validated_at = $validationTime' \
|
|
||||||
"$compatibility_json" > "$compatibility_json.tmp"
|
path = os.environ["COMPATIBILITY_JSON"]
|
||||||
mv "$compatibility_json.tmp" "$compatibility_json"
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
data["artifacts"]["deb_file"] = os.environ["DEB_FILE"]
|
||||||
|
data["validation"]["packaged_nginx_config_test"] = True
|
||||||
|
data["validation"]["packaged_nginx_endpoint_smoke"] = True
|
||||||
|
data["validation"]["validated_at"] = os.environ["VALIDATION_TIME"]
|
||||||
|
|
||||||
|
tmp = path + ".tmp"
|
||||||
|
with open(tmp, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, indent=2, sort_keys=True)
|
||||||
|
f.write("\n")
|
||||||
|
os.replace(tmp, path)
|
||||||
|
PY
|
||||||
dpkg-deb --build --root-owner-group "$package_root" "$deb_path"
|
dpkg-deb --build --root-owner-group "$package_root" "$deb_path"
|
||||||
|
|
||||||
tar_root="$build_root/tar"
|
tar_root="$build_root/tar"
|
||||||
|
|||||||
Reference in New Issue
Block a user