Skip to content

Build and deploy to latest once a week, running at the start of the week #2487

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

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

x1101
Copy link
Contributor

@x1101 x1101 commented Mar 28, 2025

Fixes #2050

Copy link
Collaborator

@gotmax23 gotmax23 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Here's some feedback.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, this could be combined into one weekly-build workflow with a Matrix for the latest build and the devel build.

with:
repository-owner: 'ansible'
repository-name: 'ansible-documentation'
repository-branch: 'devel'
Copy link
Collaborator

Choose a reason for hiding this comment

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

The branch should be stable-2.18 for the latest build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in most recent push

Comment on lines +13 to +14
repository-owner: 'ansible'
repository-name: 'ansible-documentation'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
repository-owner: 'ansible'
repository-name: 'ansible-documentation'

These are already the default options; I don't think we need to specify them twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in most recent push

Comment on lines +25 to +28
ansible-package-version: '11' # "Latest"
deployment-environment: test
repository-owner: 'ansible'
repository-branch: 'devel'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments from above apply

@oraNod
Copy link
Contributor

oraNod commented Apr 8, 2025

Thanks for working on this! Here's some feedback.

@gotmax23 Thanks for providing the feedback to @x1101 - We discussed this at the DaWGs meeting today. @samccann advised that we increase the schedule frequency for devel builds to at least twice a day while latest can be once a week.

Initially I also said to @x1101 that we might just merge his two workflows as separate and then combine them as a follow up. I thought that might make his life a bit easier because he mentioned he is short on time but would like to make this contribution to the docs.

It then occurred to me that it might be a lot cleaner for the repo itself if we combine the two workflows and use a matrix as you say. That would avoid old, unused jobs in the actions section.

I could push to this branch but I'd rather not stomp on anyone's work. So here comes some stuff for discussion (crontab for devel needs updating):

---
name: Build and deploy docs
"on":
  schedule:
    # Schedule for latest
    - cron: '17 5 * * 1'
    # Schedule for devel
    - cron: '22 5 * * 1'

jobs:
  build-devel:
    strategy:
      matrix:
        include:
          - schedule: '22 5 * * 1'
    name: 📝 Build
    uses: ./.github/workflows/reusable-build-docs.yaml
    secrets:
      DOCS_BOT_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }}

  deploy-devel:
    strategy:
      matrix:
        include:
          - schedule: '22 5 * * 1'
    name: 🚀 Deploy
    needs: build-devel
    uses: ./.github/workflows/reusable-deploy-docs.yaml
    with:
      deployment-environment: production
    secrets:
      DEPLOY_DOC_BUILD: ${{ secrets.DEPLOY_DOC_BUILD }}

  build-latest:
    strategy:
      matrix:
        include:
          - schedule: '17 5 * * 1'
            repository-branch: 'stable-2.18'
            latest-version: '11'
    name: 📝 Build
    uses: ./.github/workflows/reusable-build-docs.yaml
    with:
      repository-branch: "${{ matrix.repository-branch }}"
      ansible-package-version: "${{ matrix.latest-version }}"
    secrets:
      DOCS_BOT_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }}

  deploy-latest:
    strategy:
      matrix:
        include:
          - schedule: '17 5 * * 1'
            repository-branch: 'stable-2.18'
            latest-version: '11'
    name: 🚀 Deploy
    needs: build-devel
    uses: ./.github/workflows/reusable-deploy-docs.yaml
    with:
      repository-branch: "${{ matrix.repository-branch }}"
      ansible-package-version: "${{ matrix.latest-version }}"
      deployment-environment: production
    secrets:
      DEPLOY_DOC_BUILD: ${{ secrets.DEPLOY_DOC_BUILD }}

This was the road I started going down at first but hit a wall because I can't add a conditional like this:

if: github.event.schedule == ${{ matrix.schedule }}

Apparently you can't use the matix context in jobs.job.if, which appears to be a known thing.

Is the alternative here to take the schedule out of the matrix and do something like this instead?

---
name: Build and deploy docs
"on":
  schedule:
    # Schedule for latest
    - cron: '17 5 * * 1'
    # Schedule for devel
    - cron: '22 5 * * 1'

jobs:
  build-devel:
    if: github.event.schedule == '22 5 * * 1'
    name: 📝 Build
    uses: ./.github/workflows/reusable-build-docs.yaml
    secrets:
      DOCS_BOT_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }}

  deploy-devel:
    if: github.event.schedule == '22 5 * * 1'
    name: 🚀 Deploy
    needs: build-devel
    uses: ./.github/workflows/reusable-deploy-docs.yaml
    with:
      deployment-environment: production
    secrets:
      DEPLOY_DOC_BUILD: ${{ secrets.DEPLOY_DOC_BUILD }}

  build-latest:
    if: github.event.schedule == '17 5 * * 1'
    strategy:
      matrix:
        include:
          - repository-branch: 'stable-2.18'
            latest-version: '11'
    name: 📝 Build
    uses: ./.github/workflows/reusable-build-docs.yaml
    with:
      repository-branch: "${{ matrix.repository-branch }}"
      ansible-package-version: "${{ matrix.latest-version }}"
    secrets:
      DOCS_BOT_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }}

  deploy-latest:
    if: github.event.schedule == '17 5 * * 1'
    strategy:
      matrix:
        include:
          - repository-branch: 'stable-2.18'
            latest-version: '11'
    name: 🚀 Deploy
    needs: build-devel
    uses: ./.github/workflows/reusable-deploy-docs.yaml
    with:
      repository-branch: "${{ matrix.repository-branch }}"
      ansible-package-version: "${{ matrix.latest-version }}"
      deployment-environment: production
    secrets:
      DEPLOY_DOC_BUILD: ${{ secrets.DEPLOY_DOC_BUILD }}

If that's the case, I'm not sure I'd be in favour of combining the two workflows.

What do folks think?

@x1101
Copy link
Contributor Author

x1101 commented Apr 8, 2025

@oraNod until we do more digging on the integrated build matrix, I did push fixes for the other issues @gotmax23 mentioned on this.

@oraNod
Copy link
Contributor

oraNod commented Apr 9, 2025

Thanks for keeping up the work on this @x1101

@gotmax23
Copy link
Collaborator

gotmax23 commented Apr 9, 2025

Yeah, if we want the latest and devel builds to be on different schedules, then keeping them in separate workflows make sense.

@x1101, it looks like this PR and #2486 now contain the same files. Would you like to close one of them and implement both #2050 and #2049 in a single PR? Currently, I'm not sure which one I should review.

Thanks everyone!

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

Successfully merging this pull request may close these issues.

Build and deploy to latest once a week, running at the start of the week
3 participants