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

Merge queue creates spurious tag dirs in documentation repo #3152

Closed
infotroph opened this issue Mar 30, 2023 · 17 comments
Closed

Merge queue creates spurious tag dirs in documentation repo #3152

infotroph opened this issue Mar 30, 2023 · 17 comments

Comments

@infotroph
Copy link
Member

infotroph commented Mar 30, 2023

Bug Description

Screen Shot 2023-03-29 at 11 08 37 PM

The proximal culprit seems to be line 67 of book.yml, which assumes any ref with a slash in it must be a tag. But it's possible we need to instead/additionally tweak the conditions under which the deployment is triggered (possibly if: github.event_name == 'push' instead of if: github.event_name != 'pull_request'?)

@chethanagopinath
Copy link

Hi, this is my first time contributing to this repo. Could I pick this one up?

@mdietze
Copy link
Member

mdietze commented May 10, 2023

@chethanagopinath Yes please, that'd be great

@chethanagopinath
Copy link

@mdietze just had some context questions to start:

  1. Looking at the documentation repo, is it complete setup and context documentation for each version?
  2. Also wondering when we would want to update that documentation repo?

Thanks.

@infotroph
Copy link
Member Author

  1. Yes, the documentation repo contains compiled versions of the manual for the entire PEcAn system (as opposed to the R function docs for individual packages, which live in the PEcAn repo). There is a version (each in its own folder) to correspond to each tagged release of PEcAn plus the up-to-the-minute develop version.
  2. This repo is automatically updated (By GitHub Actions via book.yml) every time we merge changes to a corresponding branch/tag of the PEcAn repo. The problem is that GitHub's new and very handy "merge queue" feature creates a lot of temporary branches that don't need to be preserved as artifacts, so the task here is to find the cleanest way for this deployment script to ignore temporary references like the merge queue branches without missing tags that need preserving.

@harshagr70
Copy link

Hey !! i want to work on this issue .. can i proceed ??

@infotroph
Copy link
Member Author

@harshagr70 Yes, please do! Let us know if you need more info.

@GandalfGwaihir
Copy link
Collaborator

@harshagr70 , if you need any help, be sure to ping me on slack, also read #3216 as both are related :)

@harshagr70
Copy link

@harshagr70 , if you need any help, be sure to ping me on slack, also read #3216 as both are related :)

Sure thing !! We can definitely discuss it !!

@chethanagopinath chethanagopinath removed their assignment Dec 3, 2023
@Sweetdevil144
Copy link
Contributor

I've been looking into the workflow setup for our documentation repo and noticed the merge queue is generating some extra directories we don't need. I'd like to tackle this issue and have a couple of suggestions to put forward.
export VERSION=${GITHUB_REF##*/}
as specified by @infotroph , This line treats any GITHUB_REF with a slash as a tag, but we know branches can contain slashes too, leading to our current problem.
I'm thinking of tightening up the logic here to clearly identify tags. We could check if the GITHUB_REF actually starts with refs/tags/
Also, I believe we should revisit the conditions for the deployment step. Right now, it's set to run when it's not a pull request:

if: github.event_name != 'pull_request'

Maybe we could be more specific, such as:

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

This way, we ensure that the deployment is only triggered for tag pushes, which is when we actually want to update our documentation.

I'd love to get your thoughts on this and work together to refine our process.

@infotroph
Copy link
Member Author

@Sweetdevil144 Yes, I think this is the right approach.

We do also want to deploy on every push to develop or master -- will your proposal do that already or will we ned to add those explicitly? And am I right that adding it explicitly would be a matter of matching on any of refs/tags/, refs/heads/master, refs/heads/develop?

@Sweetdevil144
Copy link
Contributor

Hey!

You're spot on. My proposal was primarily focused on the tagging issue, but we definitely need to ensure that pushes to develop and master trigger deployments as well. To achieve this, we can extend the conditional to include those branches explicitly. Here’s how we could adjust the workflow to handle it:

on:
  push:
    branches:
      - master
      - develop
    tags:
      - '*'

And for the deployment step, we could indeed match explicitly like this:

if: >
  github.event_name == 'push' && 
  (startsWith(github.ref, 'refs/tags/') || 
  github.ref == 'refs/heads/master' || 
  github.ref == 'refs/heads/develop')

Now, I'm not that good when dealing with yaml files but this should cover our bases for both tag creation and direct pushes to master and develop. Does this align with our deployment strategy, or are there additional scenarios we need to account for? I'll need to have a complete overlook upon the workflow for more information. If I'm missing something, do correct me please.

Thanks for the guidance!

@infotroph
Copy link
Member Author

infotroph commented Dec 8, 2023

@Sweetdevil144 Thanks for the detailed proposal! I think what you wrote there is very close to being the whole patch needed -- would you like to open a PR that makes those changes in book.yml?

Does this align with our deployment strategy, or are there additional scenarios we need to account for?

I believe these are all of them, but we can get confirmation from @robkooper before merging the PR.

@Sweetdevil144
Copy link
Contributor

@infotroph Sure !! I'll open a PR as soon as I redesign the book.yml file according to results which we want, of course only manipulating the line which need to be. Before that, can you confirm all deployment strategies so that we get a clear idea of what's needed to be worked upon?

@Sweetdevil144
Copy link
Contributor

Sweetdevil144 commented Dec 9, 2023

Hey @infotroph , did you confirm all the strategies? Rest of work is done and I'm ready to draft a PR !! ^^

@infotroph
Copy link
Member Author

I've confirmed these are all the strategies we use at the moment, so go ahead with the PR--we can always add more later when we discover we need them.

@Sweetdevil144 Sweetdevil144 mentioned this issue Dec 9, 2023
13 tasks
@Sweetdevil144
Copy link
Contributor

@infotroph Created a PR for the same!!
Do remind me if any further changes need to be made!!

@PoppingPixel9
Copy link

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants