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

[BUG] actions/checkout initialize repo with submodules #9

Closed
JanoPL opened this issue Aug 20, 2023 · 10 comments
Closed

[BUG] actions/checkout initialize repo with submodules #9

JanoPL opened this issue Aug 20, 2023 · 10 comments

Comments

@JanoPL
Copy link
Contributor

JanoPL commented Aug 20, 2023

Hi,

There is a problem with repositories that have git submodules initialization in action/checkout.

Currently, when the workflow initializes checkout with the given parameters, this action overwrites the previous configuration and initializes the repository from scratch with the given parameters from the action, or that’s just what it looks like.

In my opinion, this step should be outside of action or additional options should be added to github.inputs that are passed to checkout. What do you think about that

In action.yaml L:62 https://github.com/ddev/github-action-add-on-test/blob/main/action.yaml#L62

workflow to reproduce

jobs:
  tests:
    name: tests
    defaults:
      run:
        shell: bash

    strategy:
      matrix:
        ddev_version: [ stable ] # ddev_version: [stable, edge, HEAD, PR]
        os: [ubuntu-22.04] # os: ubuntu-20.04, ubuntu-22.04, macos-12, macos-11, ubuntu-latest, macos-latest, windows-2019, windows-2022, windows-latest
      fail-fast: false

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout
        id: checkout
        uses: actions/checkout@v3
        with:
          submodules: 'true'

      - uses: ddev/[email protected]
         with:
           ddev_version: ${{ matrix.ddev_version }}
           token: ${{ secrets.GITHUB_TOKEN }}
           addon_repository: ${{ env.GITHUB_REPOSITORY }}
           addon_path: ${{ env.TEST_PATH }}

image

image

full logs:
https://pipelines.actions.githubusercontent.com/serviceHosts/e9c573fb-2c8d-4244-a83a-2e837d1f8185/_apis/pipelines/1/runs/414/signedlogcontent/2?urlExpires=2023-08-20T10%3A24%3A59.3735152Z&urlSigningMethod=HMACV1&urlSignature=cAsiZQWS58cFyjCGkIzYRo8GTD%2B%2BK6yuqcXW1%2BNt%2Bu0%3D

workflow that I am testing this action
https://github.com/JanoPL/ddev-kibana/actions/runs/5916437897/workflow

@JanoPL JanoPL changed the title actions/checkout initialize repo with submodules [BUG] actions/checkout initialize repo with submodules Aug 20, 2023
@julienloizelet
Copy link
Collaborator

Thanks for reporting this issue.

As we tried to include a maximum of steps inside the action, I guess the best option is to add another input "submodules". It could a boolean, not required and false by default.

Will work on this asap.

Thanks again

@rfay
Copy link
Member

rfay commented Aug 20, 2023

I'd be interested to know why you'd use git submodules in a DDEV add-on, please do say!

@JanoPL
Copy link
Contributor Author

JanoPL commented Aug 20, 2023

I'd be interested to know why you'd use git submodules in a DDEV add-on, please do say!

i'am extending bats test with custom .sh files and it's looks like this https://bats-core.readthedocs.io/en/stable/faq.html#how-can-i-use-helper-libraries-like-bats-assert

i added bats-assert and it's easy for me to loading directly from repository, i noticing i have some issue when i load this custom .sh files from homebrew paths without included in addon repository

@rfay
Copy link
Member

rfay commented Aug 20, 2023

It's a lot easier to add those during the test setup, as is done in https://github.com/ddev/ddev-platformsh/blob/143a967695ad5cceaa5b3f2b285c8a1a2d34396c/.github/workflows/tests.yml#L51-L56 for example.

It's an interesting approach though! I've been a submodule skeptic for many years after seeing people fail so often with them. But... git has improved its handling of submodules in those intervening years.

@rfay
Copy link
Member

rfay commented Aug 20, 2023

I think we should probably add the helpers into this test! How about a PR to do that?

@julienloizelet
Copy link
Collaborator

Hi @rfay and @JanoPL ,

I just created a PR #12 with a new disable_checkout_action input.

I tested it with Kibana "submodules" checkout here https://github.com/julienloizelet/ddev-add-on-test/actions/runs/5920563653/job/16052000222

My first idea was to add a submodules boolean input, but as there are a lot of possible checkout inputs, it is maybe smarter to let people disable entirely the checkout action and implement their own.

What do you think ?

Thanks

@julienloizelet
Copy link
Collaborator

julienloizelet commented Aug 21, 2023

Hi @JanoPL , I just published a v0.5.0 version with a new disable_checkout_action input that will let you use your own checkout action.

I think you could try with the following steps content:

steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: 'true'

      - uses: ddev/ddev-add-on-test@v0
        with:
          ddev_version: ${{ matrix.ddev_version }}
          token: ${{ secrets.GITHUB_TOKEN }}
          debug_enabled: ${{ github.event.inputs.debug_enabled }}
          addon_repository: ${{ env.GITHUB_REPOSITORY }}
          addon_ref: ${{ env.GITHUB_REF }}
          keepalive: ${{ env.KEEP_ALIVE }}
          disable_checkout_action: true

Please let me know if it works for you.

Thanks

@JanoPL
Copy link
Contributor Author

JanoPL commented Aug 22, 2023

Hi @julienloizelet thank you, it's work well. Tested on version v0.6.0

@julienloizelet
Copy link
Collaborator

Glad to hear that,

I guess I can close this one.

Thanks

@rfay
Copy link
Member

rfay commented Aug 24, 2023

@JanoPL wrt #9 (comment) please take a look at

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

No branches or pull requests

3 participants