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

Push tagged builds automatically #119

Closed
jgeewax opened this issue Jul 6, 2015 · 17 comments
Closed

Push tagged builds automatically #119

jgeewax opened this issue Jul 6, 2015 · 17 comments
Assignees
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@jgeewax
Copy link

jgeewax commented Jul 6, 2015

It'd be really nice to make our doc builds and the maven push all automagical based on the tags we have in the git repository.

/cc @stephenplusplus : Maybe you can add more color on how we did this for node.

(This stems from the discussion on #51)

@stephenplusplus
Copy link

Unfortunately, I'm not too familiar with the workflow and practices of a Java developer. We're lucky with Node, because Travis gives us the behavior we're looking for out of the box with an npm deploy provider: (see our travis.yml). If we push a new tag to the repo, it automatically runs our release.sh script to build the docs before publishing to npm on its own.

Travis says the solution for projects that don't have a supported deploy provider is just using the after_success block. Only one configuration is possible (as far as I know), and it has already been written to push snapshot updates. To get it to do something on tagged releases should be possible as well, but it can only be one or the other.

However, since you can point after_success to a shell script, you can get away with doing more complicated things. This may not be a great idea, but in theory, the following should be possible:

  1. Run your after_success script (say, on-push.sh on every push to master)
  2. on-push would somehow check for the most recent released version
  3. on-push would somehow check for the latest tag in your repo
  4. on-push would use 3 & 4 to determine if you need to push a snapshot or push a release & build the docs

Sorry I couldn't be more help.

@mziccard
Copy link
Contributor

Let me add here what I wrote in a not-so-related pull request. When a tag is pushed to the repository the $TRAVIS_TAG is set to its value. In the after_success script this variable can be inspected to check whether we have to push a snapshot (e.g. tag v0.8.0-SNAPSHOT) or a release (e.g. tag v0.8.0).

Before depolying in maven we also need to update version numbers in all pom.xml files (and READMEs). I see two solutions here:

  1. Doing it by hand (possibly using a script) before pushing the tag
  2. Doing it in Travis after pushing the tag: that is, let Travis get the version from $TRAVIS_TAG, update all pom.xml and READMEs and pushe a commit with the updated files

The problem I see with approach 2 is that we will have a commit tagged with a newer version while maven's pom.xml and READMEs are still to the previous version as Travis commit arrives later (is triggered by the tag). Forcing the tag to move to the next commit is a no-no.

I like approach 2 because it rely solely on git tags to publish a new version but I do not like having version update commits after their corresponding tag. Sticking to a 1-like solution might be better with this respect. Any thoughts?

@aozarov
Copy link
Contributor

aozarov commented Aug 27, 2015

I also like approach 2 but let me make sure I understand it...
Can Travis be triggered just by pushing a tag (without code change)?
If so, can Travis do something like the following?

if release_tag:
release_version = version from release_tag
prev_version = version from pom.xml
set poms version to release version and trigger site & maven push (don't commit poms)
if prev_version <= release_version:
modify poms to release_version + 1 + "-SNAPSHOT" and commit

@mziccard
Copy link
Contributor

Yes Travis should be triggered even if you push only tags and what you write should be doable without too much pain. The problems I see here are:

  • In git you will have a commit tagged with a version while in the commit pom and READMEs are set to an older (snapshot) version
  • Consider the case you tag with release version 1.6.0, what's the next SNAPSHOT version? 1.6.1-SNAPSHOT or 1.7.0-SNAPSHOT? In either case, what if you then jump to release version (and tag) 2.0.0? You end up being in release 2.0.0 having no snapshots for it but you will have either 1.7.0-SNAPSHOT or 1.6.1-SNAPSHOT with no corresponding release version.

@aozarov
Copy link
Contributor

aozarov commented Aug 28, 2015

Yes, in case of release version 1.6.0 I would expect it to automatically move the SNAPSHOT version in the POM to 1.6.1-SNAPSHOT.

As long as the tag release is smaller than POM version, we don't change the POM in gitHub (just locally for the maven and site pushes).

I don't see the difference between the 1.6.0 case and the 2.0.0 case (so maybe I don't understand the question). It should be fine to have such a jump (POM would be set to 2.0.1-SNAPSHOT) and site/maven will be pushed with a 2.0.0 release.
Maven dependencies should be fine with not having 1.7.0-SNAPSHOT or a like and should pick the latest release (snapshot or not) that is <= 1.7.0-SNAPSHOT.

Another option to consider is pushing tags just with a release type indicator.
e.g. major_relase, minor_release, incremental_release and according to that we will modify
the pom to push artifcats to maven and generate a site as well as modifying the pom in gitHub.
Thoughts?

@ajkannan
Copy link

I vote for the first option (using a script to update the poms before pushing the tag) because of the first bullet point (the tagged version will have an outdated pom.xml). I think option 2 would be a bit confusing down the line, especially if anybody checks out the repository using that tag.

@jgeewax
Copy link
Author

jgeewax commented Aug 28, 2015 via email

@jgeewax
Copy link
Author

jgeewax commented Aug 28, 2015

Just out of curiosity... shouldn't this be a solved problem? Is there something going on that we overlooked? I feel like any real Java project should have already figured this out..........

@mziccard
Copy link
Contributor

@aozarov The problem with jumping to 2.0.0 is not after the jump but before it:
Imagine you release version 1.6.0. Then the POM is moved automatically to 1.6.1-SNAPSHOT and every push then triggers a maven deploy of 1.6.1-SNAPSHOT. If you then decide to jump to release 2.0.0 by pushing the corresponding tag you will end up having published 1.6.1-SNAPSHOT but no 1.6.1 release as well as 2.0.0 release but no 2.0.0-SNAPSHOT. This is not a big deal.

@jgeewax I browsed some real java projects and it's a huge mess, some do version changes by hand like in approach 1 (e.g. hibernate but they use gradle), others (e.g. Spring) have a build bot triggered from outside git (I think) that fetches the repo, moves to new version the POMs and pushes the changes as well as a version tag back to the repository, publishes the artifact and finally puts a new "development version" in the POMs and pushes to git.

@aozarov
Copy link
Contributor

aozarov commented Aug 28, 2015

@mziccard Yes, I understand but I also don't think it is a big deal (it should be totally fine to skip a release for a snapshot when a change is no longer minor or to have a release without prior snapshots).

What did you think about using major/minor/incremental tags instead of specifying the version (and automate the book-keeping)? We could always also support jump/reset to specific version if need to...

@ajkannan can you describe the confusion?

@jgeewax I also looked at guava and Guice and though they both seem to use gitHub releases/tags I didn't find any evidence of automation for it. They do automate javadoc & maven snapshots push in a similar way to what we already do (but they do not use maven site).

@jgeewax
Copy link
Author

jgeewax commented Aug 28, 2015

Maybe we can look at a non-Google project for guidance?

@mziccard
Copy link
Contributor

@aozarov You mean using just major/minor/incremental as tag name without any version information? While I understand your point, in git a tag must be unique so you can not use them as if they were actions. A tag is like a label you add to a commit to allow users to clone the repository for a specific version/bug fix/feature/etc.

@ajkannan
Copy link

@aozarov To clarify what I said earlier regarding the confusion with Option 2:
If developers were to type git checkout -b version007 v0.0.7, their pom.xml files would still say 0.0.7-SNAPSHOT, not 0.0.7.

@aozarov
Copy link
Contributor

aozarov commented Aug 28, 2015

@ajkannan I see your point.

@mziccard can we make Travis delete the tag (so we can re-use it next time) and then instead let Travis apply the specific version tag (after changing POMs version associated with the tag for both site/maven and github code check-in [to answer @ajkannan concern]). After that Travis can change POMs to the next snapshot version. Is that too much to task from Travis or gitHub? If so, than I think I would also favor a manually triggered script for releases while automating the snapshots [as we already do].

@jgeewax Hibernate and Spring that were pointed out by @mziccard are not Google projects.
Considering this list for top libraries on GH I also looked at Junit & log4J and didn't find evidence for automatically using GH releases.

@mziccard
Copy link
Contributor

@aozarov Uh I see. I would say that this is an unorthodox way of using tags :) Deleting a remote tag is not very common unless you pushed it by accident but it can be done and I am not against this approach! Somebody else's thoughts would be valuable at this point.

