diff --git a/.github/template_gitref b/.github/template_gitref index b11f949..5eb4b23 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-265-gbdd41dd +2021.08.26-290-g4d54366 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 364fd02..23b6cd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,32 +6,39 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Build +name: "Build" on: workflow_call: +defaults: + run: + working-directory: "pulp_npm" + jobs: build: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 1 - - uses: actions/setup-python@v4 + path: "pulp_npm" + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install packaging wheel + pip install packaging twine wheel echo ::endgroup:: - - name: Build package - run: python3 setup.py sdist bdist_wheel --python-tag py3 - - name: 'Upload Package whl' - uses: actions/upload-artifact@v3 + - name: "Build package" + run: | + python3 setup.py sdist bdist_wheel --python-tag py3 + twine check dist/* + - name: "Upload Package whl" + uses: "actions/upload-artifact@v3" with: - name: plugin_package - path: dist/ - if-no-files-found: error + name: "plugin_package" + path: "pulp_npm/dist/" + if-no-files-found: "error" retention-days: 5 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index fa72f3e..06774b7 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -6,53 +6,53 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Npm changelog update +name: "Npm changelog update" on: push: branches: - - main + - "main" paths: - - CHANGES.rst - - CHANGES.md + - "CHANGES.rst" + - "CHANGES.md" workflow_dispatch: jobs: update-changelog: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 1 - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS pip install -r doc_requirements.txt echo ::endgroup:: - - name: Fake api schema + - name: "Fake api schema" run: | mkdir -p docs/_build/html echo "{}" > docs/_build/html/api.json mkdir -p docs/_static echo "{}" > docs/_static/api.json - - name: + - name: "Build Docs" run: | - pip install "Jinja2<3.1" make diagrams html - working-directory: ./docs + working-directory: "./docs" env: PULP_CONTENT_ORIGIN: "http://localhost/" - - name: Publish changlog to pulpproject.org - run: .github/workflows/scripts/publish_docs.sh changelog ${GITHUB_REF##*/} + - name: "Publish changlog to pulpproject.org" + run: | + .github/workflows/scripts/publish_docs.sh changelog ${GITHUB_REF##*/} env: - PULP_DOCS_KEY: ${{ secrets.PULP_DOCS_KEY }} + PULP_DOCS_KEY: "${{ secrets.PULP_DOCS_KEY }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbcd710..d73e4d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,68 +6,72 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Npm CI +name: "Npm CI" on: {pull_request: {branches: ['*']}} concurrency: group: ${{ github.ref_name }}-${{ github.workflow }} cancel-in-progress: true -jobs: +defaults: + run: + working-directory: "pulp_npm" +jobs: ready-to-ship: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 0 - - uses: actions/setup-python@v4 + path: "pulp_npm" + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install requirements - run: pip3 install github - - name: Check commit message + - name: "Install python dependencies" + run: | + echo ::group::PYDEPS + pip install requests pygithub + echo ::endgroup:: + - name: "Check commit message" if: github.event_name == 'pull_request' env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - run: sh .github/workflows/scripts/check_commit.sh - - name: Verify requirements files - run: python .ci/scripts/check_requirements.py + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + run: | + .github/workflows/scripts/check_commit.sh + - name: "Verify requirements files" + run: | + python .ci/scripts/check_requirements.py lint: uses: "./.github/workflows/lint.yml" build: - needs: lint + needs: "lint" uses: "./.github/workflows/build.yml" test: - needs: build + needs: "build" uses: "./.github/workflows/test.yml" + deprecations: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" if: github.base_ref == 'main' - needs: test + needs: "test" steps: - - name: Fail on deprecations + - name: "Create working directory" run: | - test -z "${{ needs.test.outputs.deprecations-pulp }}" - test -z "${{ needs.test.outputs.deprecations-azure }}" - test -z "${{ needs.test.outputs.deprecations-s3 }}" - test -z "${{ needs.test.outputs.deprecations-lowerbounds }}" - - name: Print deprecations - if: failure() + mkdir -p "pulp_npm" + working-directory: "." + - name: "Download Deprecations" + uses: actions/download-artifact@v3 + with: + name: "deprecations" + path: "pulp_npm" + - name: "Print deprecations" run: | - echo "${{ needs.test.outputs.deprecations-pulp }}" | base64 -d - echo "${{ needs.test.outputs.deprecations-azure }}" | base64 -d - echo "${{ needs.test.outputs.deprecations-s3 }}" | base64 -d - echo "${{ needs.test.outputs.deprecations-lowerbounds }}" | base64 -d - - + cat deprecations-*.txt | sort -u + ! cat deprecations-*.txt | grep '[^[:space:]]' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 17042e0..a186575 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,13 +30,13 @@ jobs: language: [ 'python' ] steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index fae6d60..8dc716f 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -21,26 +21,27 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 0 - path: pulp_npm + path: "pulp_npm" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS pip install bump2version jinja2 pyyaml echo ::endgroup:: - - name: Setting secrets - working-directory: pulp_npm - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + - name: "Setting secrets" + working-directory: "pulp_npm" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} + SECRETS_CONTEXT: "${{ toJson(secrets) }}" - name: Determine new branch name working-directory: pulp_npm diff --git a/.github/workflows/kanban.yml b/.github/workflows/kanban.yml index ba28b1a..fde180e 100644 --- a/.github/workflows/kanban.yml +++ b/.github/workflows/kanban.yml @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest name: Find issues linked to a PR outputs: - linked-issues: ${{ steps.linked-issues.outputs.issues }} + linked-issues: ${{ steps.linked-issues.outputs.issues }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d20760a..28cd024 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,24 +6,37 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Lint +name: "Lint" on: workflow_call: +defaults: + run: + working-directory: "pulp_npm" + jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 1 - - uses: actions/setup-python@v4 + path: "pulp_npm" + + - uses: "actions/setup-python@v4" with: python-version: "3.8" - # lint_requirements contains tools needed for flake8, etc. - - name: Install requirements - run: pip3 install -r lint_requirements.txt + + - name: "Install python dependencies" + run: | + echo ::group::PYDEPS + pip install -r lint_requirements.txt + echo ::endgroup:: + + - name: Lint workflow files + run: | + yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows # run black separately from flake8 to get a diff - name: Run black diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index fe7fc3a..b3b0079 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,7 +6,7 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Npm Nightly CI +name: "Npm Nightly CI" on: schedule: # * is a special character in YAML so you have to quote this string @@ -14,184 +14,41 @@ on: - cron: '00 3 * * *' workflow_dispatch: +defaults: + run: + working-directory: "pulp_npm" + concurrency: - group: ${{ github.ref_name }}-${{ github.workflow }} + group: "${{ github.ref_name }}-${{ github.workflow }}" cancel-in-progress: true jobs: build: - uses: ./.github/workflows/build.yml + uses: "./.github/workflows/build.yml" test: - runs-on: ubuntu-latest - needs: build - - strategy: - fail-fast: false - matrix: - env: - - TEST: pulp - - TEST: docs - - TEST: azure - - TEST: s3 - - - TEST: generate-bindings - - TEST: lowerbounds - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - uses: actions/download-artifact@v3 - with: - name: plugin_package - path: dist/ - - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install httpie - run: | - echo ::group::HTTPIE - pip install httpie - echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV - - - name: Set environment variables - run: | - echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV - - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - uses: ruby/setup-ruby@v1 - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - with: - ruby-version: "2.6" - - - name: Install - run: .github/workflows/scripts/install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Before Script - run: .github/workflows/scripts/before_script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - REDIS_DISABLED: ${{ contains('', matrix.env.TEST) }} - - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} - - - name: Install Python client - run: .github/workflows/scripts/install_python_client.sh - shell: bash - - - name: Install Ruby client - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - run: .github/workflows/scripts/install_ruby_client.sh - shell: bash - - - name: Script - run: .github/workflows/scripts/script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Upload python client packages - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: python-client.tar - path: python-client.tar - - - name: Upload python client docs - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: python-client-docs.tar - path: python-client-docs.tar - - - name: Upload ruby client packages - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: ruby-client.tar - path: ruby-client.tar - - name: Upload built docs - if: ${{ env.TEST == 'docs' }} - uses: actions/upload-artifact@v3 - with: - name: docs.tar - path: docs/docs.tar - - - name: Logs - if: always() - run: | - echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" - http --timeout 30 --check-status --pretty format --print hb "https://pulp${PULP_API_ROOT}api/v3/status/" || true - docker images || true - docker ps -a || true - docker logs pulp || true - docker exec pulp ls -latr /etc/yum.repos.d/ || true - docker exec pulp cat /etc/yum.repos.d/* || true - docker exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" + needs: "build" + uses: "./.github/workflows/test.yml" changelog: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 0 + path: "pulp_npm" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.11" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS pip install gitpython toml echo ::endgroup:: - - name: Configure Git with pulpbot name and email + - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' @@ -203,131 +60,60 @@ jobs: uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.RELEASE_TOKEN }} - title: 'Update Changelog' - body: '' - branch: 'changelog/update' + title: "Update Changelog" + body: "" + branch: "changelog/update" delete-branch: true + path: "pulp_npm" publish: runs-on: ubuntu-latest needs: test - env: - TEST: publish - steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 1 + path: "pulp_npm" - uses: actions/download-artifact@v3 with: - name: plugin_package - path: dist/ + name: "plugin_package" + path: "pulp_npm/dist/" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.6" - - - name: Install httpie + - name: "Install python dependencies" run: | - echo ::group::HTTPIE - pip install httpie + echo ::group::PYDEPS + pip install requests 'packaging~=21.3' mkdocs pymdown-extensions 'Jinja2<3.1' echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV - - name: Set environment variables + - name: "Set environment variables" run: | echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV - - name: Install python dependencies - run: | - echo ::group::PYDEPS - pip install wheel - echo ::endgroup:: - - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install - run: .github/workflows/scripts/install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install Python client - run: .github/workflows/scripts/install_python_client.sh - shell: bash - - - name: Install Ruby client - run: .github/workflows/scripts/install_ruby_client.sh - shell: bash - - - name: Before Script - run: .github/workflows/scripts/before_script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - REDIS_DISABLED: ${{ contains('', matrix.env.TEST) }} - - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} - - - name: Download built docs uses: actions/download-artifact@v3 with: - name: docs.tar + name: "docs.tar" + path: "pulp_npm" - name: Download Python client docs uses: actions/download-artifact@v3 with: - name: python-client-docs.tar + name: "python-client-docs.tar" + path: "pulp_npm" + + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: "${{ toJson(secrets) }}" - name: Publish docs to pulpproject.org run: | tar -xvf docs.tar -C ./docs .github/workflows/scripts/publish_docs.sh nightly ${GITHUB_REF##*/} - - - - name: Logs - if: always() - run: | - echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" - http --timeout 30 --check-status --pretty format --print hb "https://pulp${PULP_API_ROOT}api/v3/status/" || true - docker images || true - docker ps -a || true - docker logs pulp || true - docker exec pulp ls -latr /etc/yum.repos.d/ || true - docker exec pulp cat /etc/yum.repos.d/* || true - docker exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index b1d0e4b..6ed8df3 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -16,7 +16,7 @@ on: # Static analysis should be fine however. concurrency: - group: ${{ github.ref_name }}-${{ github.workflow }} + group: ${{ github.event.pull_request.number }}-${{ github.workflow }} cancel-in-progress: true jobs: @@ -26,7 +26,7 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 0 - name: Commit Count Check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97f257c..b5ac6ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,145 +13,153 @@ on: release: description: "Release tag (e.g. 3.2.1)" -env: - RELEASE_WORKFLOW: true +defaults: + run: + working-directory: "pulp_npm" jobs: build-artifacts: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" with: fetch-depth: 0 + path: "pulp_npm" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install packaging~=21.3 bump2version gitpython towncrier==19.9.0 wheel requests + pip install 'packaging~=21.3' bump2version gitpython towncrier wheel requests echo ::endgroup:: - - name: Configure Git with pulpbot name and email + - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} + SECRETS_CONTEXT: "${{ toJson(secrets) }}" - - name: Create the release commit, tag it, create a post-release commit, and build plugin package - run: python .github/workflows/scripts/release.py ${{ github.event.inputs.release }} + - name: "Create the release commit, tag it, create a post-release commit, and build plugin package" + run: | + python .github/workflows/scripts/release.py ${{ github.event.inputs.release }} - - name: 'Tar files' - run: tar -cvf pulp_npm.tar . + - name: "Upload Package whl" + uses: "actions/upload-artifact@v3" + with: + name: "plugin_package" + path: "pulp_npm/dist/" + if-no-files-found: "error" - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 + - name: "Tar files" + run: | + tar -cvf pulp_npm.tar . + + - name: "Upload Artifact" + uses: "actions/upload-artifact@v3" with: - name: pulp_npm.tar - path: pulp_npm.tar + name: "pulp_npm.tar" + path: "pulp_npm/pulp_npm.tar" build-bindings-docs: - needs: build-artifacts - runs-on: ubuntu-latest + needs: + - "build-artifacts" + runs-on: "ubuntu-latest" # Install scripts expect TEST to be set, 'docs' is most appropriate even though we don't run tests env: - TEST: docs + TEST: "docs" steps: - - uses: actions/download-artifact@v3 + - uses: "actions/download-artifact@v3" with: - name: pulp_npm.tar + name: "pulp_npm.tar" + path: "pulp_npm/" - - uses: actions/setup-python@v4 + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + repository: "pulp/pulp-openapi-generator" + path: "pulp-openapi-generator" + + - uses: "actions/setup-python@v4" with: python-version: "3.8" - uses: ruby/setup-ruby@v1 with: ruby-version: "2.6" - - name: Untar repository + - name: "Untar repository" run: | tar -xf pulp_npm.tar - # update to the branch's latest ci files rather than the ones from the release tag. this is - # helpful when there was a problem with the ci files during the release which needs to be - # fixed after the release tag has been created - - name: Update ci files - run: | - git checkout "origin/${GITHUB_REF##*/}" -- .ci - git checkout "origin/${GITHUB_REF##*/}" -- .github - - - name: Install httpie + - name: "Install python dependencies" run: | - echo ::group::HTTPIE - pip install httpie + echo ::group::PYDEPS + pip install towncrier twine wheel httpie docker netaddr boto3 ansible mkdocs + echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_npm/.ci/assets/httpie/" >> $GITHUB_ENV echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV # Building the bindings and docs requires accessing the OpenAPI specs endpoint, so we need to # setup the Pulp instance. - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash + - name: "Before Install" + run: | + .github/workflows/scripts/before_install.sh + shell: "bash" env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + + - name: "Install" run: | - export PLUGIN_VERSION=${{ github.event.inputs.release }} .github/workflows/scripts/install.sh + shell: "bash" env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - shell: bash - - - name: Install Python client - run: .github/workflows/scripts/install_python_client.sh - shell: bash - - name: Install Ruby client - run: .github/workflows/scripts/install_ruby_client.sh - shell: bash - - - name: Upload python client packages - uses: actions/upload-artifact@v3 + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + + - name: "Install Python client" + run: | + .github/workflows/scripts/install_python_client.sh + shell: "bash" + - name: "Install Ruby client" + run: | + .github/workflows/scripts/install_ruby_client.sh + shell: "bash" + - name: "Upload python client packages" + uses: "actions/upload-artifact@v3" with: - name: python-client.tar - path: python-client.tar + name: "python-client.tar" + path: "pulp_npm/npm-python-client.tar" + if-no-files-found: "error" - - name: Upload python client docs - uses: actions/upload-artifact@v3 + - name: "Upload python client docs" + uses: "actions/upload-artifact@v3" with: - name: python-client-docs.tar - path: python-client-docs.tar - - name: Upload ruby client packages - uses: actions/upload-artifact@v3 + name: "python-client-docs.tar" + path: "pulp_npm/npm-python-client-docs.tar" + if-no-files-found: "error" + - name: "Upload ruby client packages" + uses: "actions/upload-artifact@v3" with: - name: ruby-client.tar - path: ruby-client.tar + name: "ruby-client.tar" + path: "pulp_npm/npm-ruby-client.tar" + if-no-files-found: "error" - name: Build docs run: | export DJANGO_SETTINGS_MODULE=pulpcore.app.settings @@ -159,13 +167,13 @@ jobs: make -C docs/ PULP_URL="https://pulp" diagrams html tar -cvf docs/docs.tar docs/_build - - name: Upload built docs + - name: "Upload built docs" uses: actions/upload-artifact@v3 with: - name: docs.tar - path: docs/docs.tar + name: "docs.tar" + path: "pulp_npm/docs/docs.tar" - - name: Logs + - name: "Logs" if: always() run: | echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" @@ -178,93 +186,228 @@ jobs: docker exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" - publish: - runs-on: ubuntu-latest - needs: build-bindings-docs + publish-tag: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" env: - TEST: publish - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" steps: - - uses: actions/download-artifact@v3 + - uses: "actions/download-artifact@v3" with: - name: pulp_npm.tar + name: "pulp_npm.tar" + path: "pulp_npm/" - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.6" + - name: "Untar repository" + run: | + tar -xf pulp_npm.tar - - name: Configure Git with pulpbot name and email + - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' - - name: Untar repository + - name: "Setting secrets" run: | - tar -xf pulp_npm.tar + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: "${{ toJson(secrets) }}" + + - name: "Push branch and tag to GitHub" + run: | + bash .github/workflows/scripts/push_branch_and_tag_to_github.sh ${{ github.event.inputs.release }} + publish-package: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" + - "publish-tag" + + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + steps: + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + path: "pulp_npm" + + - uses: "actions/download-artifact@v3" + with: + name: "plugin_package" + path: "pulp_npm/dist/" + + - uses: "actions/setup-python@v4" + with: + python-version: "3.8" - # update to the branch's latest ci files rather than the ones from the release tag. this is - # helpful when there was a problem with the ci files during the release which needs to be - # fixed after the release tag has been created - - name: Update ci files + - name: "Install python dependencies" run: | - git checkout "origin/${GITHUB_REF##*/}" -- .ci - git checkout "origin/${GITHUB_REF##*/}" -- .github + echo ::group::PYDEPS + pip install twine + echo ::endgroup:: - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} + SECRETS_CONTEXT: "${{ toJson(secrets) }}" - - name: Install python dependencies + - name: "Deploy plugin to pypi" + run: | + .github/workflows/scripts/publish_plugin_pypi.sh ${{ github.event.inputs.release }} + publish-python-bindings: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" + - "publish-tag" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + steps: + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + path: "pulp_npm" + + - name: "Download Python client" + uses: "actions/download-artifact@v3" + with: + name: "python-client.tar" + path: "pulp_npm/" + + - name: "Untar python client packages" + run: | + tar -xvf npm-python-client.tar + + - uses: "actions/setup-python@v4" + with: + python-version: "3.8" + + - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install gitpython requests packaging~=21.3 tweepy + pip install twine echo ::endgroup:: - - name: Push branch and tag to GitHub - run: bash .github/workflows/scripts/push_branch_and_tag_to_github.sh ${{ github.event.inputs.release }} - - name: Download built docs - uses: actions/download-artifact@v3 + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: "${{ toJson(secrets) }}" + + - name: "Publish client to pypi" + run: | + bash .github/workflows/scripts/publish_client_pypi.sh ${{ github.event.inputs.release }} + publish-ruby-bindings: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" + - "publish-tag" + + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + steps: + - uses: "actions/checkout@v4" with: - name: docs.tar + fetch-depth: 1 + path: "pulp_npm" - - name: Download Python client docs - uses: actions/download-artifact@v3 + - name: "Download Ruby client" + uses: "actions/download-artifact@v3" with: - name: python-client-docs.tar + name: "ruby-client.tar" + path: "pulp_npm/" - - name: Publish docs to pulpproject.org + - name: "Untar Ruby client packages" run: | - tar -xvf docs.tar - .github/workflows/scripts/publish_docs.sh tag ${{ github.event.inputs.release }} - - name: Deploy plugin to pypi - run: bash .github/workflows/scripts/publish_plugin_pypi.sh ${{ github.event.inputs.release }} - - name: Download Python client - uses: actions/download-artifact@v3 + tar -xvf npm-ruby-client.tar + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.6" + + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: "${{ toJson(secrets) }}" + + - name: "Publish client to rubygems" + run: | + bash .github/workflows/scripts/publish_client_gem.sh ${{ github.event.inputs.release }} + publish-docs: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" + - "publish-tag" + + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + steps: + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + path: "pulp_npm" + + - uses: "actions/setup-python@v4" with: - name: python-client.tar + python-version: "3.8" + + - name: "Install python dependencies" + run: | + echo ::group::PYDEPS + pip install 'packaging~=21.3' requests + echo ::endgroup:: + + - name: "Setting secrets" + run: | + python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: "${{ toJson(secrets) }}" - - name: Untar python client packages - run: tar -xvf python-client.tar + - name: "Download built docs" + uses: "actions/download-artifact@v3" + with: + name: "docs.tar" + path: "pulp_npm/" - - name: Publish client to pypi - run: bash .github/workflows/scripts/publish_client_pypi.sh - - name: Download Ruby client - uses: actions/download-artifact@v3 + - name: "Download Python client docs" + uses: "actions/download-artifact@v3" with: - name: ruby-client.tar + name: "python-client-docs.tar" + path: "pulp_npm/" - - name: Untar Ruby client packages - run: tar -xvf ruby-client.tar + - name: "Publish docs to pulpproject.org" + run: | + tar -xvf docs.tar + .github/workflows/scripts/publish_docs.sh tag ${{ github.event.inputs.release }} - - name: Publish client to rubygems - run: bash .github/workflows/scripts/publish_client_gem.sh + create-gh-release: + runs-on: "ubuntu-latest" + needs: + - "build-bindings-docs" + - "publish-tag" + - "publish-package" + - "publish-python-bindings" + - "publish-ruby-bindings" + - "publish-docs" - - name: Create release on GitHub - run: bash .github/workflows/scripts/create_release_from_tag.sh ${{ github.event.inputs.release }} + steps: + - name: "Create release on GitHub" + uses: "actions/github-script@v7" + env: + TAG_NAME: "${{ inputs.release }}" + with: + script: | + const { TAG_NAME } = process.env; + + await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: TAG_NAME, + make_latest: "legacy", + }); diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index 051a3a3..441f42b 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -55,14 +55,6 @@ then echo $COMMIT_MSG | sed -n -e 's/.*CI Base Image:\s*\([-_/[:alnum:]]*:[-_[:alnum:]]*\).*/ci_base: "\1"/p' >> .ci/ansible/vars/main.yaml fi - -cd .. - -git clone --depth=1 https://github.com/pulp/pulp-openapi-generator.git - -# Intall requirements for ansible playbooks -pip install docker netaddr boto3 ansible - for i in {1..3} do ansible-galaxy collection install "amazon.aws:1.5.0" && s=0 && break || s=$? && sleep 3 @@ -73,8 +65,6 @@ then exit $s fi -cd pulp_npm - if [[ "$TEST" = "lowerbounds" ]]; then python3 .ci/scripts/calc_deps_lowerbounds.py > lowerbounds_requirements.txt mv lowerbounds_requirements.txt requirements.txt diff --git a/.github/workflows/scripts/check_commit.sh b/.github/workflows/scripts/check_commit.sh index 947e5d8..34f9fe8 100755 --- a/.github/workflows/scripts/check_commit.sh +++ b/.github/workflows/scripts/check_commit.sh @@ -8,20 +8,13 @@ # For more info visit https://github.com/pulp/plugin_template # make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. +cd "$(dirname "$(realpath -e "$0")")/../../.." set -euv -echo ::group::REQUESTS -pip3 install requests - -pip3 install pygithub - -echo ::endgroup:: - -for sha in $(curl -H "Authorization: token $GITHUB_TOKEN" $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g') +for SHA in $(curl -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_CONTEXT" | jq -r '.[].sha') do - python3 .ci/scripts/validate_commit_message.py $sha + python3 .ci/scripts/validate_commit_message.py "$SHA" VALUE=$? if [ "$VALUE" -gt 0 ]; then exit $VALUE diff --git a/.github/workflows/scripts/install_python_client.sh b/.github/workflows/scripts/install_python_client.sh index 573e728..a4c96db 100755 --- a/.github/workflows/scripts/install_python_client.sh +++ b/.github/workflows/scripts/install_python_client.sh @@ -9,45 +9,49 @@ set -mveuo pipefail -export PULP_URL="${PULP_URL:-https://pulp}" - # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. -pip install twine wheel - -export REPORTED_VERSION=$(http $PULP_URL/pulp/api/v3/status/ | jq --arg plugin npm --arg legacy_plugin pulp_npm -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version') -export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" -if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then - export VERSION=${REPORTED_VERSION} -else - export EPOCH="$(date +%s)" - export VERSION=${REPORTED_VERSION}${EPOCH} -fi - -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-npm-client/$VERSION/) - -if [ "$response" == "200" ]; -then - echo "pulp_npm client $VERSION has already been released. Installing from PyPI." - docker exec pulp pip3 install pulp-npm-client==$VERSION - mkdir -p dist - tar cvf python-client.tar ./dist - exit -fi - -cd ../pulp-openapi-generator +source .github/workflows/scripts/utils.sh + +export PULP_URL="${PULP_URL:-https://pulp}" + +REPORTED_STATUS="$(pulp status)" +REPORTED_VERSION="$(echo "$REPORTED_STATUS" | jq --arg plugin "npm" -r '.versions[] | select(.component == $plugin) | .version')" +VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')" + +pushd ../pulp-openapi-generator rm -rf pulp_npm-client -./generate.sh pulp_npm python $VERSION -cd pulp_npm-client +./generate.sh pulp_npm python "$VERSION" +pushd pulp_npm-client python setup.py sdist bdist_wheel --python-tag py3 -find . -name "*.whl" -exec docker exec pulp pip3 install /root/pulp-openapi-generator/pulp_npm-client/{} \; -tar cvf ../../pulp_npm/python-client.tar ./dist + +twine check "dist/pulp_npm_client-$VERSION-py3-none-any.whl" +twine check "dist/pulp_npm-client-$VERSION.tar.gz" + +cmd_prefix pip3 install "/root/pulp-openapi-generator/pulp_npm-client/dist/pulp_npm_client-${VERSION}-py3-none-any.whl" +tar cvf ../../pulp_npm/npm-python-client.tar ./dist find ./docs/* -exec sed -i 's/Back to README/Back to HOME/g' {} \; find ./docs/* -exec sed -i 's/README//g' {} \; cp README.md docs/index.md sed -i 's/docs\///g' docs/index.md find ./docs/* -exec sed -i 's/\.md//g' {} \; -tar cvf ../../pulp_npm/python-client-docs.tar ./docs -exit $? + +cat >> mkdocs.yml << DOCSYAML +--- +site_name: PulpNpm Client +site_description: Npm bindings +site_author: Pulp Team +site_url: https://docs.pulpproject.org/pulp_npm_client/ +repo_name: pulp/pulp_npm +repo_url: https://github.com/pulp/pulp_npm +theme: readthedocs +DOCSYAML + +# Building the bindings docs +mkdocs build + +tar cvf ../../pulp_npm/npm-python-client-docs.tar ./docs +popd +popd diff --git a/.github/workflows/scripts/install_ruby_client.sh b/.github/workflows/scripts/install_ruby_client.sh index 068b340..f61e1c4 100755 --- a/.github/workflows/scripts/install_ruby_client.sh +++ b/.github/workflows/scripts/install_ruby_client.sh @@ -7,37 +7,26 @@ # # For more info visit https://github.com/pulp/plugin_template -set -euv +set -mveuo pipefail # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. +source .github/workflows/scripts/utils.sh + export PULP_URL="${PULP_URL:-https://pulp}" -export REPORTED_VERSION=$(http $PULP_URL/pulp/api/v3/status/ | jq --arg plugin npm --arg legacy_plugin pulp_npm -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version') -export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" -if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then - export VERSION=${REPORTED_VERSION} -else - export EPOCH="$(date +%s)" - export VERSION=${REPORTED_VERSION}${EPOCH} -fi - -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://rubygems.org/gems/pulp_npm_client/versions/$VERSION) - -if [ "$response" == "200" ]; -then - echo "pulp_npm client $VERSION has already been released. Installing from RubyGems.org." - gem install pulp_npm_client -v $VERSION - touch pulp_npm_client-$VERSION.gem - tar cvf ruby-client.tar ./pulp_npm_client-$VERSION.gem - exit -fi - -cd ../pulp-openapi-generator + +REPORTED_STATUS="$(pulp status)" +REPORTED_VERSION="$(echo "$REPORTED_STATUS" | jq --arg plugin "npm" -r '.versions[] | select(.component == $plugin) | .version')" +VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')" + +pushd ../pulp-openapi-generator rm -rf pulp_npm-client -./generate.sh pulp_npm ruby $VERSION -cd pulp_npm-client +./generate.sh pulp_npm ruby "$VERSION" +pushd pulp_npm-client gem build pulp_npm_client -gem install --both ./pulp_npm_client-$VERSION.gem -tar cvf ../../pulp_npm/ruby-client.tar ./pulp_npm_client-$VERSION.gem +gem install --both "./pulp_npm_client-$VERSION.gem" +tar cvf ../../pulp_npm/npm-ruby-client.tar "./pulp_npm_client-$VERSION.gem" +popd +popd diff --git a/.github/workflows/scripts/publish_client_gem.sh b/.github/workflows/scripts/publish_client_gem.sh index 1043de1..80dd40f 100755 --- a/.github/workflows/scripts/publish_client_gem.sh +++ b/.github/workflows/scripts/publish_client_gem.sh @@ -12,27 +12,24 @@ set -euv # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. - -mkdir ~/.gem || true -touch ~/.gem/credentials -echo "--- -:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials -sudo chmod 600 ~/.gem/credentials - -export VERSION=$(ls pulp_npm_client* | sed -rn 's/pulp_npm_client-(.*)\.gem/\1/p') +VERSION="$1" if [[ -z "$VERSION" ]]; then - echo "No client package found." - exit + echo "No version specified." + exit 1 fi -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://rubygems.org/gems/pulp_npm_client/versions/$VERSION) +RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://rubygems.org/gems/pulp_npm_client/versions/$VERSION")" -if [ "$response" == "200" ]; +if [ "$RESPONSE" == "200" ]; then echo "pulp_npm client $VERSION has already been released. Skipping." exit fi -GEM_FILE="$(ls pulp_npm_client-*)" -gem push ${GEM_FILE} +mkdir -p ~/.gem +touch ~/.gem/credentials +echo "--- +:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials +sudo chmod 600 ~/.gem/credentials +gem push "pulp_npm_client-${VERSION}.gem" diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh index 8b90026..df9f611 100755 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ b/.github/workflows/scripts/publish_client_pypi.sh @@ -10,28 +10,24 @@ set -euv # make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. +cd "$(dirname "$(realpath -e "$0")")/../../.." -pip install twine - -export VERSION=$(ls dist | sed -rn 's/pulp_npm-client-(.*)\.tar.gz/\1/p') +VERSION="$1" if [[ -z "$VERSION" ]]; then - echo "No client package found." - exit + echo "No version specified." + exit 1 fi -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-npm-client/$VERSION/) +RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulp-npm-client/$VERSION/")" -if [ "$response" == "200" ]; +if [ "$RESPONSE" == "200" ]; then echo "pulp_npm client $VERSION has already been released. Skipping." exit fi -twine check dist/pulp_npm_client-$VERSION-py3-none-any.whl || exit 1 -twine check dist/pulp_npm-client-$VERSION.tar.gz || exit 1 -twine upload dist/pulp_npm_client-$VERSION-py3-none-any.whl -u pulp -p $PYPI_PASSWORD -twine upload dist/pulp_npm-client-$VERSION.tar.gz -u pulp -p $PYPI_PASSWORD - -exit $? +twine upload -u pulp -p "$PYPI_PASSWORD" \ +"dist/pulp_npm_client-$VERSION-py3-none-any.whl" \ +"dist/pulp_npm-client-$VERSION.tar.gz" \ +; diff --git a/.github/workflows/scripts/publish_docs.sh b/.github/workflows/scripts/publish_docs.sh index d44bbc9..6a144dc 100755 --- a/.github/workflows/scripts/publish_docs.sh +++ b/.github/workflows/scripts/publish_docs.sh @@ -10,7 +10,7 @@ set -euv # make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. +cd "$(dirname "$(realpath -e "$0")")/../../.." mkdir ~/.ssh touch ~/.ssh/pulp-infra @@ -20,44 +20,29 @@ echo "$PULP_DOCS_KEY" > ~/.ssh/pulp-infra echo "docs.pulpproject.org,8.43.85.236 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGXG+8vjSQvnAkq33i0XWgpSrbco3rRqNZr0SfVeiqFI7RN/VznwXMioDDhc+hQtgVhd6TYBOrV07IMcKj+FAzg=" >> ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts -pip3 install packaging - export PYTHONUNBUFFERED=1 export DJANGO_SETTINGS_MODULE=pulpcore.app.settings export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py export WORKSPACE=$PWD -eval "$(ssh-agent -s)" #start the ssh agent +# start the ssh agent +eval "$(ssh-agent -s)" ssh-add ~/.ssh/pulp-infra -python3 .github/workflows/scripts/docs-publisher.py --build-type $1 --branch $2 +python3 .github/workflows/scripts/docs-publisher.py --build-type "$1" --branch "$2" if [[ "$GITHUB_WORKFLOW" == "Npm changelog update" ]]; then # Do not build bindings docs on changelog update exit fi -pip install mkdocs pymdown-extensions "Jinja2<3.1" - -mkdir -p ../bindings -tar -xvf python-client-docs.tar --directory ../bindings -cd ../bindings -cat >> mkdocs.yml << DOCSYAML ---- -site_name: PulpNpm Client -site_description: Npm bindings -site_author: Pulp Team -site_url: https://docs.pulpproject.org/pulp_npm_client/ -repo_name: pulp/pulp_npm -repo_url: https://github.com/pulp/pulp_npm -theme: readthedocs -DOCSYAML - -# Building the bindings docs -mkdocs build +mkdir -p ../npm-bindings +tar -xvf npm-python-client-docs.tar --directory ../npm-bindings +pushd ../npm-bindings # publish to docs.pulpproject.org/pulp_npm_client rsync -avzh site/ doc_builder_pulp_npm@docs.pulpproject.org:/var/www/docs.pulpproject.org/pulp_npm_client/ # publish to docs.pulpproject.org/pulp_npm_client/en/{release} rsync -avzh site/ doc_builder_pulp_npm@docs.pulpproject.org:/var/www/docs.pulpproject.org/pulp_npm_client/en/"$2" +popd diff --git a/.github/workflows/scripts/publish_plugin_pypi.sh b/.github/workflows/scripts/publish_plugin_pypi.sh index b36f0a1..7508ad5 100755 --- a/.github/workflows/scripts/publish_plugin_pypi.sh +++ b/.github/workflows/scripts/publish_plugin_pypi.sh @@ -7,23 +7,27 @@ # # For more info visit https://github.com/pulp/plugin_template +set -euv + # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. -set -euv +VERSION="$1" -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-npm/$1/) -if [ "$response" == "200" ]; -then - echo "pulp_npm $1 has already been released. Skipping." - exit +if [[ -z "$VERSION" ]]; then + echo "No version specified." + exit 1 fi -pip install twine +RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulp-npm/$VERSION/")" -twine check dist/pulp_npm-$1-py3-none-any.whl || exit 1 -twine check dist/pulp-npm-$1.tar.gz || exit 1 -twine upload dist/pulp_npm-$1-py3-none-any.whl -u pulp -p $PYPI_PASSWORD -twine upload dist/pulp-npm-$1.tar.gz -u pulp -p $PYPI_PASSWORD +if [ "$RESPONSE" == "200" ]; +then + echo "pulp_npm $VERSION has already been released. Skipping." + exit +fi -exit $? +twine upload -u pulp -p "$PYPI_PASSWORD" \ +"dist/pulp_npm-$VERSION-py3-none-any.whl" \ +"dist/pulp-npm-$VERSION.tar.gz" \ +; diff --git a/.github/workflows/scripts/release.py b/.github/workflows/scripts/release.py index e56c070..e31c00c 100755 --- a/.github/workflows/scripts/release.py +++ b/.github/workflows/scripts/release.py @@ -48,7 +48,7 @@ def create_release_commits(repo, release_version, plugin_path): issues = ",".join(issues_to_close) # First commit: changelog - os.system(f"towncrier --yes --version {release_version}") + os.system(f"towncrier build --yes --version {release_version}") git = repo.git git.add("CHANGES.rst") git.add("CHANGES/*") diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index 741665c..1b099f8 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -12,7 +12,6 @@ set -mveuo pipefail # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. -REPO_ROOT="$PWD" source .github/workflows/scripts/utils.sh @@ -30,73 +29,64 @@ export PULP_URL="https://pulp" if [[ "$TEST" = "docs" ]]; then if [[ "$GITHUB_WORKFLOW" == "Npm CI" ]]; then - pip install towncrier==19.9.0 - towncrier --yes --version 4.0.0.ci + towncrier build --yes --version 4.0.0.ci fi cd docs make PULP_URL="$PULP_URL" diagrams html tar -cvf docs.tar ./_build cd .. - if [ -f $POST_DOCS_TEST ]; then - source $POST_DOCS_TEST + if [ -f "$POST_DOCS_TEST" ]; then + source "$POST_DOCS_TEST" fi exit fi REPORTED_STATUS="$(pulp status)" -if [[ "${RELEASE_WORKFLOW:-false}" == "true" ]]; then - # TODO Move this to prerelease checks - REPORTED_VERSION="$(echo $REPORTED_STATUS | jq --arg plugin npm --arg legacy_plugin pulp_npm -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version')" - response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulp-npm/$REPORTED_VERSION/) - if [ "$response" == "200" ]; - then - echo "pulp_npm $REPORTED_VERSION has already been released. Skipping running tests." - exit - fi -fi - echo "machine pulp login admin password password " | cmd_user_stdin_prefix bash -c "cat >> ~pulp/.netrc" # Some commands like ansible-galaxy specifically require 600 -cmd_user_stdin_prefix bash -c "chmod 600 ~pulp/.netrc" +cmd_prefix bash -c "chmod 600 ~pulp/.netrc" + +# Infer the client name from the package name by replacing "-" with "_". +# Use the component to infer the package name on older versions of pulpcore. -cd ../pulp-openapi-generator -if [ "$(echo "$REPORTED_STATUS" | jq -r '.versions[0].package')" = "null" ] +if [ "$(echo "$REPORTED_STATUS" | jq -r '.domain_enabled')" = "true" ] then - # We are on an old version of pulpcore without package in the status report - for app_label in $(echo "$REPORTED_STATUS" | jq -r '.versions[].component') + # Workaround: Domains are not supported by the published bindings. + # Generate new bindings for all packages. + pushd ../pulp-openapi-generator + for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")') do - if [ "$app_label" = "core" ] - then - item=pulpcore - else - item="pulp_${app_label}" - fi ./generate.sh "${item}" python cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" sudo rm -rf "./${item}-client" done + popd else - for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[].package|sub("-"; "_")') + # Sadly: Different pulpcore-versions aren't either... + pushd ../pulp-openapi-generator + for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|select(.component!="npm")|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")') do ./generate.sh "${item}" python cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" sudo rm -rf "./${item}-client" done + popd fi -cd $REPO_ROOT - -cat unittest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt" -cat functest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt" -cmd_prefix pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt +# At this point, this is a safeguard only, so let's not make too much fuzz about the old status format. +echo "$REPORTED_STATUS" | jq -r '.versions[]|select(.package)|(.package|sub("_"; "-")) + "-client==" + .version' > bindings_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt" < unittest_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt" < functest_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/bindings_requirements.txt" < bindings_requirements.txt +cmd_prefix pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt -r /tmp/bindings_requirements.txt CERTIFI=$(cmd_prefix python3 -c 'import certifi; print(certifi.where())') -cmd_prefix bash -c "cat /etc/pulp/certs/pulp_webserver.crt | tee -a "$CERTIFI" > /dev/null" +cmd_prefix bash -c "cat /etc/pulp/certs/pulp_webserver.crt >> '$CERTIFI'" # check for any uncommitted migrations echo "Checking for uncommitted migrations..." @@ -110,13 +100,13 @@ if [[ "$TEST" == "performance" ]]; then if [[ -z ${PERFORMANCE_TEST+x} ]]; then cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_npm.tests.performance" else - cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_npm.tests.performance.test_$PERFORMANCE_TEST" + cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_npm.tests.performance.test_${PERFORMANCE_TEST}" fi exit fi -if [ -f $FUNC_TEST_SCRIPT ]; then - source $FUNC_TEST_SCRIPT +if [ -f "$FUNC_TEST_SCRIPT" ]; then + source "$FUNC_TEST_SCRIPT" else if [[ "$GITHUB_WORKFLOW" == "Npm Nightly CI/CD" ]] then @@ -129,6 +119,6 @@ else fi fi -if [ -f $POST_SCRIPT ]; then - source $POST_SCRIPT +if [ -f "$POST_SCRIPT" ]; then + source "$POST_SCRIPT" fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9748f77..b8be031 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,13 +6,17 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Test +name: "Test" on: workflow_call: +defaults: + run: + working-directory: "pulp_npm" + jobs: test: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: @@ -22,101 +26,138 @@ jobs: - TEST: azure - TEST: s3 - TEST: lowerbounds - outputs: - deprecations-pulp: ${{ steps.deprecations.outputs.deprecations-pulp }} - deprecations-azure: ${{ steps.deprecations.outputs.deprecations-azure }} - deprecations-s3: ${{ steps.deprecations.outputs.deprecations-s3 }} - deprecations-lowerbounds: ${{ steps.deprecations.outputs.deprecations-lowerbounds }} steps: - - uses: actions/checkout@v4 + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + path: "pulp_npm" + + - uses: "actions/checkout@v4" with: fetch-depth: 1 + repository: "pulp/pulp-openapi-generator" + path: "pulp-openapi-generator" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - uses: actions/download-artifact@v3 + - uses: "actions/download-artifact@v3" with: - name: plugin_package - path: dist/ + name: "plugin_package" + path: "pulp_npm/dist/" - - name: Install httpie + - name: "Install python dependencies" run: | - echo ::group::HTTPIE - pip install httpie + echo ::group::PYDEPS + pip install towncrier twine wheel httpie docker netaddr boto3 ansible mkdocs + echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_npm/.ci/assets/httpie/" >> $GITHUB_ENV echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV - - name: Set environment variables + - name: "Set environment variables" run: | echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install - run: .github/workflows/scripts/install.sh - shell: bash + - name: "Before Install" + run: | + .github/workflows/scripts/before_install.sh + shell: "bash" env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Before Script - run: .github/workflows/scripts/before_script.sh - shell: bash + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + - uses: ruby/setup-ruby@v1 + if: ${{ env.TEST == 'pulp' }} + with: + ruby-version: "2.6" + + - name: "Install" + run: | + .github/workflows/scripts/install.sh + shell: "bash" env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - REDIS_DISABLED: ${{ contains('', matrix.env.TEST) }} - - - name: Setting secrets - if: github.event_name != 'pull_request' - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + + - name: "Before Script" + run: | + .github/workflows/scripts/before_script.sh + shell: "bash" env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + REDIS_DISABLED: "${{ contains('', matrix.env.TEST) }}" - - name: Script - run: .github/workflows/scripts/script.sh - shell: bash + - name: "Install Python client" + run: | + .github/workflows/scripts/install_python_client.sh + shell: "bash" + - name: "Install Ruby client" + if: "${{ env.TEST == 'pulp' }}" + run: | + .github/workflows/scripts/install_ruby_client.sh + shell: "bash" + + - name: "Script" + run: | + .github/workflows/scripts/script.sh + shell: "bash" env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Extract Deprecations from Logs - id: deprecations - run: echo deprecations-${{ matrix.env.TEST }}=$(docker logs pulp 2>&1 | grep -i pulpcore.deprecation | base64 -w 0) >> $GITHUB_OUTPUT - - - name: Logs + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" + + - name: "Extract Deprecations from Logs" + run: | + docker logs pulp 2>&1 | grep -i pulpcore.deprecation | tee deprecations-${{ matrix.env.TEST }}.txt + + - name: "Upload Deprecations" + uses: actions/upload-artifact@v3 + with: + name: "deprecations" + path: "pulp_npm/deprecations-${{ matrix.env.TEST }}.txt" + if-no-files-found: "error" + retention-days: 5 + - name: Upload python client packages + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "python-client.tar" + path: "pulp_npm/npm-python-client.tar" + if-no-files-found: "error" + retention-days: 5 + + - name: Upload python client docs + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "python-client-docs.tar" + path: "pulp_npm/npm-python-client-docs.tar" + if-no-files-found: "error" + retention-days: 5 + - name: Upload Ruby client + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "ruby-client.tar" + path: "pulp_npm/npm-ruby-client.tar" + if-no-files-found: "error" + retention-days: 5 + - name: Upload built docs + if: ${{ env.TEST == 'docs' }} + uses: actions/upload-artifact@v3 + with: + name: "docs.tar" + path: "pulp_npm/docs/docs.tar" + + - name: "Logs" if: always() run: | echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml index 871e9b0..9a154c3 100644 --- a/.github/workflows/update-labels.yml +++ b/.github/workflows/update-labels.yml @@ -7,33 +7,33 @@ --- -name: Npm Update Labels +name: "Npm Update Labels" on: push: branches: - - main + - "main" paths: - - 'template_config.yml' + - "template_config.yml" jobs: update_backport_labels: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Configure Git with pulpbot name and email + - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS pip install requests pyyaml echo ::endgroup:: - - uses: actions/checkout@v3 - - name: Update labels + - uses: "actions/checkout@v3" + - name: "Update labels" run: | python3 .github/workflows/scripts/update_backport_labels.py env: - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" diff --git a/.github/workflows/update_ci.yml b/.github/workflows/update_ci.yml index 50eaa18..fcd4d7f 100644 --- a/.github/workflows/update_ci.yml +++ b/.github/workflows/update_ci.yml @@ -7,65 +7,64 @@ --- -name: Npm CI Update +name: "Npm CI Update" on: schedule: # * is a special character in YAML so you have to quote this string # runs at 2:30 UTC every Sunday - cron: '30 2 * * 0' - workflow_dispatch: jobs: update: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: "actions/checkout@v4" with: - repository: pulp/plugin_template - path: plugin_template fetch-depth: 0 + repository: "pulp/plugin_template" + path: "plugin_template" - - uses: actions/setup-python@v4 + - uses: "actions/setup-python@v4" with: python-version: "3.8" - - name: Install python dependencies + - name: "Install python dependencies" run: | echo ::group::PYDEPS pip install gitpython requests packaging jinja2 pyyaml echo ::endgroup:: - - name: Configure Git with pulpbot name and email + - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' - - uses: actions/checkout@v3 + - uses: "actions/checkout@v4" with: - path: pulp_npm - ref: 'main' fetch-depth: 0 + path: "pulp_npm" + ref: "main" - - name: Run update - working-directory: pulp_npm + - name: "Run update" + working-directory: "pulp_npm" run: | ../plugin_template/scripts/update_ci.sh - - name: Create Pull Request for CI files - uses: peter-evans/create-pull-request@v4 + - name: "Create Pull Request for CI files" + uses: "peter-evans/create-pull-request@v4" with: - token: ${{ secrets.RELEASE_TOKEN }} - path: pulp_npm - committer: pulpbot - author: pulpbot - title: 'Update CI files for branch main' - body: '[noissue]' - branch: 'update-ci/main' - base: 'main' + token: "${{ secrets.RELEASE_TOKEN }}" + path: "pulp_npm" + committer: "pulpbot " + author: "pulpbot " + title: "Update CI files for branch main" + body: "" + branch: "update-ci/main" + base: "main" commit-message: | Update CI files diff --git a/CHANGES/.TEMPLATE.rst b/CHANGES/.TEMPLATE.rst index a5b57d6..49c2305 100644 --- a/CHANGES/.TEMPLATE.rst +++ b/CHANGES/.TEMPLATE.rst @@ -1,4 +1,12 @@ -{# TOWNCRIER TEMPLATE #} +{% if render_title %} +{% if versiondata.name %} +{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }}) +{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}} +{% else %} +{{ versiondata.version }} ({{ versiondata.date }}) +{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}} +{% endif %} +{% endif %} {% for section, _ in sections.items() %} {% set underline = underlines[0] %}{% if section %}{{section}} {{ underline * section|length }}{% set underline = underlines[1] %} @@ -35,3 +43,5 @@ No significant changes. {% endfor %} ---- + + diff --git a/lint_requirements.txt b/lint_requirements.txt index a76f3ee..1f18384 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -10,4 +10,4 @@ black check-manifest flake8 flake8-black - +yamllint diff --git a/template_config.yml b/template_config.yml index 8914ea6..6e956b2 100644 --- a/template_config.yml +++ b/template_config.yml @@ -1,7 +1,7 @@ # This config represents the latest values used when running the plugin-template. Any settings that # were not present before running plugin-template have been added with their default values. -# generated with plugin_template@2021.08.26-265-gbdd41dd +# generated with plugin_template@2021.08.26-290-g4d54366 additional_repos: [] api_root: /pulp/ @@ -37,6 +37,9 @@ parallel_test_workers: 8 plugin_app_label: npm plugin_default_branch: main plugin_name: pulp_npm +plugins: +- app_label: npm + name: pulp_npm post_job_template: null pre_job_template: null publish_docs_to_pulpprojectdotorg: true @@ -55,7 +58,6 @@ pypi_username: pulp python_version: '3.8' release_email: pulp-infra@redhat.com release_user: pulpbot -single_commit_check: true stalebot: true stalebot_days_until_close: 30 stalebot_days_until_stale: 90