From 93ef45f8c298a919f466c32d33ece78a2973848c Mon Sep 17 00:00:00 2001 From: Public copy <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:47:57 +0000 Subject: [PATCH] automated commit Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com> --- images/glibc-dynamic/config/main.tf | 9 ++- images/wordpress/config/main.tf | 101 ---------------------------- images/wordpress/generated.tf | 2 +- images/wordpress/main.tf | 37 +++++----- images/wordpress/metadata.yaml | 1 + images/wordpress/tests/main.tf | 49 -------------- 6 files changed, 27 insertions(+), 172 deletions(-) delete mode 100644 images/wordpress/config/main.tf delete mode 100644 images/wordpress/tests/main.tf diff --git a/images/glibc-dynamic/config/main.tf b/images/glibc-dynamic/config/main.tf index bfef0b5086..ad82c3c4b8 100644 --- a/images/glibc-dynamic/config/main.tf +++ b/images/glibc-dynamic/config/main.tf @@ -4,12 +4,19 @@ variable "extra_packages" { default = [] } +variable "extra_repositories" { + description = "Extra repositories to add." + type = list(string) + default = [] +} + module "accts" { source = "../../../tflib/accts" } output "config" { value = jsonencode({ contents = { - packages = concat(["glibc", "libgcc", "libstdc++"], var.extra_packages) + repositories = var.extra_repositories + packages = concat(["glibc", "libgcc", "libstdc++"], var.extra_packages) } accounts = module.accts.block }) diff --git a/images/wordpress/config/main.tf b/images/wordpress/config/main.tf deleted file mode 100644 index 85e6775187..0000000000 --- a/images/wordpress/config/main.tf +++ /dev/null @@ -1,101 +0,0 @@ - -variable "base_packages" { - description = "The additional packages to install (e.g. php-fpm)." - default = [ - "curl", - "ca-certificates", - "imagemagick", - "php", - "php-fpm", - "php-ctype", - "php-curl", - "php-dom", - "php-fileinfo", - "php-iconv", - "php-mbstring", - "php-mysqlnd", - "php-openssl", - "php-bcmath", - "php-intl", - "php-sodium", - "php-simplexml", - "php-xml", - "php-igbinary", - "php-mysqli", - "php-zip", - "php-xmlwriter", - "php-xmlreader", - "php-imagick", - "php-opcache", - "wordpress" - ] -} - -variable "php_version" { - description = "Major php version for all the deps" - default = "php" -} - -variable "dev_packages" { - description = "The additional packages to install in the dev image." - default = ["wolfi-base", "wordpress-oci-entrypoint"] -} - -variable "wp-paths" { - description = "File paths for the image" - default = [{ - path = "/var/www/html", - type = "directory", - uid = 65532, - gid = 65532, - permissions = 493, - }] -} - -module "accts" { - source = "../../../tflib/accts" - name = "php" -} - -output "config" { - value = jsonencode({ - contents = { - packages = [for p in var.base_packages : replace(p, "php", var.php_version)] - } - accounts = module.accts.block - entrypoint = { command = "php-fpm" } - work-dir = "/var/www/html" - paths = var.wp-paths - environment = { - PATH = "/usr/sbin:/sbin:/usr/bin:/bin" - } - }) -} - -output "config-dev" { - value = jsonencode({ - contents = { - packages = concat([for p in var.base_packages : replace(p, "php", var.php_version)], var.dev_packages) - } - accounts = module.accts.block - entrypoint = { command = "/usr/local/bin/docker-entrypoint.sh php-fpm" } - work-dir = "/var/www/html" - paths = concat(var.wp-paths, [{ - path = "/var/www/html/wp-content", - type = "directory", - uid = module.accts.block.run-as, - gid = module.accts.block.run-as, - permissions = 511, - }, { - path = "/usr/src/wordpress", - type = "directory", - uid = 65532, - gid = 65532, - permissions = 493, - } - ]) - environment = { - PATH = "/usr/sbin:/sbin:/usr/bin:/bin" - } - }) -} diff --git a/images/wordpress/generated.tf b/images/wordpress/generated.tf index 32bbb90dc2..17b10527fe 100644 --- a/images/wordpress/generated.tf +++ b/images/wordpress/generated.tf @@ -6,7 +6,7 @@ variable "test_repository" { output "summary" { value = { - "tags" = merge({}) + "tags" = merge(module.tagger.imagetags, module.tagger-dev.imagetags) } } diff --git a/images/wordpress/main.tf b/images/wordpress/main.tf index a4f9054f4c..e17605d35a 100644 --- a/images/wordpress/main.tf +++ b/images/wordpress/main.tf @@ -1,55 +1,52 @@ -terraform { - required_providers { - oci = { source = "chainguard-dev/oci" } - } -} - variable "target_repository" { description = "The docker repo into which the image and attestations should be published." } module "php-versions" { - source = "../../tflib/versions/" package = "php" + source = "../../tflib/versions" } module "config" { - source = "./config" php_version = [for k, v in module.php-versions.versions : k if v.is_latest][0] + source = "./config" } module "latest" { - source = "../../tflib/publisher" + config = module.config.config + main_package = "wordpress" name = basename(path.module) + source = "../../tflib/publisher" target_repository = var.target_repository - config = module.config.config } module "latest-dev" { - source = "../../tflib/publisher" + config = module.config.config-dev + main_package = "wordpress" name = basename(path.module) + source = "../../tflib/publisher" target_repository = var.target_repository - config = module.config.config-dev } module "test-latest" { - source = "./tests" digest = module.latest.image_ref + source = "./tests" } module "test-latest-dev" { - source = "./tests" digest = module.latest-dev.image_ref + source = "./tests" } -resource "oci_tag" "latest" { +module "tagger" { depends_on = [module.test-latest] - digest_ref = module.latest.image_ref - tag = "latest" + source = "../../tflib/tagger" + tags = module.latest.latest_tag_map } -resource "oci_tag" "latest-dev" { +module "tagger-dev" { depends_on = [module.test-latest-dev] - digest_ref = module.latest-dev.image_ref - tag = "latest-dev" + source = "../../tflib/tagger" + tags = module.latest-dev.latest_tag_map } + diff --git a/images/wordpress/metadata.yaml b/images/wordpress/metadata.yaml index 58b8b33ee6..a2e58f3e0c 100644 --- a/images/wordpress/metadata.yaml +++ b/images/wordpress/metadata.yaml @@ -13,3 +13,4 @@ keywords: tier: APPLICATION aliases: - wordpress:latest +public: true diff --git a/images/wordpress/tests/main.tf b/images/wordpress/tests/main.tf deleted file mode 100644 index 153b3e0588..0000000000 --- a/images/wordpress/tests/main.tf +++ /dev/null @@ -1,49 +0,0 @@ -terraform { - required_providers { - oci = { source = "chainguard-dev/oci" } - imagetest = { source = "chainguard-dev/imagetest" } - } -} - -variable "digest" { - description = "The image digest to run tests over." -} - -data "imagetest_inventory" "inventory" {} - -resource "random_id" "id" { - byte_length = 4 -} - -resource "imagetest_harness_docker" "docker" { - name = "docker-wordpress" - inventory = data.imagetest_inventory.inventory - - envs = { - IMAGE_NAME : var.digest - WP_CONTAINER_NAME : "wordpress-${random_id.id.hex}" - } -} - -resource "imagetest_feature" "wordpress-basic" { - name = "docker-test-wordpress" - harness = imagetest_harness_docker.docker - - steps = [{ - name = "Start up WordPress container" - cmd = <&1 | grep -q "ready to handle connections" -EOT - retry = { attempts = 15, delay = "30s" } - }, { - name = "stop container" - cmd = <