Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move docs test workflow and rm obsolete docs processes #902

Merged
merged 5 commits into from
Aug 6, 2024

Conversation

pedro-psb
Copy link
Member

@pedro-psb pedro-psb commented Jul 26, 2024

This does:

  • Adds a docs test workflow in the ci.yml
  • Removes docs test from test.yml workflow (which tests the plugin)
  • Deprecate --docs feature from plugin-template
    • remove docs_test option
    • remove template/docs
    • remove template/bootstrap/docs legacy content
    • remove ci_update_docs
    • make it no-ops
  • Update various info across files

Closes: #901

Testing

This does not cover all workflows, only CI

@pedro-psb pedro-psb force-pushed the move-docs-workflow-out-of-tests branch 10 times, most recently from 93acd3b to 65aebe3 Compare July 26, 2024 21:12
This does:

* Adds a docs test workflow in the ci.yml
* Removes docs test from test.yml workflow (which tests the plugin)
* Deprecate --docs feature from plugin-template
  * remove docs_test option
  * remove template/docs
  * remove template/bootstrap/docs legacy content
  * remove ci_update_docs
  * make it no-ops
* Update various info across files

Closes: pulp#901
@pedro-psb pedro-psb force-pushed the move-docs-workflow-out-of-tests branch from 65aebe3 to 65c470f Compare July 26, 2024 21:25
runs-on: "ubuntu-20.04"
steps:
- run: |
echo "Skip docs testing on non-main branches."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried moving the skip to the ci.yml and got some trouble with the final "ready-to-ship" checks.
I could update the logic there to allow skipping docs (I can, if that sounds better), but this approach feels simpler after all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I ran into the exact same issues before. Still anyone with a better idea...

# Gets set in .github/settings.yml, but doesn't seem to inherited by
# this script.
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py

export PULP_URL="{{ pulp_scheme }}://pulp"

if [[ "$TEST" = "docs" ]]; then
if [[ "$GITHUB_WORKFLOW" == "{{ plugin_app_label | camel | default("Pulp") }} CI" ]]; then
towncrier build --yes --version 4.0.0.ci
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we could keep this command somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The towncrier build command?
On a first sight I just though it was not strictly related to the docs building process, but I can see we want to test if the PR contain valid assets for generating the changelogs.

I'll add a step in the new docs.yml called Build changelog, wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds great. We should be using the generated changelog in the markdown build (or at least do a syntax check).

