From 773e25e9d1648370e31ab5f854f09561794fd781 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Wed, 2 Aug 2023 11:55:07 +0100 Subject: [PATCH 01/17] Fix the release mechanism --- .github/dependabot.yml | 13 +++ .github/workflows/pre-release.yml | 184 ++++++++++++++++-------------- CHANGELOG | 2 +- 3 files changed, 113 insertions(+), 86 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8fd790cc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +--- +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index d62e28db..7cce2ce8 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,96 +1,110 @@ +--- name: Prepare new release as PR on: repository_dispatch: types: [release] +permissions: + pull-requests: write + contents: write + jobs: prepare-release: name: Prepare Release runs-on: ubuntu-latest - container: ubuntu:bionic + container: ubuntu:latest steps: - - name: install packages - run: | - apt-get update && apt-get install -y software-properties-common - add-apt-repository ppa:git-core/ppa - apt-get update && apt-get install -y git jq curl - # Need a new pandoc for markdown rendering below - curl -L https://github.com/jgm/pandoc/releases/download/2.11.1.1/pandoc-2.11.1.1-1-amd64.deb > pandoc-2.11.1.1-1-amd64.deb - apt-get install -y ./pandoc-2.11.1.1-1-amd64.deb - - uses: actions/checkout@v2 - - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - name: get git ready - run: | - git config user.name "egibot" - git config user.email "egibot@egi.eu" - - name: Extract changelog - id: changelog - run: | - # this uses GNU sed -z! - version=$(grep "^## \[[0-9].*\]" CHANGELOG | head -1 | sed -e "s/^.*\[\(.*\)\]/\1/") - changes=$(sed -e "/^## \[$version\]\$/,/^##/!d;//d;/^\$/d" CHANGELOG | \ - sed -e "s/\%/%25/g" | sed -e "s/\r/%0D/" | sed -z -e "s/\n/%0A/g") - echo "changes=$changes" >> "$GITHUB_OUTPUT" - echo "version=$version" >> "$GITHUB_OUTPUT" - - name: bump versions - run: | - { - echo -n "* $(date '+%a %b %d %Y') " - echo -n "$(git config user.name) <$(git config user.email)> " - echo "${{ steps.changelog.outputs.version }}" - echo "${{ steps.changelog.outputs.changes }}" | sed '/^[[:space:]]*$/d' - } > rpm-changes - - for spec in rpm/*.spec; do - sed -i -e "s/^\(Version.\).*/\\1 ${{ steps.changelog.outputs.version }}/" "$spec" - sed -i -e "/%changelog/r rpm-changes" "$spec" - done - - rm -f rpm-changes - - for deb in debian/ debs/cloud-info-provider-opennebula/debian/ debs/cloud-info-provider-openstack/debian/ ; do - pkg=$(head -1 "$deb/changelog" | cut -f1 -d" ") - { - echo "$pkg (${{ steps.changelog.outputs.version }}-1) xenial; urgency=medium" - echo "" - echo "${{ steps.changelog.outputs.changes }}" | \ - sed -e "s/^-/*/" | sed -e "s/^/ /" | sed '/^[[:space:]]*$/d' - echo "" - echo " -- $(git config user.name) <$(git config user.email)> $(date -R)" - echo "" - } > debian-changes - cat debian-changes "$deb/changelog" > "$deb/changelog.new" - mv "$deb/changelog.new" "$deb/changelog" - done - - rm -f debian-changes - - zenodo_changes=$(echo "${{ steps.changelog.outputs.changes }}" | \ - pandoc --from gfm --to html | \ - tr -s "\n" " ") - - jq ".version = \"${{ steps.changelog.outputs.version }}\" | \ - .title = \"EGI-Federation/cloud-info-provider: ${{ steps.changelog.outputs.version }}\" | \ - .related_identifiers[0].identifier = \"https://github.com/EGI-Federation/cloud-info-provider/tree/${{ steps.changelog.outputs.version }}\" | \ - .publication_date = \"$(date '+%Y-%m-%d')\" | \ - .description = \"$zenodo_changes\"" < .zenodo.json > .zenodo.json.new - mv .zenodo.json.new .zenodo.json - git commit -a -m "Prepare version ${{ steps.changelog.outputs.version }}" - - name: Create Pull Request for version - uses: peter-evans/create-pull-request@v3 - with: - delete-branch: true - body: | - Prepares release ${{ steps.changelog.outputs.version }} - - Update RPM and DEB package descriptions and .zenodo.json for - version ${{ steps.changelog.outputs.version }} - labels: release - branch: release-${{ steps.changelog.outputs.version }} - title: Release ${{ steps.changelog.outputs.version }} - token: ${{ steps.generate-token.outputs.token }} + - name: install packages + run: | + apt-get update && apt-get install -y jq curl git + # Need a new pandoc for markdown rendering below + curl -L https://github.com/jgm/pandoc/releases/download/2.11.1.1/pandoc-2.11.1.1-1-amd64.deb \ + > pandoc-2.11.1.1-1-amd64.deb + apt-get install -y ./pandoc-2.11.1.1-1-amd64.deb + git config --global --add safe.directory "$GITHUB_WORKSPACE" + - uses: actions/checkout@v3 + - name: get git ready + run: | + git config user.name "egibot" + git config user.email "egibot@egi.eu" + - name: Extract version + id: extract-version + run: | + # this uses GNU sed -z! + version=$(grep "^## \[[0-9].*\]" CHANGELOG | \ + head -1 | sed -e "s/^.*\[\(.*\)\].*/\1/") + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Extract changelog + id: extract-changelog + uses: sean0x42/markdown-extract@v2 + with: + file: CHANGELOG + pattern: ${{ steps.extract-version.outputs.version }} + no-print-matched-heading: true + - name: bump versions + run: | + # rpms + { + echo -n "* $(date '+%a %b %d %Y') " + echo -n "$(git config user.name) <$(git config user.email)> " + echo '${{ steps.extract-version.outputs.version }}' + echo '${{ steps.extract-changelog.outputs.markdown}}' + } > rpm-changes + + for spec in rpm/*.spec; do + sed -i -e "s/^\(Version.\).*/\\1 ${{ steps.extract-version.outputs.version }}/" "$spec" + sed -i -e "/%changelog/r rpm-changes" "$spec" + done + + rm -f rpm-changes + + # debs + for deb in debian/ debs/cloud-info-provider-opennebula/debian/ \ + debs/cloud-info-provider-openstack/debian/ ; do + pkg=$(head -1 "$deb/changelog" | cut -f1 -d" ") + { + echo "$pkg (${{ steps.extract-version.outputs.version }}-1) \ + xenial; urgency=medium" + echo "" + echo '${{ steps.extract-changelog.outputs.markdown}}' | \ + sed -e "s/^-/*/" | sed -e "s/^/ /" | sed '/^[[:space:]]*$/d' + echo "" + echo " -- $(git config user.name) <$(git config user.email)> $(date -R)" + echo "" + } > debian-changes + cat debian-changes "$deb/changelog" > "$deb/changelog.new" + mv "$deb/changelog.new" "$deb/changelog" + done + + rm -f debian-changes + + # Zenodo + zenodo_changes=$(echo '${{ steps.extract-changelog.outputs.markdown}}' \ + | pandoc --from gfm --to html | tr -s "\n" " ") + + jq --arg VERSION "${{ steps.extract-version.outputs.version }}" \ + --arg TITLE "EGI-Federation/cloud-info-provider: ${{ steps.extract-version.outputs.version }}" \ + --arg RELATED "https://github.com/EGI-Federation/cloud-info-provider/tree/${{ steps.extract-version.outputs.version }}" \ + --arg DATE "$(date '+%Y-%m-%d')" \ + --arg DESC "$zenodo_changes" \ + '.version = $VERSION | + .title = $TITLE | + .related_identifiers[0].identifier = $RELATED | + .publication_date = $DATE | + .description = $DESC' < .zenodo.json > .zenodo.json.new + mv .zenodo.json.new .zenodo.json + + git commit -a -m "Prepare version ${{ steps.extract-version.outputs.version }}" + - name: Create Pull Request for version + uses: peter-evans/create-pull-request@v5 + with: + delete-branch: true + body: > + Prepares release ${{ steps.extract-version.outputs.version }} + + Update RPM and DEB package descriptions and .zenodo.json for + version ${{ steps.extract-version.outputs.version }} + labels: release + branch: release-${{ steps.extract-version.outputs.version }} + title: Release ${{ steps.extract-version.outputs.version }} diff --git a/CHANGELOG b/CHANGELOG index 9064a7cf..727b6b75 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.13.0] - 2023-07-26 +## [0.13.0] ### Added - Add flavor name to templates (#231) (Enol Fernández) - Support sites with URLs in the endpoints of GOCDB (#234) (Enol Fernández) From 6aaced2a43a39408d6643c4f3d4924164efe08f2 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Mon, 21 Aug 2023 09:35:44 +0100 Subject: [PATCH 02/17] Improve yaml files --- .github/workflows/packages.yml | 223 ++++++++++++++++-------------- .github/workflows/superlinter.yml | 1 + etc/sample.aws.yaml | 1 + etc/sample.opennebula.yaml | 3 +- etc/sample.openstack.yaml | 3 +- 5 files changed, 125 insertions(+), 106 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 5ab894ba..a2511625 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -1,3 +1,4 @@ +--- name: Create packages and test installation on: @@ -10,23 +11,23 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v2 - - name: Build sdist - run: | - pip install tox - python setup.py sdist - - name: Get version - id: version - run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" - - name: Upload output file - uses: actions/upload-artifact@v2 - with: - name: sdist - path: dist/*tar.gz + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v2 + - name: Build sdist + run: | + pip install tox + python setup.py sdist + - name: Get version + id: version + run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" + - name: Upload output file + uses: actions/upload-artifact@v2 + with: + name: sdist + path: dist/*tar.gz centos7: name: build centos 7 rpms @@ -34,35 +35,42 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 - with: - name: sdist - - name: install build requisites - run: | - yum install -y rpm-build rpmlint - yum install -y centos-release-openstack-queens - yum install -y python-pbr python-setuptools - - name: build rpm - run: | - tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ - --strip-components 1 cloud_info_provider-${{ needs.sdist.outputs.version }}/rpm - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider.spec - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-opennebula.spec - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-openstack.spec - mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} - cp -v cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz SOURCES - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider.spec - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-openstack.spec - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-opennebula.spec - rpmlint RPMS/noarch/*.rpm - - name: Upload rpms - uses: actions/upload-artifact@v2 - with: - name: rpms - path: | - RPMS/noarch/cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - RPMS/noarch/cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - RPMS/noarch/cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + - uses: actions/download-artifact@v2 + with: + name: sdist + - name: install build requisites + run: | + yum install -y rpm-build rpmlint + yum install -y centos-release-openstack-queens + yum install -y python-pbr python-setuptools + - name: build rpm + run: | + tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ + --strip-components 1 \ + cloud_info_provider-${{ needs.sdist.outputs.version }}/rpm + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" \ + rpm/cloud-info-provider.spec + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" \ + rpm/cloud-info-provider-opennebula.spec + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" \ + rpm/cloud-info-provider-openstack.spec + mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} + cp -v cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ + SOURCES + for rpm in rpm/cloud-info-provider.spec \ + rpm/cloud-info-provider-openstack.spec \ + rpm/cloud-info-provider-opennebula.spec; do + rpmbuild --define "_topdir $PWD" -ba "$rpm" + done + rpmlint RPMS/noarch/*.rpm + - name: Upload rpms + uses: actions/upload-artifact@v2 + with: + name: rpms + path: | + RPMS/noarch/cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + RPMS/noarch/cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + RPMS/noarch/cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm ubuntu: name: build debs @@ -70,37 +78,40 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 - with: - name: sdist - - name: install build requistes - run: | - apt-get update -q - apt-get install -q -y devscripts debhelper git - apt-get install -q -y python-all-dev python-pbr python-setuptools - - name: build packages - run: | - tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ + - uses: actions/download-artifact@v2 + with: + name: sdist + - name: install build requistes + run: | + apt-get update -q + apt-get install -q -y devscripts debhelper git + apt-get install -q -y python-all-dev python-pbr python-setuptools + - name: build packages + run: | + tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ --strip-components 1 - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd debs/cloud-info-provider-openstack - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd ../../debs/cloud-info-provider-opennebula - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd ../.. - mv debs/*.deb . - mv ../*.deb . - - name: Upload debs - uses: actions/upload-artifact@v2 - with: - name: debs - path: | - python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb - python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb - python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" \ + debian/changelog + debuild --no-tgz-check clean binary + cd debs/cloud-info-provider-openstack + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" \ + debian/changelog + debuild --no-tgz-check clean binary + cd ../../debs/cloud-info-provider-opennebula + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" \ + debian/changelog + debuild --no-tgz-check clean binary + cd ../.. + mv debs/*.deb . + mv ../*.deb . + - name: Upload debs + uses: actions/upload-artifact@v2 + with: + name: debs + path: | + python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb + python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb + python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb centos7-install-openstack: name: install centos 7 rpms (openstack) @@ -108,13 +119,14 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 - with: - name: rpms - - name: install generated rpms - run: | - yum install -y centos-release-openstack-queens - yum localinstall -y cloud-info-provider-openstack-*.rpm cloud-info-provider-[^o]*.rpm + - uses: actions/download-artifact@v2 + with: + name: rpms + - name: install generated rpms + run: | + yum install -y centos-release-openstack-queens + yum localinstall -y cloud-info-provider-openstack-*.rpm \ + cloud-info-provider-[^o]*.rpm centos7-install-opennebula: name: install centos 7 rpms (opennebula) @@ -122,13 +134,14 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 - with: - name: rpms - - name: install generated rpms - run: | - yum install -y epel-release - yum localinstall -y cloud-info-provider-opennebula-*.rpm cloud-info-provider-[^o]*.rpm + - uses: actions/download-artifact@v2 + with: + name: rpms + - name: install generated rpms + run: | + yum install -y epel-release + yum localinstall -y cloud-info-provider-opennebula-*.rpm \ + cloud-info-provider-[^o]*.rpm ubuntu-install-openstack: name: install debs (openstack) @@ -136,13 +149,14 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 - with: - name: debs - - name: install generated debs - run: | - apt-get update - apt-get install -y ./python-cloud-info-provider_*.deb ./python-cloud-info-provider-openstack_*.deb + - uses: actions/download-artifact@v2 + with: + name: debs + - name: install generated debs + run: | + apt-get update + apt-get install -y ./python-cloud-info-provider_*.deb \ + ./python-cloud-info-provider-openstack_*.deb ubuntu-install-opennebula: name: install debs (opennebula) @@ -150,10 +164,11 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 - with: - name: debs - - name: install generated debs - run: | - apt-get update - apt-get install -y ./python-cloud-info-provider_*.deb ./python-cloud-info-provider-opennebula_*.deb + - uses: actions/download-artifact@v2 + with: + name: debs + - name: install generated debs + run: | + apt-get update + apt-get install -y ./python-cloud-info-provider_*.deb \ + ./python-cloud-info-provider-opennebula_*.deb diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml index e0bf3bea..a855f37c 100644 --- a/.github/workflows/superlinter.yml +++ b/.github/workflows/superlinter.yml @@ -1,3 +1,4 @@ +--- name: Super-Linter on: [pull_request, push] diff --git a/etc/sample.aws.yaml b/etc/sample.aws.yaml index 9db73fe0..a3670e16 100644 --- a/etc/sample.aws.yaml +++ b/etc/sample.aws.yaml @@ -1,3 +1,4 @@ +--- site: ## Your site name, as in GODCB (if omitted or set to None, this value is ## retrieved from /etc/glite-info-static/site/site.cfg ) diff --git a/etc/sample.opennebula.yaml b/etc/sample.opennebula.yaml index 01d85f6b..359f7f05 100644 --- a/etc/sample.opennebula.yaml +++ b/etc/sample.opennebula.yaml @@ -99,7 +99,8 @@ compute: default_network_type: public # Public Network name public_network_name: PUBLIC - # Default membership is VO:, specify if finer grained AuthZ is used + # Default membership is VO: + # specify if finer grained AuthZ is used #membership: # - VO:ops fedcloud.egi.eu: diff --git a/etc/sample.openstack.yaml b/etc/sample.openstack.yaml index b7b52fdf..1efc120e 100644 --- a/etc/sample.openstack.yaml +++ b/etc/sample.openstack.yaml @@ -32,7 +32,8 @@ compute: # auth: # project_id: xxxx # sla: https://egi.eu/sla/fedcloud - # # Default network type: none, public, public_only, private, private_only + # # Default network type: none, public, public_only, + # # private, private_only # default_network_type: public # # Public Network name # public_network_name: PUBLIC From 0e58947d42217c3d16c1a4a6dd48ae27ce933401 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Mon, 21 Aug 2023 10:10:04 +0100 Subject: [PATCH 03/17] Better yamls --- .github/workflows/python.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 01e8be0b..e2f80ad2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,3 +1,4 @@ +--- name: Python testing on: pull_request @@ -11,16 +12,16 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install Tox - run: pip install tox - - name: Run Tox - run: | - # Run tox using the version of Python in `PATH` - tox -e py - tox -e bandit - tox -e cobertura + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Tox + run: pip install tox + - name: Run Tox + run: | + # Run tox using the version of Python in `PATH` + tox -e py + tox -e bandit + tox -e cobertura From 16b0af05ef6fb197edfd18c41ae8ac3903f9957b Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Mon, 21 Aug 2023 10:14:04 +0100 Subject: [PATCH 04/17] Fix release --- .github/workflows/release.yml | 200 +++++++++++++++++----------------- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc5e0847..f88110d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,26 +13,32 @@ jobs: outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - - uses: actions/checkout@v2 - - name: Extract changelog - id: changelog - run: | - version=$(grep "^## \[[0-9].*\]" CHANGELOG | head -1 | sed -e "s/^.*\[\(.*\)\]/\1/") - changes=$(sed -e "/^## \[$version\]\$/,/^##/!d;//d;/^\$/d" CHANGELOG | \ - sed -e "s/\%/%25/g" | sed -e "s/\r/%0D/" | sed -z -e "s/\n/%0A/g") - echo "changes=$changes" >> "$GITHUB_OUTPUT" - echo "version=$version" >> "$GITHUB_OUTPUT" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.changelog.outputs.version }} - release_name: Release ${{ steps.changelog.outputs.version }} - draft: false - prerelease: false - body: '${{ steps.changelog.outputs.changes }}' + - uses: actions/checkout@v3 + - name: Extract version + id: extract-version + run: | + # this uses GNU sed -z! + version=$(grep "^## \[[0-9].*\]" CHANGELOG | \ + head -1 | sed -e "s/^.*\[\(.*\)\].*/\1/") + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Extract changelog + id: extract-changelog + uses: sean0x42/markdown-extract@v2 + with: + file: CHANGELOG + pattern: ${{ steps.extract-version.outputs.version }} + no-print-matched-heading: true + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.extract-version.outputs.version }} + release_name: Release ${{ steps.extract-version.outputs.version }} + draft: false + prerelease: false + body: '${{ steps.extract-changelog.outputs.markdown }}' sdist: name: build python sdist @@ -41,23 +47,23 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v2 - - name: Build sdist - run: | - pip install tox - python setup.py sdist - - name: Get version - id: version - run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" - - name: Upload output file - uses: actions/upload-artifact@v2 - with: - name: sdist - path: dist/*tar.gz + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v2 + - name: Build sdist + run: | + pip install tox + python setup.py sdist + - name: Get version + id: version + run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" + - name: Upload output file + uses: actions/upload-artifact@v2 + with: + name: sdist + path: dist/*tar.gz centos7: name: build centos 7 rpms @@ -65,35 +71,35 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 - with: - name: sdist - - name: install build requisites - run: | - yum install -y rpm-build rpmlint - yum install -y centos-release-openstack-queens - yum install -y python-pbr python-setuptools - - name: build rpm - run: | - tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ - --strip-components 1 cloud_info_provider-${{ needs.sdist.outputs.version }}/rpm - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider.spec - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-opennebula.spec - sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-openstack.spec - mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} - cp -v cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz SOURCES - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider.spec - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-openstack.spec - rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-opennebula.spec - rpmlint RPMS/noarch/*.rpm - - name: Upload rpms - uses: actions/upload-artifact@v2 - with: - name: rpms - path: | - RPMS/noarch/cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - RPMS/noarch/cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - RPMS/noarch/cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + - uses: actions/download-artifact@v2 + with: + name: sdist + - name: install build requisites + run: | + yum install -y rpm-build rpmlint + yum install -y centos-release-openstack-queens + yum install -y python-pbr python-setuptools + - name: build rpm + run: | + tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ + --strip-components 1 cloud_info_provider-${{ needs.sdist.outputs.version }}/rpm + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider.spec + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-opennebula.spec + sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-openstack.spec + mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} + cp -v cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz SOURCES + rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider.spec + rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-openstack.spec + rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-opennebula.spec + rpmlint RPMS/noarch/*.rpm + - name: Upload rpms + uses: actions/upload-artifact@v2 + with: + name: rpms + path: | + RPMS/noarch/cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + RPMS/noarch/cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + RPMS/noarch/cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm ubuntu: name: build debs @@ -101,37 +107,37 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 - with: - name: sdist - - name: install build requistes - run: | - apt-get update -q - apt-get install -q -y devscripts debhelper git - apt-get install -q -y python-all-dev python-pbr python-setuptools - - name: build packages - run: | - tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ - --strip-components 1 - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd debs/cloud-info-provider-openstack - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd ../../debs/cloud-info-provider-opennebula - sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog - debuild --no-tgz-check clean binary - cd ../.. - mv debs/*.deb . - mv ../*.deb . - - name: Upload debs - uses: actions/upload-artifact@v2 - with: - name: debs - path: | - python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb - python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb - python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb + - uses: actions/download-artifact@v2 + with: + name: sdist + - name: install build requistes + run: | + apt-get update -q + apt-get install -q -y devscripts debhelper git + apt-get install -q -y python-all-dev python-pbr python-setuptools + - name: build packages + run: | + tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \ + --strip-components 1 + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog + debuild --no-tgz-check clean binary + cd debs/cloud-info-provider-openstack + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog + debuild --no-tgz-check clean binary + cd ../../debs/cloud-info-provider-opennebula + sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog + debuild --no-tgz-check clean binary + cd ../.. + mv debs/*.deb . + mv ../*.deb . + - name: Upload debs + uses: actions/upload-artifact@v2 + with: + name: debs + path: | + python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb + python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb + python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb release: needs: [sdist, ubuntu, centos7, prepare-release] From 042aae8bd2f15c47f71fe041f2ba7c230d523263 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:59 +0000 Subject: [PATCH 05/17] Bump actions/download-artifact from 2 to 3 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/packages.yml | 12 ++++++------ .github/workflows/release.yml | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index a2511625..34ea7bab 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: sdist - name: install build requisites @@ -78,7 +78,7 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: sdist - name: install build requistes @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: rpms - name: install generated rpms @@ -134,7 +134,7 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: rpms - name: install generated rpms @@ -149,7 +149,7 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: debs - name: install generated debs @@ -164,7 +164,7 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: debs - name: install generated debs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f88110d4..e60e8b28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: sdist - name: install build requisites @@ -107,7 +107,7 @@ jobs: runs-on: ubuntu-latest container: ubuntu:xenial steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: sdist - name: install build requistes @@ -144,10 +144,10 @@ jobs: name: Upload release artefacts runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: debs - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: rpms - name: Upload base rpm From d130a85d5b1b04da9ae1a941a511653423fa6330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:56 +0000 Subject: [PATCH 06/17] Bump github/super-linter from 4 to 5 Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5. - [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md) - [Commits](https://github.com/github/super-linter/compare/v4...v5) --- updated-dependencies: - dependency-name: github/super-linter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/superlinter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml index a855f37c..6e24e73d 100644 --- a/.github/workflows/superlinter.yml +++ b/.github/workflows/superlinter.yml @@ -22,7 +22,7 @@ jobs: # Runs the Super-Linter action - name: Run Super-Linter - uses: github/super-linter@v4 + uses: github/super-linter@v5 env: DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 25b4c3a6340a7195fb1032e42ced2ec308e0adf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20Fern=C3=A1ndez?= Date: Tue, 22 Aug 2023 12:54:50 +0100 Subject: [PATCH 07/17] Update .github/workflows/superlinter.yml --- .github/workflows/superlinter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml index 6e24e73d..c08a0fed 100644 --- a/.github/workflows/superlinter.yml +++ b/.github/workflows/superlinter.yml @@ -22,7 +22,7 @@ jobs: # Runs the Super-Linter action - name: Run Super-Linter - uses: github/super-linter@v5 + uses: super-linter/super-linter/slim@v5 env: DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c31b5e7d652e20c76b9ff0396105a30ec6e05269 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:52 +0000 Subject: [PATCH 08/17] Bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/packages.yml | 6 +++--- .github/workflows/release.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 34ea7bab..3b6c75a1 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -24,7 +24,7 @@ jobs: id: version run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" - name: Upload output file - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sdist path: dist/*tar.gz @@ -64,7 +64,7 @@ jobs: done rpmlint RPMS/noarch/*.rpm - name: Upload rpms - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: rpms path: | @@ -105,7 +105,7 @@ jobs: mv debs/*.deb . mv ../*.deb . - name: Upload debs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: debs path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e60e8b28..4368df6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,7 +60,7 @@ jobs: id: version run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT" - name: Upload output file - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sdist path: dist/*tar.gz @@ -93,7 +93,7 @@ jobs: rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-opennebula.spec rpmlint RPMS/noarch/*.rpm - name: Upload rpms - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: rpms path: | @@ -131,7 +131,7 @@ jobs: mv debs/*.deb . mv ../*.deb . - name: Upload debs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: debs path: | From bda29625c97b6c2746830a938588131d9dddecb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:50 +0000 Subject: [PATCH 09/17] Bump actions/setup-python from 2 to 4 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/packages.yml | 2 +- .github/workflows/python.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 3b6c75a1..4fbf3a76 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -15,7 +15,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 - name: Build sdist run: | pip install tox diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e2f80ad2..f53cca61 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install Tox diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4368df6f..f8915673 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 - name: Build sdist run: | pip install tox From e79c97e201b515556e4a4014c5858302f292627a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:47 +0000 Subject: [PATCH 10/17] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/packages.yml | 2 +- .github/workflows/python.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 4fbf3a76..49dcc4ae 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -11,7 +11,7 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index f53cca61..2a9a4d8e 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -12,7 +12,7 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8915673..f160207c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python From 29d4022b22a9dd631aef203cfd952d8b0a129ea0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:49:54 +0000 Subject: [PATCH 11/17] Update bandit requirement from <=1.6.2,>=1.1.0 to >=1.1.0,<=1.7.5 Updates the requirements on [bandit](https://github.com/PyCQA/bandit) to permit the latest version. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.1.0...1.7.5) --- updated-dependencies: - dependency-name: bandit dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 5b1789c1..6ac59bc6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -bandit>=1.1.0,<=1.6.2 +bandit>=1.1.0,<=1.7.5 fixtures>=0.3.14 defusedxml # This is due to py2.7, could be removed in the future From a527ecc16a7d0ee79432c7b0bc93bb3485761975 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Tue, 22 Aug 2023 13:05:32 +0100 Subject: [PATCH 12/17] Add timeouts to requests --- cloud_info_provider/providers/mesos.py | 7 ++++++- cloud_info_provider/providers/onedata.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cloud_info_provider/providers/mesos.py b/cloud_info_provider/providers/mesos.py index 8d4c091e..dfab8811 100644 --- a/cloud_info_provider/providers/mesos.py +++ b/cloud_info_provider/providers/mesos.py @@ -95,7 +95,12 @@ def _update(old, new): # gather & update dynamic info for api_endp in self.api_endpoints: api_url = "/".join([self.framework_url, api_endp]) - r = requests.get(api_url, headers=self.headers, verify=self.cacert) + r = requests.get( + api_url, + headers=self.headers, + verify=self.cacert, + timeout=self.opts.timeout, + ) if r.status_code == requests.codes["ok"]: _update(ret["endpoints"][self.framework_url], r.json()) else: diff --git a/cloud_info_provider/providers/onedata.py b/cloud_info_provider/providers/onedata.py index a2168f4e..cb53c8b6 100644 --- a/cloud_info_provider/providers/onedata.py +++ b/cloud_info_provider/providers/onedata.py @@ -45,7 +45,7 @@ def get_site_info(self, **kwargs): def get_oneproviders_from_onezone(self): def _do_request(url): - r = requests.get(url, headers=self.headers) + r = requests.get(url, headers=self.headers, timeout=self.opts.timeout) if r.status_code == requests.codes["ok"]: return r.json() else: From b86f4e2391d0cc97d5506d64e0003eb4978e74c2 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Tue, 22 Aug 2023 13:53:29 +0100 Subject: [PATCH 13/17] Fix linter issues --- .github/CODE_OF_CONDUCT.md | 10 +- .github/workflows/superlinter.yml | 4 +- Jenkinsfile | 105 ------------------ .../opennebula_rocci_provider_images.json | 3 +- 4 files changed, 9 insertions(+), 113 deletions(-) delete mode 100644 Jenkinsfile diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 1f3888c0..9f857b2f 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -72,11 +72,11 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at contact@egi.eu. The project team will -review and investigate all complaints, and will respond in a way that it deems -appropriate to the circumstances. The project team is obligated to maintain -confidentiality with regard to the reporter of an incident. Further details of -specific enforcement policies may be posted separately. +reported by contacting the project team at [contact@egi.eu](mailto:contact@egi.eu). +The project team will review and investigate all complaints, and will respond +in a way that it deems appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an +incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml index c08a0fed..34e0d892 100644 --- a/.github/workflows/superlinter.yml +++ b/.github/workflows/superlinter.yml @@ -28,4 +28,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Fail on errors DISABLE_ERRORS: false - FILTER_REGEX_EXCLUDE: "(.*cloud_info_provider/.*/opennebula_rocci_provider_images.json|.*cloud_info_provider/tests/one_samples/*.xml)" + # we only have sample XMLs, avoid wasting resources + VALIDATE_XML: false + FILTER_REGEX_EXCLUDE: ".*tests.*samples.*.json" diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 515881ae..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/groovy - -pipeline { - agent { - label 'python' - } - - stages { - stage('Style Analysis') { - steps { - checkout scm - echo 'Running flake8..' - timeout(time: 5, unit: 'MINUTES') { - sh 'tox -e pep8' - echo 'Parsing pep8 logs..' - step([$class: 'WarningsPublisher', - parserConfigurations: [[ - parserName: 'Pep8', pattern: '.tox/pep8/log/*.log' - ]], unstableTotalAll: '0', usePreviousBuildAsReference: true - ]) - } - } - } - - stage('Unit tests') { - steps { - checkout scm - echo 'Computing unit testing coverage..' - sh 'tox -e cover' - - echo 'Generating Cobertura report..' - sh 'tox -e cobertura' - cobertura autoUpdateHealth: false, - autoUpdateStability: false, - coberturaReportFile: '**/coverage.xml', - conditionalCoverageTargets: '70, 0, 0', - failUnhealthy: false, - failUnstable: false, - lineCoverageTargets: '80, 0, 0', - maxNumberOfBuilds: 0, - methodCoverageTargets: '80, 0, 0', - onlyStable: false, - sourceEncoding: 'ASCII', - zoomCoverageChart: false - } - } - - stage('Build RPM/DEB packages') { - when { - anyOf { - buildingTag() - branch 'main' - } - } - parallel { - stage('Build on Ubuntu16.04') { - agent { - label 'bubuntu16' - } - steps { - checkout scm - echo 'Within build on Ubuntu16.04' - sh 'sudo apt-get update && sudo apt-get install -y devscripts debhelper python-all-dev python-pbr python-setuptools' - sh 'debuild --no-tgz-check clean binary' - dir("${WORKSPACE}/debs/cloud-info-provider-openstack") { - sh 'debuild --no-tgz-check clean binary' - } - dir("${WORKSPACE}/debs/cloud-info-provider-opennebula") { - sh 'debuild --no-tgz-check clean binary' - } - } - post { - success { - archiveArtifacts artifacts: '**/debs/*.deb' } - } - } - stage('Build on CentOS7') { - agent { - label 'bcentos7' - } - steps { - checkout scm - echo 'Within build on CentOS7' - sh 'sudo yum install -y centos-release-openstack-queens python-pbr' - sh 'python setup.py sdist' - sh 'mkdir ~/rpmbuild' - sh "echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros" - sh 'mkdir -p ~/rpmbuild/{SOURCES,SPECS}' - sh 'cp dist/cloud_info_provider*.tar.gz ~/rpmbuild/SOURCES/' - sh 'cp rpm/cloud-info-provider*.spec ~/rpmbuild/SPECS/' - sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider.spec' - sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider-openstack.spec' - sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider-opennebula.spec' - sh 'cp ~/rpmbuild/SRPMS/*.rpm ~/rpmbuild/RPMS/noarch/*.rpm ${WORKSPACE}/rpm/' - } - post { - success { - archiveArtifacts artifacts: '**/rpm/*.rpm' - } - } - } - } - } - } -} diff --git a/cloud_info_provider/tests/one_samples/opennebula_rocci_provider_images.json b/cloud_info_provider/tests/one_samples/opennebula_rocci_provider_images.json index 4ccdeed1..73c6626f 100644 --- a/cloud_info_provider/tests/one_samples/opennebula_rocci_provider_images.json +++ b/cloud_info_provider/tests/one_samples/opennebula_rocci_provider_images.json @@ -97,8 +97,7 @@ "image_os_version": null, "image_platform": "x86_64", "image_version": "20141029", - "other_info": [], - "other_info": []}, + "other_info": []}, "193": {"image_description": null, "image_id": "template#193", "image_marketplace_id": "https://appdb.egi.eu/store/vo/image/2f55ff2a-abe3-52b3-ad56-aded22a63fae:177/", From 2aeb6d361b8d30d8ddae97a96d611b2468bd0ea0 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Thu, 24 Aug 2023 08:20:08 +0100 Subject: [PATCH 14/17] Simplify release process And remove deprecated action --- .github/workflows/release.yml | 73 +++++------------------------------ 1 file changed, 9 insertions(+), 64 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f160207c..9df89caa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,17 +28,6 @@ jobs: file: CHANGELOG pattern: ${{ steps.extract-version.outputs.version }} no-print-matched-heading: true - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.extract-version.outputs.version }} - release_name: Release ${{ steps.extract-version.outputs.version }} - draft: false - prerelease: false - body: '${{ steps.extract-changelog.outputs.markdown }}' sdist: name: build python sdist @@ -150,57 +139,13 @@ jobs: - uses: actions/download-artifact@v3 with: name: rpms - - name: Upload base rpm - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_name: cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_content_type: application/octet-stream - - name: Upload opennebula rpm - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_name: cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_content_type: application/octet-stream - - name: Upload openstack rpm - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_name: cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - asset_content_type: application/octet-stream - - name: Upload base deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb - asset_name: python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb - asset_content_type: application/vnd.debian.binary-package - - name: Upload opennebula deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb - asset_name: python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb - asset_content_type: application/vnd.debian.binary-package - - name: Upload openstack deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 with: - upload_url: ${{ needs.prepare-release.outputs.upload_url }} - asset_path: ./python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb - asset_name: python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb - asset_content_type: application/vnd.debian.binary-package + tag_name: ${{ steps.extract-version.outputs.version }} + name: Release ${{ steps.extract-version.outputs.version }} + body: '${{ steps.extract-changelog.outputs.markdown }}' + files: | + cloud-info-provider*${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm + python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb From 8b51348855381a1b47279deb30ab45e1b596f5c9 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Thu, 24 Aug 2023 08:32:51 +0100 Subject: [PATCH 15/17] Fix release --- .github/workflows/release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9df89caa..b7b9bae5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,8 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} + version: ${{ steps.extract-version.outputs.version }} + changelog: ${{ steps.extract-changelog.outputs.markdown }} steps: - uses: actions/checkout@v3 - name: Extract version @@ -143,9 +144,9 @@ jobs: id: create_release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ steps.extract-version.outputs.version }} - name: Release ${{ steps.extract-version.outputs.version }} - body: '${{ steps.extract-changelog.outputs.markdown }}' + tag_name: ${{ needs.prepare-release.outputs.version }} + name: Release ${{ needs.prepare-release.outputs.version }} + body: '${{ needs.prepare-release.outputs.changelog }}' files: | cloud-info-provider*${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb From 172856af369b867bbbe1b32c662b7178e27f98f0 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Thu, 24 Aug 2023 08:42:46 +0100 Subject: [PATCH 16/17] Fix debian name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7b9bae5..8e8632d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -149,4 +149,4 @@ jobs: body: '${{ needs.prepare-release.outputs.changelog }}' files: | cloud-info-provider*${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm - python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb + python-cloud-info-provider*${{ needs.sdist.outputs.version }}-1_all.deb From 751494df71c0d33111d63624368d2c0374c138d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20Fern=C3=A1ndez?= Date: Tue, 5 Sep 2023 11:55:14 +0100 Subject: [PATCH 17/17] Update .github/workflows/pre-release.yml --- .github/workflows/pre-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 7cce2ce8..fd907817 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -31,7 +31,6 @@ jobs: - name: Extract version id: extract-version run: | - # this uses GNU sed -z! version=$(grep "^## \[[0-9].*\]" CHANGELOG | \ head -1 | sed -e "s/^.*\[\(.*\)\].*/\1/") echo "version=$version" >> "$GITHUB_OUTPUT"