@jgeewax
Copy link
Author

jgeewax commented Aug 30, 2015

I'd agree... I think deleting remote tags is ... a bit scary.

@aozarov aozarov added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Oct 12, 2015
@ajkannan ajkannan removed their assignment Feb 17, 2016
@garrettjonesgoogle
Copy link
Member

The repo currently has an automated release process based on the version in the pom. Closing out this issue.

github-actions bot pushed a commit to suztomo/google-cloud-java that referenced this issue Jun 29, 2022
github-actions bot pushed a commit that referenced this issue Jul 14, 2022
🤖 I have created a release *beep* *boop*
---


## [1.2.1](googleapis/java-ids@v1.2.0...v1.2.1) (2022-07-13)


### Bug Fixes

* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-ids/issues/1485)) ([#118](googleapis/java-ids#118)) ([e7db035](googleapis/java-ids@e7db035))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this issue Jul 18, 2022
…-info-reports-plugin to v3.4.0 (#119)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-project-info-reports-plugin](https://maven.apache.org/plugins/) | `3.3.0` -> `3.4.0` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-project-info-reports-plugin/3.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-project-info-reports-plugin/3.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-project-info-reports-plugin/3.4.0/compatibility-slim/3.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-project-info-reports-plugin/3.4.0/confidence-slim/3.3.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-vmmigration).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMTcuNCIsInVwZGF0ZWRJblZlciI6IjMyLjExNy40In0=-->
github-actions bot pushed a commit that referenced this issue Sep 15, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this issue Sep 30, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-resumable-media](https://togithub.com/googleapis/google-resumable-media-python) | `==2.3.3` -> `==2.4.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-resumable-media/2.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-resumable-media/2.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-resumable-media/2.4.0/compatibility-slim/2.3.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-resumable-media/2.4.0/confidence-slim/2.3.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-video-live-stream).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMDguMiIsInVwZGF0ZWRJblZlciI6IjMyLjIwOC4yIn0=-->
github-actions bot pushed a commit that referenced this issue Oct 4, 2022
🤖 I have created a release *beep* *boop*
---


## [0.5.5](https://togithub.com/googleapis/java-video-live-stream/compare/v0.5.4...v0.5.5) (2022-09-30)


### Dependencies

* Update dependency cachetools to v5 ([#101](https://togithub.com/googleapis/java-video-live-stream/issues/101)) ([8b1f7cd](https://togithub.com/googleapis/java-video-live-stream/commit/8b1f7cd252a8d8be47adb7ad2647a9c978fe4433))
* Update dependency charset-normalizer to v2.1.1 ([#109](https://togithub.com/googleapis/java-video-live-stream/issues/109)) ([020b87d](https://togithub.com/googleapis/java-video-live-stream/commit/020b87d80c8ec0f6ccaee36536161d8ba32c9afc))
* Update dependency click to v8.1.3 ([#110](https://togithub.com/googleapis/java-video-live-stream/issues/110)) ([b01a8bc](https://togithub.com/googleapis/java-video-live-stream/commit/b01a8bc5c34de5997174241cce8bef616c752292))
* Update dependency google-api-core to v2.10.1 ([#111](https://togithub.com/googleapis/java-video-live-stream/issues/111)) ([fc39507](https://togithub.com/googleapis/java-video-live-stream/commit/fc39507d7ab374a607e7ad7bfc1feb67f1ade1bf))
* Update dependency google-auth to v2.12.0 ([#123](https://togithub.com/googleapis/java-video-live-stream/issues/123)) ([9332a20](https://togithub.com/googleapis/java-video-live-stream/commit/9332a2057e6eb9d24cb25136c9a0fa1fc1cb135d))
* Update dependency google-cloud-storage to v2.5.0 ([#112](https://togithub.com/googleapis/java-video-live-stream/issues/112)) ([b94e163](https://togithub.com/googleapis/java-video-live-stream/commit/b94e1630336fc419df81890907932ff2c4dce5a7))
* Update dependency google-crc32c to v1.5.0 ([#113](https://togithub.com/googleapis/java-video-live-stream/issues/113)) ([29f67f1](https://togithub.com/googleapis/java-video-live-stream/commit/29f67f1b834af05b0f1f9b7655d6b3e418393ebb))
* Update dependency google-resumable-media to v2.4.0 ([#119](https://togithub.com/googleapis/java-video-live-stream/issues/119)) ([15b08df](https://togithub.com/googleapis/java-video-live-stream/commit/15b08df1a40d2897964a897d61b39d6045ad2372))
* Update dependency googleapis-common-protos to v1.56.4 ([#108](https://togithub.com/googleapis/java-video-live-stream/issues/108)) ([815a46e](https://togithub.com/googleapis/java-video-live-stream/commit/815a46e7d6dd5866acee7c6cbb1dbef5cbda88d2))
* Update dependency importlib-metadata to v4.12.0 ([#96](https://togithub.com/googleapis/java-video-live-stream/issues/96)) ([de35cf1](https://togithub.com/googleapis/java-video-live-stream/commit/de35cf18e690b4e9fe56d2cddd5ce5ac4481abd8))
* Update dependency jeepney to v0.8.0 ([#114](https://togithub.com/googleapis/java-video-live-stream/issues/114)) ([8ce181d](https://togithub.com/googleapis/java-video-live-stream/commit/8ce181d95deaf0e5b37f24238370da29d6f726dd))
* Update dependency jinja2 to v3.1.2 ([#97](https://togithub.com/googleapis/java-video-live-stream/issues/97)) ([e36f74d](https://togithub.com/googleapis/java-video-live-stream/commit/e36f74debe88dcf2c406104af48037243098a180))
* Update dependency keyring to v23.9.3 ([#115](https://togithub.com/googleapis/java-video-live-stream/issues/115)) ([8a023a0](https://togithub.com/googleapis/java-video-live-stream/commit/8a023a0a009da78c07136f7b9b2904b3d6e04f6c))
* Update dependency markupsafe to v2.1.1 ([#98](https://togithub.com/googleapis/java-video-live-stream/issues/98)) ([316fb08](https://togithub.com/googleapis/java-video-live-stream/commit/316fb08bc6495e0b2a9ec5475a7b350137d6675c))
* Update dependency protobuf to v3.20.2 ([#116](https://togithub.com/googleapis/java-video-live-stream/issues/116)) ([933beb3](https://togithub.com/googleapis/java-video-live-stream/commit/933beb3a24cfb277f9c57d2486b49b1ecdc01029))
* Update dependency protobuf to v3.20.3 ([#120](https://togithub.com/googleapis/java-video-live-stream/issues/120)) ([99467b2](https://togithub.com/googleapis/java-video-live-stream/commit/99467b23dcc7641300b3c19b57ab1271255c303b))
* Update dependency protobuf to v4 ([#102](https://togithub.com/googleapis/java-video-live-stream/issues/102)) ([c3a58c0](https://togithub.com/googleapis/java-video-live-stream/commit/c3a58c0676766f0e995c71e0732e42f4eb45978c))
* Update dependency pyjwt to v2.5.0 ([#117](https://togithub.com/googleapis/java-video-live-stream/issues/117)) ([a6dc961](https://togithub.com/googleapis/java-video-live-stream/commit/a6dc9613215968bc7b45b16dd8cd906c1282a8cf))
* Update dependency requests to v2.28.1 ([#118](https://togithub.com/googleapis/java-video-live-stream/issues/118)) ([f0a4e18](https://togithub.com/googleapis/java-video-live-stream/commit/f0a4e188d15381aef2f1af1851686aef38dff0be))
* Update dependency typing-extensions to v4.3.0 ([#99](https://togithub.com/googleapis/java-video-live-stream/issues/99)) ([df3cb4d](https://togithub.com/googleapis/java-video-live-stream/commit/df3cb4d95031010920511a5d4feafa899a7c4499))
* Update dependency zipp to v3.8.1 ([#100](https://togithub.com/googleapis/java-video-live-stream/issues/100)) ([19815e7](https://togithub.com/googleapis/java-video-live-stream/commit/19815e709d5a0793d6e14e3f3b415ba54ddf412a))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

6 participants