Skip to content

Commit

Permalink
automate fetching opa version
Browse files Browse the repository at this point in the history
Signed-off-by: Jaydip Gabani <[email protected]>
  • Loading branch information
JaydipGabani committed Sep 12, 2024
1 parent cb6da79 commit baab5e6
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/patch-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ jobs:
git checkout master
- name: Create patch version docs
run: make patch-version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG} OLDVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.$((PATCH_VERSION-1))
run: |
tags=$(git tag -l --sort=-v:refname)
versions=''
for tag in $tags; do
if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
opa=$(curl https://raw.githubusercontent.com/open-policy-agent/gatekeeper/$tag/go.mod | grep /opa | awk '{print $2}')
if [ $opa ]; then
versions+="| \`$tag\` | \`$opa\` |\n"
fi
fi
done
make patch-version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG} OLDVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.$((PATCH_VERSION-1)) OPA_VERSIONS="${versions}"
- name: Create release pull request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,18 @@ jobs:
- run: make release-manifest promote-staging-manifest

- if: github.event_name == 'push'
run: make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG}
run: |
tags=$(git tag -l --sort=-v:refname)
versions=''
for tag in $tags; do
if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
opa=$(curl https://raw.githubusercontent.com/open-policy-agent/gatekeeper/$tag/go.mod | grep /opa | awk '{print $2}')
if [ $opa ]; then
versions+="| \`$tag\` | \`$opa\` |\n"
fi
fi
done
make version-docs NEWVERSION=v${MAJOR_VERSION}.${MINOR_VERSION}.x TAG=v${TAG} OPA_VERSIONS="${versions}"
- name: Create release pull request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ release-manifest:
# Tags a new version for docs
.PHONY: version-docs
version-docs:
@sed -i '10,$$c ${OPA_VERSIONS}' ./website/docs/opa-versions.md
@sed -i '/^$$/d' ./website/docs/opa-versions.md
docker run \
-v $(shell pwd)/website:/website \
-w /website \
Expand All @@ -500,6 +502,10 @@ version-docs:
.PHONY: patch-version-docs
patch-version-docs:
@sed -i 's/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${OLDVERSION}\/deploy\/gatekeeper\.yaml.*/https:\/\/raw\.githubusercontent\.com\/open-policy-agent\/gatekeeper\/${TAG}\/deploy\/gatekeeper\.yaml/' ./website/versioned_docs/version-${NEWVERSION}/install.md
@sed -i '10,$$c ${OPA_VERSIONS}' ./website/docs/opa-versions.md
@sed -i '/^$$/d' ./website/docs/opa-versions.md
@sed -i '10,$$c ${OPA_VERSIONS}' ./website/versioned_docs/version-${NEWVERSION}/opa-versions.md
@sed -i '/^$$/d' ./website/versioned_docs/version-${NEWVERSION}/opa-versions.md

promote-staging-manifest:
@rm -rf deploy
Expand Down
51 changes: 31 additions & 20 deletions website/docs/opa-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,48 @@
id: opa-versions
title: OPA Versions
---

Gatekeeper depends on [Open Policy Agent](https://www.openpolicyagent.org/). To see which version of OPA is included in a particular Gatekeeper release, reference the table below.

| Gatekeeper Version | OPA Version |
| ------------------ | ----------- |
| `v3.17.1` | `v0.67.0` |
| `v3.17.0` | `v0.67.0` |
| `v3.16.3` | `v0.64.1` |
| `v3.16.2` | `v0.63.0` |
| `v3.16.0` | `v0.60.0` |
| `v3.16.0` | `v0.63.0` |
| `v3.15.1` | `v0.60.0` |
| `v3.15.0` | `v0.60.0` |
| `v3.14.2` | `v0.57.1` |
| `v3.14.1` | `v0.57.1` |
| `v3.14.0` | `v0.57.1` |
| `v3.13.4` | `v0.54.0` |
| `v3.13.3` | `v0.54.0` |
| `v3.13.2` | `v0.54.0` |
| `v3.13.1` | `v0.54.0` |
| `v3.13.0` | `v0.54.0` |
| `v3.12.0` | `v0.49.2` |
| `v3.11.1` | `v0.47.2` |
| `v3.11.0` | `v0.47.2` |
| `v3.10.0` | `v0.44.0` |
| `v3.9.2` | `v0.44.0` |
| `v3.9.1` | `v0.44.0` |
| `v3.9.0` | `v0.41.0` |
| `v3.8.1` | `v0.39.0` |
| `v3.8.0` | `v0.39.0` |
| `v3.7.2` | `v0.29.4` |
| `v3.7.1` | `v0.29.4` |
| `v3.7.0` | `v0.29.4` |
| `v3.6.0` | `v0.24.0` |
| `v3.5.2` | `v0.24.0` |
| `v3.5.1` | `v0.24.0` |
| `v3.5.0` | `v0.24.0` |
| `v3.4.1` | `v0.24.0` |
| `v3.4.0` | `v0.24.0` |
| `v3.3.0` | `v0.24.0` |
| `v3.2.0` | `v0.19.1` |
| `v3.1.0` | `v0.19.1` |
| `v3.9.2` | `v0.44.0` |
| `v3.9.1` | `v0.44.0` |
| `v3.9.0` | `v0.41.0` |
| `v3.8.1` | `v0.39.0` |
| `v3.8.0` | `v0.39.0` |
| `v3.7.2` | `v0.29.4` |
| `v3.7.1` | `v0.29.4` |
| `v3.7.0` | `v0.29.4` |
| `v3.6.0` | `v0.29.4` |
| `v3.5.2` | `v0.24.0` |
| `v3.5.1` | `v0.24.0` |
| `v3.5.0` | `v0.24.0` |
| `v3.4.1` | `v0.24.0` |
| `v3.4.0` | `v0.24.0` |
| `v3.3.0` | `v0.24.0` |
| `v3.2.3` | `v0.21.0` |
| `v3.2.2` | `v0.21.0` |
| `v3.2.1` | `v0.21.0` |
| `v3.2.0` | `v0.21.0` |
| `v3.1.3` | `v0.21.0` |
| `v3.1.2` | `v0.21.0` |
| `v3.1.1` | `v0.21.0` |
| `v3.1.0` | `v0.21.0` |

0 comments on commit baab5e6

Please sign in to comment.