Skip to content

Conversation

@bbasata
Copy link
Contributor

@bbasata bbasata commented Mar 4, 2025

This PR adds a step to the Build workflow that uploads this repo's Terraform Registry manifest file as an Actions artifact. The intended consumer of this artifact is the Common Release Tooling (CRT) Prepare workflow.

We will need to test the updated Build in integration with Prepare to verify whether Prepare recognizes the manifest file as an artifact type and uploads it to the places it needs to be uploaded.

Tested locally with nektos/act:

$ act --container-architecture linux/amd64 --platform linux=ghcr.io/catthehacker/ubuntu:full-22.04 --pull=false -W .github/workflows/build.yml --artifact-server-path=tmp

... all the output ...

$ grep manifest [ all the output ]

[build/upload-terraform-registry-manifest-file]   ⚙  ::set-output:: filename=terraform-provider-cloudinit_2.3.6-alpha1.json
[build/upload-terraform-registry-manifest-file]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.7/x64/bin/node /var/run/act/actions/actions-upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08/dist/upload/index.js] user= workdir=
| Artifact terraform-registry-manifest.json.zip successfully finalized. Artifact ID 3281509071
| Artifact terraform-registry-manifest.json has been successfully uploaded! Final size is 271 bytes. Artifact ID is 3281509071
[build/upload-terraform-registry-manifest-file]   ⚙  ::set-output:: artifact-id=3281509071
[build/upload-terraform-registry-manifest-file]   ⚙  ::set-output:: artifact-digest=6aea5b37e9e1d9348e8fa84533b70c1a311ff67bbe68e74a78c0905850ed8051
[build/upload-terraform-registry-manifest-file]   ⚙  ::set-output:: artifact-url=https://github.com/hashicorp/terraform-provider-cloudinit/actions/runs/1/artifacts/3281509071
[build/upload-terraform-registry-manifest-file] 🏁  Job succeeded

$ find tmp/1
tmp/1
tmp/1/metadata.json
tmp/1/metadata.json/metadata.json.zip
tmp/1/terraform-registry-manifest.json
tmp/1/terraform-registry-manifest.json/terraform-registry-manifest.json.zip

$ unzip -l tmp/1/terraform-registry-manifest.json/terraform-registry-manifest.json.zip
Archive:  tmp/1/terraform-registry-manifest.json/terraform-registry-manifest.json.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
       82  03-04-2025 12:36   terraform-provider-cloudinit_2.3.6-alpha1.json
---------                     -------
       82                     1 file

$ unzip -p tmp/1/terraform-registry-manifest.json/terraform-registry-manifest.json.zip
{
    "version": 1,
    "metadata": {
        "protocol_versions": ["5.0"]
    }
}

@bbasata bbasata marked this pull request as ready for review March 4, 2025 12:42
@bbasata bbasata requested a review from a team as a code owner March 4, 2025 12:42
Copy link
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like the comment above the new job describing what it does with a concrete example 💯

runs-on: ubuntu-latest
outputs:
filepath: ${{ steps.terraform-registry-manifest.outputs.filename }}
steps:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After we build confidence that this works, we can extract it to a reusable workflow. No need to copy/paste/maintain everywhere 😃

@bbasata bbasata merged commit d4b541e into main Mar 4, 2025
67 checks passed
@bbasata bbasata deleted the upload-terraform-registry-manifest-at-build-time branch March 4, 2025 13:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants