-
Notifications
You must be signed in to change notification settings - Fork 109
GitHub Action to update Pinned libraries #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
priyaananthasankar
wants to merge
6
commits into
master
Choose a base branch
from
update_pinned_libs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ad11b26
GitHub Action to update Pinned libraries
6b57c67
Update .github/workflows/update-pinned-libs.yml
priyaananthasankar bf112ee
Update .github/workflows/update-pinned-libs.yml
priyaananthasankar 7dcad71
Update .github/workflows/update-pinned-libs.yml
priyaananthasankar 44d4fd4
Update .github/workflows/update-pinned-libs.yml
priyaananthasankar 586ad7f
Run once every 2 weeks
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| name: Update Pinned Library Versions | ||
|
|
||
| on: | ||
| schedule: | ||
| # Check for updates every 2 weeks (1st and 15th of each month) at 6:00 AM UTC | ||
| - cron: '0 6 1,15 * *' | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| jobs: | ||
| check-library-versions: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get current Istio version | ||
| id: current-istio | ||
| run: | | ||
| CURRENT_VERSION=$(grep 'ENV ISTIO_VERSION=' linux/base.Dockerfile | cut -d'=' -f2) | ||
| if [ -z "${CURRENT_VERSION}" ]; then | ||
| echo "Error: Unable to determine current Istio version from linux/base.Dockerfile" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | ||
| echo "Current Istio version: ${CURRENT_VERSION}" | ||
|
|
||
| - name: Get latest Istio version | ||
| id: latest-istio | ||
| run: | | ||
| set -e | ||
| LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/istio/istio/releases/latest | jq -er '.tag_name') || { | ||
| echo "Error: Failed to fetch latest Istio release information from GitHub API." >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if [ -z "${LATEST_VERSION}" ] || [ "${LATEST_VERSION}" = "null" ]; then | ||
| echo "Error: Received empty or invalid latest Istio version from GitHub API." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "version=${LATEST_VERSION}" >> $GITHUB_OUTPUT | ||
| echo "Latest Istio version: ${LATEST_VERSION}" | ||
|
|
||
| - name: Compare Istio versions | ||
| id: compare-istio | ||
| run: | | ||
| CURRENT="${{ steps.current-istio.outputs.version }}" | ||
| LATEST="${{ steps.latest-istio.outputs.version }}" | ||
|
|
||
| if [ "${CURRENT}" != "${LATEST}" ]; then | ||
| echo "needs_update=true" >> $GITHUB_OUTPUT | ||
| echo "Istio update needed: ${CURRENT} -> ${LATEST}" | ||
| else | ||
| echo "needs_update=false" >> $GITHUB_OUTPUT | ||
| echo "Istio already on latest version: ${CURRENT}" | ||
| fi | ||
|
|
||
| - name: Update Istio in Dockerfile | ||
| if: steps.compare-istio.outputs.needs_update == 'true' | ||
| run: | | ||
| LATEST="${{ steps.latest-istio.outputs.version }}" | ||
|
|
||
| # Ensure the expected ENV ISTIO_VERSION line exists before attempting to update | ||
| if ! grep -q '^ENV ISTIO_VERSION=' linux/base.Dockerfile; then | ||
| echo "Error: Could not find 'ENV ISTIO_VERSION=' line in linux/base.Dockerfile" | ||
| exit 1 | ||
| fi | ||
|
|
||
| sed -i "s/^ENV ISTIO_VERSION=.*/ENV ISTIO_VERSION=${LATEST}/" linux/base.Dockerfile | ||
|
|
||
| # Verify that the update was applied successfully | ||
| if ! grep -q "^ENV ISTIO_VERSION=${LATEST}$" linux/base.Dockerfile; then | ||
| echo "Error: Failed to update ISTIO_VERSION to ${LATEST} in linux/base.Dockerfile" | ||
| exit 1 | ||
| fi | ||
| echo "Updated ISTIO_VERSION to ${LATEST}" | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.compare-istio.outputs.needs_update == 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: "chore: update pinned library versions" | ||
| title: "chore: update pinned library versions" | ||
| body: | | ||
| ## Automated Library Version Updates | ||
|
|
||
| This PR updates the following pinned library versions: | ||
|
|
||
| ${{ steps.compare-istio.outputs.needs_update == 'true' && format('- **Istio**: `{0}` → `{1}`', steps.current-istio.outputs.version, steps.latest-istio.outputs.version) || '' }} | ||
|
|
||
| ### Changes | ||
| - Updated version variables in [linux/base.Dockerfile](linux/base.Dockerfile) | ||
|
|
||
| ### Release Notes | ||
| ${{ steps.compare-istio.outputs.needs_update == 'true' && format('- [Istio {0}](https://github.com/istio/istio/releases/tag/{0})', steps.latest-istio.outputs.version) || '' }} | ||
|
|
||
| --- | ||
| *This PR was automatically created by the Update Pinned Library Versions workflow.* | ||
| branch: update-pinned-libs-${{ github.run_number }} | ||
| delete-branch: true | ||
| labels: | | ||
| dependencies | ||
| automated | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.