Replies: 4 comments
-
I've been using within in a organisation where I manage multiple terraform repos. Policy releasesFor releasing the policies I went down a slightly different approach to updatecli/policies, relying on GitHub workflows to do the lifting as oppose to shell scripts. I also added tagging and releases similar to how a helm chart repo works: GitHub Workflow
name: Policy Release
on:
push:
branches:
- main
paths:
- "updatecli/policies/**"
defaults:
run:
shell: bash
permissions: {}
jobs:
changed-policies:
name: Get changed policies
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
json: true
quotepath: false
files: "updatecli/policies/**/policy.yaml"
dir_names: true
- name: Set changed files as output
id: set-matrix
run: |
matrix="{\"directory\":${{ steps.changed-files.outputs.all_changed_files }}}"
echo "$matrix" | jq .
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
needs:
- changed-policies
strategy:
matrix: ${{ fromJSON(needs.changed-policies.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup updatecli
uses: updatecli/updatecli-action@v2
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set policy details
id: policy
env:
POLICY_DIR: ${{ matrix.directory }}
run: |
name=$(realpath --relative-to=./updatecli/policies "${POLICY_DIR}")
version=$(yq .version "${POLICY_DIR}/policy.yaml")
{
printf "name=$name\n"
printf "version=$version\n"
printf "release=$name-$version\n"
} >>"${GITHUB_OUTPUT}"
- name: Create github release
id: github-release
env:
GH_TOKEN: ${{ github.token }}
RELEASE: ${{ steps.policy.outputs.release }}
run: |
git tag "${RELEASE}"
git push origin "${RELEASE}"
gh release create "${RELEASE}" --verify-tag --latest
- name: Push updatecli manifest
working-directory: ${{ matrix.directory }}
env:
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
POLICY_NAME: ${{ steps.policy.outputs.name }}
run: |
updatecli manifest push \
--config updatecli.d \
--policy policy.yaml \
--values values.yaml \
--tag "ghcr.io/${GITHUB_REPOSITORY_OWNER}/${GITHUB_REPOSITORY_NAME}/${POLICY_NAME}" \
. This is more a preference thing, but I thought i'd share the different approach. I do think providing a standard approach (possibly a template/documentation similar to
|
Beta Was this translation helpful? Give feedback.
-
Wow that's a lot of feedback
The way you release is really interesting and probably better than what I am currently doing. I'll give a try on a new org
I agree it's a matter of taste, I wanted to highlight its importance by using a capital letter and reducing the risk of jsonschema store collision with another file So if you have a file name "Policy.yaml" with a parent directory "updatecli" then IDE will validate the syntax similarly to Updatecli manifests
This a great feedback and I wondered if I needed it, but now you confirm that yes :) |
Beta Was this translation helpful? Give feedback.
-
I open this pullrequest which adds a new command
|
Beta Was this translation helpful? Give feedback.
-
I opened a pullrequest to move shareable policies out of experimental as it's working great on my projects and I don't envision any breaking changes. |
Beta Was this translation helpful? Give feedback.
-
I starting this discussion to gather all ideas around Updatecli policy and to identify missing steps for moving the feature out of experimental
Context
The updatecli policy feature, provides the ability to publish any Updatecli to an registry and then to reuse them either with command line or via the
update-compose.yaml
such as on the updatelci/websiteexamples:
updatecli compose diff -f update-compose.yaml --experimental
updatecli diff ghcr.io/updatecli/policies/nodejs/netlify:0.3.0
updatecli diff ghcr.io/updatecli/policies/nodejs/netlify:0.3.0@sha256:41c2af6a10da1f4b4b91717ebaa4659332dd3d7107919c494c71f1f618aeaad8
The goal is to be more DRY but not having to copy/paste the same policy over and over to multiple git repository.
Beta Was this translation helpful? Give feedback.
All reactions