Newer
Older
docs:
csplit -sf readme -n 1 .gitlab/README.md '/<INPUTS>/'
echo '<!-- This document is generated by `make docs` from `.gitlab/README.md` -->' > README.md
echo >> README.md
yq '.spec.inputs | .[] | "| `" + key + "` | `" + .default + "` | " + .description + (.options | (" Must be one of " + (. | map("`" + . + "`") | join(", ") + "." )) // "") + " |"' templates/full-pipeline.yml >> README.md
echo >> README.md
echo '### Available OpenTofu Versions' >> README.md
echo >> README.md
echo 'The following OpenTofu versions are available with this component via the `opentofu_version` input:' >> README.md
echo >> README.md
yq -r '.spec.inputs.opentofu_version.options | .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"' templates/full-pipeline.yml >> README.md
tail -n+2 readme1 >> README.md
rm -f readme0 readme1 readme_inputs.md
BACKPORTS_DIR := backports
BACKPORTS_BASE_DIR := $(BACKPORTS_DIR)/OpenTofu
BACKPORTS_BASE_FILE := $(BACKPORTS_BASE_DIR)/Base.gitlab-ci.yml
# NOTE: this make target requires GNU sed and not the mac OS sed.
# Install it with `brew install gnu-sed` and follow the instructions in `brew info gnu-sed` to
# make it the standard `sed` binary (if you wish) or temporarily alias sed=gsed
@cp $(BACKPORTS_DIR)/.Base.gitlab-ci.yml $(BACKPORTS_BASE_FILE)
@sed '1,/^---$$/d' templates/full-pipeline.yml >> $(BACKPORTS_BASE_FILE)
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_validate \]\]/validate/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_build \]\]/build/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_deploy \]\]/deploy/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_cleanup \]\]/cleanup/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.gitlab_opentofu_image \]\]/$$GITLAB_OPENTOFU_IMAGE/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.root_dir \]\]/$$TF_ROOT/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.state_name \]\]/$$TF_STATE_NAME/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.auto_apply \]\]/$$TF_AUTO_APPLY/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.auto_destroy \]\]/$$TF_AUTO_DESTROY/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.create_destroy_job \]\]/$$TF_CREATE_DESTROY_JOB/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.create_delete_state_job \]\]/$$TF_CREATE_DELETE_STATE_JOB/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/\.default/.opentofu:default/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/^fmt:$$/.opentofu:fmt:/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/^validate:$$/.opentofu:validate:/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/^plan:$$/.opentofu:plan:/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/^apply:$$/.opentofu:apply:/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/destroy:/.opentofu:destroy:/'
@sed -i $(BACKPORTS_BASE_FILE) -e 's/^delete-state:$$/.opentofu:delete-state:/'