Package org.fhirfrog.frog.ant
Class FhirCacheTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.fhirfrog.frog.ant.FhirCacheTask
- All Implemented Interfaces:
Cloneable
public class FhirCacheTask
extends org.apache.tools.ant.Task
Ant task that saves and restores HAPI bootstrap artifacts (committed HAPI Docker image
and
pg_dump SQL file) to/from a container registry.
Both artifacts are bundled into a single OCI image stored in the registry under
registry/cacheImageName:cacheKey, where cacheKey is a 16-character
SHA-256 prefix of the concatenated bytes of all keyFiles. The packages.sql
dump is baked in as an extra layer (/packages.sql) so that a single pull/push
operation handles both artifacts.
Operations:
restore— pulls the cache image, extractspackages.sql, and tags the image withimageTag. Logs "cache miss" and exits cleanly if the image is not found in the registry (non-zerodocker pullexit code).save— layerspackages.sqlinto the localimageTagDocker image via an ephemeralDockerfile, then pushes the result to the registry. Skips silently if either artifact is absent (bootstrap did not complete).
When registry is blank the task is a no-op, enabling local development
without a registry.
Example
<fhircache operation="restore"
registry="ghcr.io/my-org"
cacheImageName="hapi-erequesting-bootstrap-cache"
imageTag="hapi-erequesting:0.2.0"
pgDumpFile=".fhir-frog/packages.sql"
keyFiles="../sushi-config.yaml,build.properties"/>
-
Field Summary
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()voidvoidsetImageTag(String imageTag) voidsetKeyFiles(String keyFiles) voidsetOperation(String operation) voidsetPgDumpFile(String pgDumpFile) voidsetRegistry(String registry) Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Constructor Details
-
FhirCacheTask
public FhirCacheTask()
-
-
Method Details
-
setOperation
-
setRegistry
-
setCacheImageName
-
setImageTag
-
setPgDumpFile
-
setKeyFiles
-
execute
public void execute() throws org.apache.tools.ant.BuildException- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-