@@ -28,7 +28,10 @@ jobs:
key: {{ "${{ runner.os }}-pip-${{ hashFiles('pulp-docs-main-sha') }}" }}
restore-keys: |
{{ "${{ runner.os }}-pip-" }}
{{ install_python_deps(["-r", "doc_requirements.txt"]) | indent(6) }}
{{ install_python_deps(["-r", "doc_requirements.txt", "towncrier"]) | indent(6) }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to ask to just make it a doc_requirement...

@@ -1,5 +1,2 @@
{% include 'header.j2' %}
-r requirements.txt
towncrier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, It was one... ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense with having the changelog build step.
Will add towncrier back to doc_requirements.

Comment on lines 46 to 48
docs:
uses: "./.github/workflows/docs.yml"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this behind a flag, because a plugin outside of our control may want to do docs different.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you think we should determine the docs-managed repos?

  • fetching from the existing config file in pulp-docs?
  • declaring a list here?
  • other?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see your point. So the one point of authoritative information is the pulp-docs repository, yes?
Then we should take the information from there.

@pedro-psb pedro-psb force-pushed the move-docs-workflow-out-of-tests branch from 469d8c8 to b9ec40e Compare August 1, 2024 20:55
@pedro-psb pedro-psb requested a review from mdellweg August 1, 2024 21:18
{%- if plugin_name == 'pulpcore' %}
if [[ "$TEST" = "publish" ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds ridiculous. There is no "publish" test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's safe to remove this, then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so. Maybe start with a "git grep publish". But I'm pretty sure this is a leftover from former versions of the release process.

Comment on lines 185 to 188
pulp config create --base-url {{ pulp_scheme }}://pulp{% if pulp_scheme != 'https' %} --no-verify-ssl{% endif %} --api-root "$PULP_API_ROOT" --username "admin" --password "password"
{% if test_cli -%}
if [[ "$TEST" != "docs" ]]; then
cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
fi
cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
{%- endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move that whole block up to around line 30 to have the cli stuff in one place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't seem to work. Don't try this again just now.

requirements.txt Outdated
@@ -1,2 +1,3 @@
tomlkit~=0.12.4
pypandoc_binary~=1.13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this can be dropped again.

@pedro-psb pedro-psb force-pushed the move-docs-workflow-out-of-tests branch from 86eb27e to 14d4ee7 Compare August 2, 2024 16:05
{% if test_cli -%}
cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
PULP_CLI_VERSION="$(pip freeze | sed -n -e 's/{{ cli_package }}==//p')"
git clone --depth 1 --branch "$PULP_CLI_VERSION" {{ cli_repo }} ../{{ cli_package }}
{%- endif %}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I've just reviewed that move, around line 138 we have:

  {%- if test_reroute %}
  export PULP_API_ROOT="/rerouted/djnd/"
  {%- endif %}

So I guess it really should be down there, so it can use the proper value of PULP_API_ROOT.

Copy link
Member

@mdellweg mdellweg Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. that explains why we do it down there.
Let's not do this now then. But we should think about a more structured approach to set all this up in a later PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

Co-authored-by: Matthias Dellweg <[email protected]>

[noissue]
@pedro-psb pedro-psb force-pushed the move-docs-workflow-out-of-tests branch from 14d4ee7 to a3e92bc Compare August 5, 2024 13:25
Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge change. And maybe we can iterate to improve on it. But not necessarily in this PR.

Things to follow up on:

  • A more structured approach to define pulp settings, configure the cli, start the containers, ...
  • Are there we should mark as deprecated from the old docs templates? Is CI now the right place to delete them?

runs-on: "ubuntu-20.04"
steps:
- run: |
echo "Skip docs testing on non-main branches."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I ran into the exact same issues before. Still anyone with a better idea...

{%- if plugin_name == 'pulpcore' %}
if [[ "$TEST" = "publish" ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so. Maybe start with a "git grep publish". But I'm pretty sure this is a leftover from former versions of the release process.

Comment on lines 185 to 188
pulp config create --base-url {{ pulp_scheme }}://pulp{% if pulp_scheme != 'https' %} --no-verify-ssl{% endif %} --api-root "$PULP_API_ROOT" --username "admin" --password "password"
{% if test_cli -%}
if [[ "$TEST" != "docs" ]]; then
cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
fi
cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
{%- endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't seem to work. Don't try this again just now.

)
document = header + document
return document
return [line.strip()[8:] for line in response.content.decode().split("\n") if "- name:" in line]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a rather crude way to parse yaml...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My plan is to do the minimum working solution now and later improve this membership thing (on pulp-docs, also). But I can add a yml library as requirement and make it more robust. Would you prefer that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it stay parsing yaml? Or did you plan something completely different?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing a simple requirement-like file which lists gh-org/gh-repo and has # comments, but not sure if it's a good idea yet. If not, I might stick with yaml.

@@ -328,26 +327,25 @@ def main():
except Exception:
config["current_version"] = "0.1.0a1.dev"

# Determine if plugin is a member of Pulp managed documentation
config["is_pulpdocs_member"] = config["plugin_name"] in utils.get_pulpdocs_members()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. When onboarding a new plugin to the docs, we need to be extra careful. (Just a reminder at this point.)

@mdellweg
Copy link
Member

mdellweg commented Aug 6, 2024

Let's merge and continue from there.

@mdellweg mdellweg merged commit 31fae26 into pulp:main Aug 6, 2024
11 checks passed
@pedro-psb pedro-psb deleted the move-docs-workflow-out-of-tests branch August 6, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleaning up docs-related stuff
2 participants