Skip to content
Merged
87 changes: 87 additions & 0 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Update dependencies

on:
# Allow manual executions
workflow_dispatch:
# Run nightly
schedule:
- cron: '0 0 * * *'

jobs:
propose_github_release_updates:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- key: kolla
path: src/kayobe-config/etc/kayobe/stackhpc.yml
repository: stackhpc/kolla
search_regex: 'stackhpc_kolla_source_version\:.*$'
prefix: 'stackhpc_kolla_source_version\: '

- key: kolla-ansible
path: src/kayobe-config/etc/kayobe/stackhpc.yml
repository: stackhpc/kolla-ansible
search_regex: 'stackhpc_kolla_ansible_source_version\:.*$'
prefix: 'stackhpc_kolla_ansible_source_version\: '

- key: kayobe
path: src/kayobe-config/requirements.txt
repository: stackhpc/kayobe
search_regex: '@stackhpc\/.*$'
prefix: '@'
permissions:
contents: write
pull-requests: write
name: ${{ matrix.key }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/src/kayobe-config

- name: Determine OpenStack release
id: openstack_release
run: |
BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' .gitreview)
echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT
working-directory: ${{ github.workspace }}/src/kayobe-config

- name: Checkout the dependency repo
uses: actions/checkout@v4
with:
repository: ${{ matrix.repository }}
ref: stackhpc/${{ steps.openstack_release.outputs.openstack_release }}
fetch-tags: true
path: ${{ github.workspace }}/src/${{ matrix.key }}

- name: Get latest tag
id: latest_tag
run: |
TAG=$(git describe --tags --abbrev=0 --match stackhpc/\*)
echo latest_tag=${TAG} >> $GITHUB_OUTPUT
working-directory: ${{ github.workspace }}/src/${{ matrix.key }}

- name: Update dependency key
run: |
TAG_OVERRIDE=$(echo $TAG | sed 's/\//\\\//g')
sed -i "s/$SEARCH/$PREFIX$TAG_OVERRIDE/g" $REQUIREMENTS
env:
PREFIX: ${{ matrix.prefix }}
TAG: ${{ steps.latest_tag.outputs.latest_tag }}
REQUIREMENTS: ${{ github.workspace }}/${{ matrix.path }}
SEARCH: ${{ matrix.search_regex }}

- name: Propose changes via PR if required
uses: peter-evans/create-pull-request@v7
with:
path: ${{ github.workspace }}/src/kayobe-config
commit-message: >-
Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}
branch: update-dependency/${{ matrix.key }}
delete-branch: true
title: >-
Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}
body: >
This PR was created automatically to update
${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}.
4 changes: 2 additions & 2 deletions etc/kayobe/stackhpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ stackhpc_repo_elrepo_9_version: "{{ stackhpc_repo_distribution }}"

# Kolla source repository.
stackhpc_kolla_source_url: "https://github.com/stackhpc/kolla"
stackhpc_kolla_source_version: "stackhpc/{{ openstack_release }}"
stackhpc_kolla_source_version: stackhpc/18.5.0.1

# Kolla Ansible source repository.
stackhpc_kolla_ansible_source_url: "https://github.com/stackhpc/kolla-ansible"
stackhpc_kolla_ansible_source_version: "stackhpc/{{ openstack_release }}"
stackhpc_kolla_ansible_source_version: stackhpc/18.5.0.1

###############################################################################
# Container image registry
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
Workflow to update Kolla dependencies (Kayobe, Kolla and Kolla-Ansible)
to the latest tag available in the StackHPC branch via CI.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kayobe@git+https://github.com/stackhpc/kayobe@stackhpc/2024.1
kayobe@git+https://github.com/stackhpc/kayobe@stackhpc/16.5.0.1
ansible-modules-hashivault>=5.2.1
jmespath
Loading