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

Use a temp checkout path for automation when building docs #2902

Merged
merged 4 commits into from
Aug 29, 2023

Conversation

AetherUnbound
Copy link
Collaborator

@AetherUnbound AetherUnbound commented Aug 25, 2023

Fixes

Fixes #2900 by @dhruvkb

Description

Fixes an issue with #2647 which was causing the documentation publishing step to fail because a repo was being checked out inside of another repo (namely the automation used during the CI steps was being checked out to <workspace>/automation-checkout when the actual gh-pages branch was being checked out to <workspace> itself).

Testing Instructions

I'm not sure the best way to test this, I'll follow up with a small doc change which should at least trigger the preview, but we may need to wait for a legitimate docs change in order to see if it is successful or not.

I've added a legitimate documentation change, so hopefully we'll be able to see the results once this is merged.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@AetherUnbound AetherUnbound requested a review from a team as a code owner August 25, 2023 23:00
@AetherUnbound AetherUnbound requested review from krysal and obulat August 25, 2023 23:00
@github-actions github-actions bot added the 🧱 stack: mgmt Related to repo management and automations label Aug 25, 2023
@openverse-bot openverse-bot added 🟧 priority: high Stalls work on the project or its dependents 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository labels Aug 25, 2023
@github-actions github-actions bot added the 🧱 stack: documentation Related to Sphinx documentation label Aug 25, 2023
Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

Good catch! I spent several hours but could not figure out from where Git got the idea that we have submodules.

@AetherUnbound
Copy link
Collaborator Author

Good catch! I spent several hours but could not figure out from where Git got the idea that we have submodules.

I did a lot of random searching in our repo and ran the exact steps the CI was running to come across this 😅 I'm disappointed we didn't catch this earlier honestly, since the deployments were pulling down the gh-pages branch and deploying to that 🤔 I hope this does the trick!

Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

The action fails on tmp not being in the working directory.

To fix this, it might be necessary to move both gh-pages and the automations checkout into separate paths:

diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index ea45cbfbd..82f5850e4 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -880,6 +880,7 @@ jobs:
         uses: actions/checkout@v3
         with:
           ref: gh-pages
+          path: gh-pages
 
       - name: Checkout automations from repository
         uses: actions/checkout@v3
@@ -890,7 +891,7 @@ jobs:
         if: github.event_name == 'push'
         run: |
           mv /tmp/docs /tmp/gh-pages
-          mv _preview /tmp/gh-pages/_preview
+          mv gh-pages/_preview /tmp/gh-pages/_preview
 
       - name: Replace preview of current PR
         if: github.event_name == 'pull_request'

@sarayourfriend
Copy link
Collaborator

Also to re-iterate what Dhruv said, I was stumped on why it thought we had submodules. Good find.

@AetherUnbound AetherUnbound force-pushed the fix/documentation-renders branch from be9b025 to 94cde7f Compare August 28, 2023 23:12
@obulat
Copy link
Contributor

obulat commented Aug 29, 2023

I tried re-running the CI, and it failed again. It seems to have failed because "Copy existing previews" step did not run, so /tmp/gh-pages/_preview/ probably doesn't exist. This means that mv /tmp/docs /tmp/gh-pages/_preview/${{ github.event.pull_request.number }} fails because /tmp/gh-pages/_preview/ doesn't exist.

Should the if for "Copy existing previews" step be updated to something other than github.event_name == 'push'?

Steps that cause CI failure:

      - name: Copy existing previews
        if: github.event_name == 'push'
        run: |
          mv /tmp/docs /tmp/gh-pages
          mv gh-pages/_preview /tmp/gh-pages/_preview

      - name: Replace preview of current PR
        if: github.event_name == 'pull_request'
        run: |
          cp -r . /tmp/gh-pages
          sudo rm -rf /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}
          mv /tmp/docs /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}

@sarayourfriend
Copy link
Collaborator

I think I missed a line in my diff:

          cp -r . /tmp/gh-pages

should be

          cp -r gh-pages /tmp/gh-pages

@github-actions
Copy link

Full-stack documentation: https://docs.openverse.org/_preview/2902

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

Changed files 🔄:

@obulat
Copy link
Contributor

obulat commented Aug 29, 2023

should be

I added this line, and the "emit docs" step worked. Unfortunately, the preview link still doesn't work :(

@AetherUnbound
Copy link
Collaborator Author

I added this line, and the "emit docs" step worked. Unfortunately, the preview link still doesn't work :(

It looks like it has for me! Do you mind checking again @obulat?

@obulat obulat dismissed sarayourfriend’s stale review August 29, 2023 15:19

The changes were added

@AetherUnbound AetherUnbound merged commit d34aeeb into main Aug 29, 2023
@AetherUnbound AetherUnbound deleted the fix/documentation-renders branch August 29, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: mgmt Related to repo management and automations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

GH Pages deployments failing
5 participants