buf-push-action icon indicating copy to clipboard operation
buf-push-action copied to clipboard

add `--tag` option

Open ghost opened this issue 3 years ago • 8 comments

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

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

Thanks!

ghost avatar Jul 26 '22 22:07 ghost

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

marekbuild avatar Aug 10 '22 16:08 marekbuild

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

ghost avatar Aug 10 '22 17:08 ghost

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

sachaw avatar Jan 29 '23 05:01 sachaw

@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.

bufdev avatar Jan 30 '23 18:01 bufdev

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 avatar Feb 07 '23 11:02 KenxinKun

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>

KenxinKun avatar Feb 07 '23 11:02 KenxinKun

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

arxeiss avatar Jan 02 '24 15:01 arxeiss

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.

nicksnyder avatar Feb 14 '24 18:02 nicksnyder

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.

cosmotek avatar Jun 19 '24 22:06 cosmotek

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.

nicksnyder avatar Jul 05 '24 16:07 nicksnyder

@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

arxeiss avatar Jul 09 '24 12:07 arxeiss

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:

  • https://buf.build/blog/buf-cli-next-generation
  • https://buf.build/blog/enhanced-buf-push-bsr-ui

nicksnyder avatar Jul 09 '24 14:07 nicksnyder

@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 }}

arxeiss avatar Jul 09 '24 14:07 arxeiss

@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)

nicksnyder avatar Jul 09 '24 14:07 nicksnyder

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.

emcfarlane avatar Aug 01 '24 18:08 emcfarlane