Chakru 51863325a5
build: use versioning in gradle consistent with ci (#13259)
Enable use of gradle for all image builds for publishing, eliminating the per-image build action in docker-unified.yml that duplicated what was in gradle but used slightly different mechanisms to determine what is the tag. Enabled gradle build to consume tags provided by the workflow and produce tags same as earlier.

Use bake matrix builds to build slim/full versions of datahub-ingestion, datahub-actions.

Publish images and scan relies on gradle to get the list of images, via depot.

Image publish and scans run once a day on schedule or on manual triggers only.
Pending work: Separate the publish and scans into a separate workflow that runs on a schedule and could also run other tests.
2025-04-24 23:00:03 +05:30

60 lines
2.1 KiB
Groovy

plugins {
id 'java' // required for versioning
}
apply from: "../../gradle/versioning/versioning.gradle"
apply from: "../../gradle/docker/docker.gradle"
ext {
docker_registry = rootProject.ext.docker_registry == 'linkedin' ? 'acryldata' : docker_registry
docker_repo = 'datahub-ingestion'
docker_dir = 'datahub-ingestion'
docker_target = project.getProperties().getOrDefault("dockerTarget", "slim")
docker_version = "${versionTag}" // Variants will add suffix to this tag
python_docker_version = project.getProperties().getOrDefault("pythonDockerVersion", "1!0.0.0+docker.${version}")
revision = 12 // increment to trigger rebuild
}
dependencies {
project(':metadata-ingestion')
}
docker {
dependsOn 'build', ':metadata-ingestion:codegen'
name "${docker_registry}/${docker_repo}:${docker_version}"
dockerfile file("${rootProject.projectDir}/docker/${docker_dir}/Dockerfile")
files fileTree(rootProject.projectDir) {
include '.dockerignore'
include "docker/${docker_dir}/*"
include "docker/snippets/*"
include "metadata-ingestion/**"
include "metadata-ingestion-modules/**"
include "python-build/**"
}.exclude {
i -> (!i.file.name.endsWith(".dockerignore") && i.file.isHidden())
}
version "${docker_version}"
defaultVariant = "slim"
variants = [
"slim": [suffix: "", args: [RELEASE_VERSION: python_docker_version, APP_ENV: "slim"]],
"full": [suffix: "full", args: [RELEASE_VERSION: python_docker_version, APP_ENV: "full"]]
]
// This task is intended to build the slim image
//target 'ingestion-base-slim' //Review if this needs to be handled by bake
def dockerBuildArgs = [RELEASE_VERSION: python_docker_version]
// Add build args if they are defined (needed for some CI or enterprise environments)
if (project.hasProperty('pipMirrorUrl')) {
dockerBuildArgs.PIP_MIRROR_URL = project.getProperty('pipMirrorUrl')
}
if (project.hasProperty('debianAptRepositoryUrl')) {
dockerBuildArgs.DEBIAN_REPO_URL = project.getProperty('debianAptRepositoryUrl')
}
buildArgs(dockerBuildArgs)
}