gradle-oci

Gradle plugin to ease using and producing (multi-arch) OCI images without requiring external tools

APACHE-2.0 License

Stars
26
gradle-oci - 0.10.0 Latest Release

Published by SgtSilvio 5 months ago

🌟 Features

  • Enable reuse of OciCopySpec similar to org.gradle.api.file.CopySpec
    • Added OciExtension.copySpec() and OciExtension.copySpec(Action<in OciCopySpec>) factory methods
    • Added OciCopySpec.with(OciCopySpec)
  • New features for layer creation to OciLayerTask:
    • Enable configuration of digest algorithm via digestAlgorithm property of type OciDigestAlgorithm with options SHA_256 (default) and SHA_512
    • Enable configuration of layer compression via compression property of type OciLayerCompression with options NONE and GZIP (default)
    • Added mediaType provider of type String derived from compression
    • Added extension property of type String with convention derived from compression
    • Replaced digestFile with digest provider of type OciDigest
    • Replaced diffIdFile with diffId provider of type OciDigest
    • Added size provider of type Long
  • Enable access to the org.gradle.api.artifacts.Configuration that belongs to an image definition via OciImageDefinition.configuration
  • Enable use of providers for capabilities via OciImageDefinition.Capabilities.add(Provider<String>)

✨ Improvements

  • More robust detection of component and layer files in resolved OCI image dependencies
    • Allows different layer artifacts with the same digest
    • Allows different variants to reference the same layer artifact
  • (TODO wording of this release note will be still be finalized) normalization of platform variants (arm64 -> v8, arm -> v7) to support images produced with containerd normalization
  • (TODO wording of this release note will be still be finalized) copy spec does not produce parent folders if source/from is empty (OciCopySpec: do not create destination directory if sources are empty)
  • Simplified build output of layers
    • Removed one subfolder level: oci/images/$imageDefName/$layerName => oci/images/$imageDefName
    • Replaced .diffId and .digest files with a single .properties file
  • Renamed OciLayerTask.tarFile to file
  • Renamed OciComponentTask.componentFile to file
  • Renamed OciDigestAlgorithm.ociPrefix to id
  • Renamed OciDigestAlgorithm.algorithmName to standardName
  • (TODO wording of this release note will be still be finalized) deterministic transformation of index to component in case of duplicate platforms
  • (TODO wording of this release note will be still be finalized) improve naming of layers downloaded from a registry (classifier determined by digest, extension) (Include truncated layer digest into filename instead of a counter in OciRepositoryHandler)

🐞 Bug fixes

  • The default capability for image definitions with a name other than main is now added to the Gradle configuration and not only to the OCI component

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.9.0

Published by SgtSilvio 7 months ago

🌟 Features

  • Added ociImageDependencies extension
    • Can be used to declare dependencies for test tasks:
      ociImageDependencies.forTest(tasks.test) {
          runtime(...)
      }
      
      Replaces the old syntax:
      oci {
          imageDependencies.forTest(tasks.test) {
              add(...)
          }
      }
      
    • Can be used to declare dependencies for test suites:
      testing {
          suites {
              "test"(JvmTestSuite::class) {
                  ociImageDependencies {
                      runtime(...)
                  }
              }
          }
      }
      

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.8.0

Published by SgtSilvio 8 months ago

🌟 Features

  • Added support for multiple tags on an OCI image dependency
    • Existing APIs for a single tag:
      • .tag("tag1")
      • .tag(provider { "tag1" })
    • Additional APIs for multiple tags:
      • .tag("tag1", "tag2")
      • .tag(setOf("tag1", "tag2"))
      • .tag(provider { setOf("tag1", "tag2") })
    • All above APIs can be called in a chain multiple times, for example .tag("tag1").tag("tag2", "tag3")
    • "." is a placeholder for the default tag of the dependency, for example .tag(".", "latest") keeps the tag and additionally adds a latest tag (previously this was only possible by declaring the dependency twice, once without any call to tag and secondly with .tag("latest"))
  • Added command line options registry, url, credentials for tasks of type OciPushTask:
    • --registry: Pushes to the registry defined with the specified name in oci.registries.
    • --url: Pushes to the specified registry URL.
    • --credentials: Authenticates to the registry using the credentials with the specified id.
  • Added push{imageDefinitionName}OciImage tasks of type OciPushSingleTask for every image definition (task name is pushOciImage for the main image definition) with command line options:
    • --name: Names the image. If not specified, the imageName defined in the image definition is used.
    • --tag: Tags the image. Option can be specified multiple times. The value . translates to the imageTag defined in the image definition. If not specified, the imageTag defined in the image definition is used.
  • Added OciRegistry.optionalCredentials()

