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

add --tag option #20

Closed
ghost opened this issue Jul 26, 2022 · 15 comments
Closed

add --tag option #20

ghost opened this issue Jul 26, 2022 · 15 comments

Comments

@ghost
Copy link

ghost commented Jul 26, 2022

The "iterate on modules" doc shows the --tag option.

I'd like that as an option for this action.

Thanks!

@marekbuild
Copy link

@TonyPapousekLC The buf-push-action always includes the Git commit as the --tag. Were you thinking that you'd like to override that behavior?

@ghost
Copy link
Author

ghost commented Aug 10, 2022

@marekbuild - Yup, my team sets that field as the project semver

@sachaw
Copy link

sachaw commented Jan 29, 2023

I second this, needed for the exact same reason, thanks.

@bufdev
Copy link
Member

bufdev commented Jan 30, 2023

@sachaw can you propose what you'd like to see exactly? ie what you want added to the configuration, what the behavior should be, get as detailed as you can. We'd like to consider this.

@KenxinKun
Copy link

Hey we'd love this option too, I see the current action sets it to --tag ${{ github.sha }}, if it was me my suggestion would be to add an input with that as the default e.g.:

inputs:
    tag:
        required: false
        type: string
        default: ${{ github.sha }}

Then replace the existing step to have: WANT_ARGS: push path/to/input --tag ${{ inputs.tag }}

@KenxinKun
Copy link

KenxinKun commented Feb 7, 2023

With the suggestion above, then in our own case we would be able to use it as:

- uses: bufbuild/buf-push-action@v1
  with:
    input: <path-to-protos>
    buf_token: ${{ secrets.buf_token }}
    tag: ${{ github.sha }},<other-tag>,<even-more-tags>

@arxeiss
Copy link

arxeiss commented Jan 2, 2024

Any progress so far? We are also using semver so we have to maintain own fork for that. There is already PR #36 created

@nicksnyder
Copy link
Member

Hey all, we are actively working on two things related to this:

  1. We will be making some changes to how tags are going to work in the BSR. It will be backwards compatible, but want to let those changes ship before we would consider adding support for tags here.
  2. We plan on making some changes to how these GitHub actions work, probably simplifying everything to a single action.

Given that, we are going to hold off on making further changes right now to these actions until some of these other changes are complete.

@cosmotek
Copy link

This has been sitting for a bit. I ended up here with the same ask. Any way we can get a quick update to this action? Seems like a pretty simple thing to solve for.

@nicksnyder
Copy link
Member

The update here is we are investing in a new unified GitHub action. It is in an alpha state here: https://github.com/bufbuild/buf-action so you are welcome to try it out. We are already dogfooding it internally and have received positive feedback from a few other customers.

@arxeiss
Copy link

arxeiss commented Jul 9, 2024

@nicksnyder where I can left feedback to that new action? I noticed 2 issues

  1. Missing documentation for github_token as I see in the code it is used, but it is not documented in the README
  2. That tag option during push is not available there too. So no benefits to migrate there now

@nicksnyder
Copy link
Member

You can file issues on the buf-action repo.

Missing documentation for github_token as I see in the code it is used, but it is not documented in the README

Thanks, we'll add docs for those.

That tag option during push is not available there too. So no benefits to migrate there now

Tags and Branches are deprecated as of v1.32.0 of the buf CLI. We now have a single concept called Labels (which is backward compatible with Tags and Branches).

The new action automatically adds a label for each git ref that points to the git commit you are pushing to the BSR, so if you are tagging with semver Git tags, then those will automatically get pushed to the BSR (without the need for any manual configuration). Does that solve your use case?

Here are some blog posts that explain the changes:

@arxeiss
Copy link

arxeiss commented Jul 9, 2024

@nicksnyder thanks for the reply. I will need to test it out. It should work as you described it, but I'm not 100% sure as our trigger is repository_dispatch, not push.

When we merge changes to master branch, they are not pushed to BSR automatically. But after our code reach production, we are using Github API to trigger that workflow, with semver tag as payload.

Our pipeline looks like this (very simplified):

---
name: Push Proto changes to buf.build
on:
    repository_dispatch:
        types: [publish_proto] # Do not rename type as this is identifier in external cURL call

jobs:
    buf-push:
        strategy:
            matrix:
                repos:
                    - {fullName: indykite/indykiteapis, folder: proto/public}
                    - {fullName: indykite/internalapis, folder: proto/internal}
        runs-on: ubuntu-latest
        steps:
            # ...
            - if: ${{ steps.diff_checker.outputs.has_diff }}
              uses: bufbuild/buf-setup-action@v1
              with:
                  github_token: ${{ secrets.INDYKITEONE_PAT }}

            - if: ${{ steps.diff_checker.outputs.has_diff }}
              uses: bufbuild/buf-lint-action@v1
              with:
                  input: ${{matrix.repos.folder}}
            - if: ${{ steps.diff_checker.outputs.has_diff }}
              uses: bufbuild/buf-push-action@v1
              with:
                  buf_token: ${{ secrets.BUF_TOKEN }}
                  input: ${{matrix.repos.folder}}
                  tag: ${{ steps.get-tag.outputs.new_tag }}
              env:
                  BUF_TOKEN: ${{ secrets.BUF_TOKEN }}

@nicksnyder
Copy link
Member

nicksnyder commented Jul 9, 2024

@arxeiss The push action is really just a thin wrapper around buf push, so it is just as easy, if not simpler, to call buf push directly.

-              uses: bufbuild/buf-push-action@v1
-              with:
-                  buf_token: ${{ secrets.BUF_TOKEN }}
-                  input: ${{matrix.repos.folder}}
-                  tag: ${{ steps.get-tag.outputs.new_tag }}
+              run: buf push ${{ matrix.repos.folder }} --label ${{ steps.get-tag.outputs.new_tag }} --label main

Note: I made an assumption here that you want to push each new commit to both the semver tag as well as the BSR label main (which is what buf push --tag <semver> would do)

@emcfarlane
Copy link
Contributor

The new buf-action has been released as a v1 with improved support for push, ensuring branches kept in sync with the BSR. Please take a look and raise any issues found there! Happy to help on buf slack or GitHub issues for any setup help in migrating buf-push-action to the new action.

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 a pull request may close this issue.

8 participants