diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 000000000..2b9c8bda7 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -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: 'kayobe@stackhpc\/.*$' + prefix: 'kayobe@' + 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 }}. diff --git a/etc/kayobe/stackhpc.yml b/etc/kayobe/stackhpc.yml index 4fc4349ab..bcfcdcacd 100644 --- a/etc/kayobe/stackhpc.yml +++ b/etc/kayobe/stackhpc.yml @@ -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 diff --git a/releasenotes/notes/kolla-dependency-workflow-6ff5520ee0ab8e15.yaml b/releasenotes/notes/kolla-dependency-workflow-6ff5520ee0ab8e15.yaml new file mode 100644 index 000000000..acbe45077 --- /dev/null +++ b/releasenotes/notes/kolla-dependency-workflow-6ff5520ee0ab8e15.yaml @@ -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. diff --git a/requirements.txt b/requirements.txt index aaf998164..cac612a76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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