✨ Improvements

  • Improved syntax for adding constraints to OciImagesDependencies (similar to Gradle's strongly-typed dependencies block)
    • constraint(DependencyConstraint) →
      add(DependencyConstraint)
    • constraint(CharSequence) →
      add(constraint(CharSequence))
    • constraint(Project) →
      add(constraint(Project))
    • constraint(Provider<MinimalExternalModuleDependency>) →
      add(constraint(Provider<MinimalExternalModuleDependency>))
    • constraint(ProviderConvertible<MinimalExternalModuleDependency>) →
      add(constraint(ProviderConvertible<MinimalExternalModuleDependency>))
    • New APIs:
      • add(DependencyConstraint)
      • add(DependencyConstraint, Action<in DependencyConstraint>)
      • add(Provider<out DependencyConstraint>)
      • add(Provider<out DependencyConstraint>, Action<in DependencyConstraint>)
      • Factories for dependency constraints:
        • constraint(CharSequence)
        • constraint(Project)
        • constraint(Provider<out MinimalExternalModuleDependency>)
        • constraint(ProviderConvertible<out MinimalExternalModuleDependency>)

🐞 Bug fixes

  • Fix possible layer corruption during download because of invalid retries after partial data has already been received
  • Fix compatibility with Configuration Cache (java.time.Instant could not be serialized)

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.8.0

Published by SgtSilvio 8 months ago

🌟 Features

  • Added support for multiple tags on an OCI image dependency
    • Existing APIs for a single tag:
      • .tag("tag1")
      • .tag(provider { "tag1" })
    • Additional APIs for multiple tags:
      • .tag("tag1", "tag2")
      • .tag(setOf("tag1", "tag2"))
      • .tag(provider { setOf("tag1", "tag2") })
    • All above APIs can be called in a chain multiple times, for example .tag("tag1").tag("tag2", "tag3")
    • "." is a placeholder for the default tag of the dependency, for example .tag(".", "latest") keeps the tag and additionally adds a latest tag (previously this was only possible by declaring the dependency twice, once without any call to tag and secondly with .tag("latest"))
  • Added command line options registry, url, credentials for tasks of type OciPushTask:
    • --registry: Pushes to the registry defined with the specified name in oci.registries.
    • --url: Pushes to the specified registry URL.
    • --credentials: Authenticates to the registry using the credentials with the specified id.
  • Added push{imageDefinitionName}OciImage tasks of type OciPushSingleTask for every image definition (task name is pushOciImage for the main image definition) with command line options:
    • --name: Names the image. If not specified, the imageName defined in the image definition is used.
    • --tag: Tags the image. Option can be specified multiple times. The value . translates to the imageTag defined in the image definition. If not specified, the imageTag defined in the image definition is used.
  • Added OciRegistry.optionalCredentials()

✨ Improvements

  • Improved syntax for adding constraints to OciImagesDependencies (similar to Gradle's strongly-typed dependencies block)
    • constraint(DependencyConstraint) →
      add(DependencyConstraint)
    • constraint(CharSequence) →
      add(constraint(CharSequence))
    • constraint(Project) →
      add(constraint(Project))
    • constraint(Provider<MinimalExternalModuleDependency>) →
      add(constraint(Provider<MinimalExternalModuleDependency>))
    • constraint(ProviderConvertible<MinimalExternalModuleDependency>) →
      add(constraint(ProviderConvertible<MinimalExternalModuleDependency>))
    • New APIs:
      • add(DependencyConstraint)
      • add(DependencyConstraint, Action<in DependencyConstraint>)
      • add(Provider<out DependencyConstraint>)
      • add(Provider<out DependencyConstraint>, Action<in DependencyConstraint>)
      • Factories for dependency constraints:
        • constraint(CharSequence)
        • constraint(Project)
        • constraint(Provider<out MinimalExternalModuleDependency>)
        • constraint(ProviderConvertible<out MinimalExternalModuleDependency>)

🐞 Bug fixes

  • Fix possible layer corruption during download because of invalid retries after partial data has already been received
  • Fix compatibility with Configuration Cache (java.time.Instant could not be serialized)

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.7.0

Published by SgtSilvio 9 months ago

✨ Improvements

  • OciRegistryDataTask only stores necessary layers (previously unnecessary layers could be stored when a parent image has more architectures then the final image)

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.6.0

Published by SgtSilvio 10 months ago

🌟 Features

  • Set classifier of artifacts (OciComponent and OciLayer) when publishing OCI image variants
  • Added classifier property to OciLayer and OciComponentTask
  • Added destinationDirectory property to OciComponentTask
  • Renamed outputDirectory property to destinationDirectory in OciLayerTask

✨ Improvements

  • Improved repository proxies for OCI registries
    • Better component and layer file names and urls
    • Use Ivy instead of Maven repository as proxy
  • Rename layer extension from tar.gz to tgz
  • Improve camel and kebab casing of names
gradle-oci - 0.5.0

Published by SgtSilvio 10 months ago

✨ Improvements

  • Improve repository proxies for OCI registries
gradle-oci - 0.4.0

Published by SgtSilvio 10 months ago

🌟 Features

  • Added OciRegistry.credentials() that automatically uses the registry name as the credentials identity
  • Allow mapping of OciRegistry.url by default
    • Via a Gradle property with the url as key
    • Example: https\://registry-1.docker.io=<my-docker-hub-mirror> in ~/.gradle.properties
    • Added OciRegistry.finalUrl that exposes the mapped url
  • Allow to specify digests as a version
    • Example: add("library:eclipse-temurin:sha256!56be7e97bc4d2fffafdda7e8198741fd96513bc12f05d6da9f18c2577a1d5649")
    • If the version is a digest, it will be automatically verified

✨ Improvements

  • Removed usage of afterEvaluate
  • Support - in digests (theoretically allowed to be used, although not currently)

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.3.0

Published by SgtSilvio 11 months ago

✨ Improvements

  • Compatibility with Gradle 8.5
  • Refactored oci.imageDependencies
    • Refactored image dependency tagging
      • Before vs now:
        add("library:eclipse-temurin:20.0.1_9-jre-jammy", tag("library:eclipse-temurin:20"))
        add("library:eclipse-temurin:20.0.1_9-jre-jammy").tag("20")
      • Before vs now:
        add("library:eclipse-temurin:20.0.1_9-jre-jammy", tag("eclipse-temurin:20"))
        add("library:eclipse-temurin:20.0.1_9-jre-jammy").name("eclipse-temurin").tag("20")
      • No internal API or additional tasks (OciTagComponentTask) required
    • Removed OciImageDependenciesContainer
      • Before vs now:
        oci.imageDependencies.register("images") { default("library:eclipse-temurin:20.0.1_9-jre-jammy") }
        oci.imageDependencies.register("images") { add("library:eclipse-temurin:20.0.1_9-jre-jammy") }
      • Before vs now:
        oci.imageDependencies.register("images") { scope("v2")("library:eclipse-temurin:20.0.1_9-jre-jammy") }
        oci.imageDependencies.register("imagesV2") { add("library:eclipse-temurin:20.0.1_9-jre-jammy") }
      • Before vs now:
        oci.imageDependencies.forTest(tasks.test) { default("library:eclipse-temurin:20.0.1_9-jre-jammy") }
        oci.imageDependencies.forTest(tasks.test) { add("library:eclipse-temurin:20.0.1_9-jre-jammy") }
      • Before vs now:
        oci.imageDependencies.forTest(tasks.test) { scope("v2")("library:eclipse-temurin:20.0.1_9-jre-jammy") }
        oci.imageDependencies.forTest(tasks.test, "v2") { add("library:eclipse-temurin:20.0.1_9-jre-jammy") }
  • Added OciPushTask.Registry
    • Moved OciPushTask.registryUrl to OciPushTask.registry.url
    • Moved OciPushTask.credentials to OciPushTask.registry.credentials
    • Added OciPushTask.registry { }
    • Added OciPushTask.registry.from(OciRegistry)

ℹī¸ Miscellaneous

  • Updated dependencies
gradle-oci - 0.2.0

Published by SgtSilvio 12 months ago

✨ Improvements

  • Update netty to incorporate the fix "Prevent classloader leak via JNI"
  • Split OciImageDefinition.imageReference into imageNameand imageTag
  • Compatibility with Gradle 8.4 (adapt to change of ProjectDependencyPublicationResolver.resolve internal api)

ℹī¸ Miscellaneous

  • Update dependencies
  • Rename build output directory oci/registry to oci/registries
gradle-oci - 0.1.0

Published by SgtSilvio about 1 year ago