Gradle tasks and dependency configurations
This section details the Gradle tasks available for building, testing, and deploying your ALFA project, as well as the dependency configurations used to manage external libraries. Understanding these tasks and configurations is crucial for efficiently managing your ALFA project's lifecycle.
Tasks
You can execute the following Gradle tasks from your IDE, the command line, or a build automation tool like Jenkins or Azure DevOps.
| Task | Description |
|---|---|
buildAdsDockerImage | Builds a Docker image tagged <project-name>:latest in your local Docker registry utilizing ADS 1. Read the Build a Docker image section below for details. |
buildAuthzDomain | Compiles the authorization domain into a single YAML file (build/alfa/ads/domain.yaml) suitable for uploading to ADM or providing to ADS. |
compileAlfa | Compiles all ALFA policies to XACML and writes the output to build/alfa/domain/xacmlSpecifications. |
compileAlfaToPackage | Compiles all ALFA policies to XACML and bundles them into a policy package (build/alfa/domain/package/policy_package.zip), which you can upload to Axiomatics Services Manager (ASM). |
dockerPrepare | Prepares the Docker build context in build/docker utilizing ADS 2. |
installDeploymentDist | Prepares the ADS 2 deployment within the build/install/deployment directory. This deployment package includes the ADS binaries, domain.yaml, deployment.yaml, the software license, and custom attribute connectors. This directory serves as the build context root directory for creating a container image using tools such as Docker, Buildah, Podman, Kaniko, or Buildkit. |
runAds | Runs ADS 2 locally using the authorization domain from src/ and the deployment descriptor from deployment.yaml. NOTE: You need a valid software license in license/ to run ADS.Press Ctrl+C to stop the service.IMPORTANT: Structure the deployment.yaml file according to the DomainOpens in a new tab section of the latest Access Decision Service documentation. |
runAdsV1 | Runs ADS 1 locally using the authorization domain from src/ and the deployment descriptor from deployment.yaml. NOTE: You need a valid software license in license/ to run ADS.Press Ctrl+C to stop the service.IMPORTANT: Structure the deployment.yaml file according to the Basic configuration > Domain section of the Access Decision Service 1.x documentation. |
test | Runs all unit, integration, and system tests and generates test reports in build/reports/tests/. The reports indicate which tests passed or failed and provide output and stack traces. |
Build a Docker image with ADS 1
The project name is defined in your settings.gradle file:
rootProject.name = 'my-alfa-project'
To push the image to a remote repository, tag it accordingly and then push it:
docker tag my-alfa-project:latest myRemoteRegistry.com/my-alfa-project:1.0
docker push myRemoteRegistry.com/my-alfa-project:1.0
The com.palantir.gradle.docker plugin builds the image using the Dockerfile in the project root, which you can customize as needed.
By default, the image includes everything required to run Access Decision Service (ADS): runtime dependencies, attribute connectors, custom code (src/main), license, deployment, and domain configuration.
Place any additional files in src/extra to include them in the image's current directory.
To prevent ADS from using the domain and policy from the Git repository/pipeline, customize the Dockerfile and use an environment variable to configure ADS to retrieve an external domain (for example, through Authorization Domain Manager [ADM]).
Build a Docker image with ADS 2
Axiomatics Policy DevOps (APD) does not include a task for building a container image with ADS 2 binaries. Instead, use the installDeploymentDist task to prepare the build context in the build/install/deployment directory. Once prepared, call your preferred image build tool to create the image. The Dockerfile will be automatically copied into this build context directory.
Dependency configurations
Gradle's dependency configurations manage the classpath for different tasks. The following configurations help manage dependencies for your ALFA project:
| Configuration | Description |
|---|---|
pip | Add any extra attribute connector dependencies. This configuration already includes Axiomatics' Table, SQL, LDAP, HTTP, and Parser attribute connectors. |
testImplementation | Add any additional dependencies required for executing tests. |
adsCompile | Add any extra dependencies needed for compilation. |
policy | Include any external ALFA policies. |
To add a dependency, use the following syntax in your build.gradle file:
dependencies {
pip '<group>:<name>:<version>'
}