Skip to content

ci(feat): convert inline JSON slack messages to templates#25675

Open
joshmarinacci wants to merge 4 commits into
mainfrom
workflows-json-templates
Open

ci(feat): convert inline JSON slack messages to templates#25675
joshmarinacci wants to merge 4 commits into
mainfrom
workflows-json-templates

Conversation

@joshmarinacci
Copy link
Copy Markdown
Contributor

Description:

Converts most usages of creating slack messages with inline JSON to proper gomplate templates. Also adds a unit test for template required variables.

Related issue(s):

Fixes ##25514

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Josh Marinacci <joshua@marinacci.org>
Signed-off-by: Josh Marinacci <joshua@marinacci.org>
Signed-off-by: Josh Marinacci <joshua@marinacci.org>
add a unit test for the templates

Signed-off-by: Josh Marinacci <joshua@marinacci.org>
@joshmarinacci joshmarinacci requested a review from a team as a code owner June 1, 2026 17:20
@joshmarinacci joshmarinacci requested a review from andrewb1269 June 1, 2026 17:20
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Jun 1, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@lfdt-bot
Copy link
Copy Markdown

lfdt-bot commented Jun 1, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@joshmarinacci joshmarinacci self-assigned this Jun 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #25675   +/-   ##
=========================================
  Coverage     75.07%   75.07%           
  Complexity    11537    11537           
=========================================
  Files          2585     2585           
  Lines        101367   101367           
  Branches      11219    11220    +1     
=========================================
  Hits          76102    76102           
  Misses        21356    21356           
  Partials       3909     3909           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@andrewb1269 andrewb1269 left a comment

Choose a reason for hiding this comment

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

I think we should also move the new test functionality (new shell script and new workflow file) to a new issue instead of putting it under this existing issue. It's out of scope of the original issue.

@@ -0,0 +1,40 @@
# SPDX-License-Identifier: Apache-2.0
name: "ZXC: Test Gomplate Templates"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Title should be changed to align with our workflow naming standards.

For the workflow name I suggest:
890: [CALL] Test Gomplate Temps

For the workflow filename I suggest:
890-call-test-gomplate-templates.yaml

jobs:
test-gomplate-templates:
name: Validate Gomplate Templates
runs-on: ubuntu-latest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to use the self-hosted runner, not the Github-hosted runner.

Comment on lines +22 to +37
- name: Harden Runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install gomplate
run: |
curl -sSfL "https://github.com/hairyhenderson/gomplate/releases/download/v5.0.0/gomplate_linux-amd64" \
-o /tmp/gomplate
curl -sSfL "https://github.com/hairyhenderson/gomplate/releases/download/v5.0.0/checksums-v5.0.0_sha256.txt" \
-o /tmp/gomplate_checksums.txt
echo "$(grep 'bin/gomplate_linux-amd64$' /tmp/gomplate_checksums.txt | awk '{print $1}') /tmp/gomplate" | sha256sum -c -
sudo install -m 755 /tmp/gomplate /usr/local/bin/gomplate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest replacing the setup steps with the initialize github job action:

- name: Prepare Runner
  uses: PandasWhoCode/initialize-github-job@3be139d343b1a60e1fcfc70f602ee804bbe3495d # v1.1.1
  with:
    checkout: "true"
    checkout-token: "${{ secrets.GITHUB_TOKEN }}"
    setup-gomplate: "true"

Comment on lines +4 to +7
pull_request:
paths:
- ".github/workflows/templates/**"
- ".github/workflows/support/tests/test-gomplate-templates.sh"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this and trigger it through the "Full CI Check" that we use to validate if testing passed or not. This will turn the file into a workflow-call trigger type, not a FLOW trigger type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants