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

Setup Github Actions that deploy our hello-strongbox-* to the Github Package Registry #1927

Open
6 of 8 tasks
carlspring opened this issue Oct 21, 2020 · 22 comments
Open
6 of 8 tasks
Labels

Comments

@carlspring
Copy link
Member

carlspring commented Oct 21, 2020

Task Description

We need to create a Github Action for the strongbox-examples that deploys the artifacts for each of layout providers (that we have an image for) to the Github Package Registry for the strongbox-examples.

You will need to create a fork and set this up in your fork first.

Tasks

The following tasks will need to be carried out:

Task Relationships

This task:

  • Is required for:

Useful Links

Help

@carlspring carlspring added help wanted testing hacktoberfest Pre-selected issues for Hacktoberfest labels Oct 21, 2020
@BjoernAkAManf
Copy link
Contributor

Hi,

this sounds easy. Should the actions somehow also use an installed strongbox installation or merely build + deploy to github actions. While the former sound complicated, the latter seems "pointless"? Am i missing something here?

Would gladly help otherwise :)

@carlspring
Copy link
Member Author

Hi @BjoernAkAManf ,

The point of this task is so that we can later on use these dependencies for testing Strongbox's behaviour when proxying to the Github Package Registry. I will create a follow-up task for this as well. So, to answer your question -- no, it should not be deploying to Strongbox at all right now, just to the Github Package Registry.

Feel free to pick this up! :)

@j4ckofalltrades might pick up some of the sub-tasks as well.

@BjoernAkAManf
Copy link
Contributor

Ah thanks! Guess i'll go and write some github actions code then 😄 .

@BjoernAkAManf
Copy link
Contributor

BjoernAkAManf commented Oct 21, 2020

Took more attempts than i wanted it to, however now it builds jars into the package repository.
Just to clarify, is that what you meant by:

  • Create a Github Action that deploys the hello-strongbox-maven into the Github Package Registry.

See:
https://github.com/BjoernAkAManf/strongbox-examples-actions/blob/main/.github/workflows/maven.yml
https://github.com/BjoernAkAManf/strongbox-examples-actions/packages/466292

@carlspring
Copy link
Member Author

Awesome, thanks! :)

So, you now have the Maven one covered! Would you like to do the rest of the ones that use Maven repositories as well (first)?

@BjoernAkAManf
Copy link
Contributor

Sure i can do that.

@j4ckofalltrades
Copy link
Contributor

j4ckofalltrades commented Oct 22, 2020

@BjoernAkAManf @carlspring I'm currently looking into hello-strongbox-npm, fyi. Also found this cool repo that lets you run GitHub Actions locally.

Update: Looking into hello-strongbox-nuget-* next.

@carlspring
Copy link
Member Author

Thanks, @j4ckofalltrades ! This project looks quite useful and I'm sure we'll be using it to try out more of our Github Actions with it in the future!

cc: @steve-todorov

@carlspring
Copy link
Member Author

@BjoernAkAManf : How are things going with the Maven-based actions?

@carlspring carlspring changed the title Setup a Github Action that deploys our hello-strongbox-* to the Github Package Registry Setup Github Actions that deploys our hello-strongbox-* to the Github Package Registry Oct 25, 2020
@carlspring carlspring changed the title Setup Github Actions that deploys our hello-strongbox-* to the Github Package Registry Setup Github Actions that deploy our hello-strongbox-* to the Github Package Registry Oct 25, 2020
@j4ckofalltrades
Copy link
Contributor

Just an fyi regarding authentication in GitHub Action workflows, this pertains to the GITHUB_TOKEN secret that is used when publishing artifacts to the GitHub Package Registry. This is automatically provided by GitHub for every repository and can be referenced with ${{ secrets.GITHUB_TOKEN }}.

See https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret for more info.

@carlspring
Copy link
Member Author

Thanks for the clarification, @j4ckofalltrades ! :)

There's something else that we'll need to address -- the non-Maven-based tool have no concept of snapshots, which means that every time we merge a pull request, the NPM, NuGet and so on Github Actions will fail. Is there a reasonable way in which we can handle this for these? Can we remove the artifacts before deploying them? (They're all using fixed versions such as 1.0.0, right?).

cc: @steve-todorov

@j4ckofalltrades ,

Please, feel free to pick up the Maven and SBT ones as well. We haven't heard back from @BjoernAkAManf, nor seen a pull request for them yet, so I assume it would be safe to proceed with them as well. (Please, feel free to give us a shout, if this is not so, @BjoernAkAManf).

@j4ckofalltrades
Copy link
Contributor

j4ckofalltrades commented Oct 26, 2020

@carlspring

Can we remove the artifacts before deploying them? (They're all using fixed versions such as 1.0.0, right?).

Unfortunately this isn't possible for public repos / packages. From GitHub docs:

About public package deletion
To avoid breaking projects that may depend on your packages, you cannot delete an entire public package or specific versions of a public package.

Under special circumstances, such as for legal reasons or to conform with GDPR standards, you can ask GitHub Support to delete a public package for you, using our contact form.

We could maybe skip the publish step as an alternative e.g. nuget push has a -SkipDuplicate option which does this.

@carlspring
Copy link
Member Author

We could maybe skip the publish step as an alternative e.g. nuget push has a -SkipDuplicate option which does this.

Yeah, we should probably do this.

@carlspring
Copy link
Member Author

@j4ckofalltrades : Could you please make the artifact names more consistent? If possible, they should all be using the following format: hello-strongbox-*?

@BjoernAkAManf
Copy link
Contributor

Sorry to reply so late, have been unexpectedly busy the last couple of days.

I'll add the maven artifact to the github repository now, but otherwise i'll probably wont be able to help the next days.

@carlspring
Copy link
Member Author

Thanks @BjoernAkAManf ! I think that it will be better, if @j4ckofalltrades does the remainder of the sub-tasks, as he's already done with most of the work anyway.

@j4ckofalltrades , @steve-todorov : Could you please review strongbox/strongbox-examples#28? Thanks! :)

@carlspring
Copy link
Member Author

@j4ckofalltrades , @BjoernAkAManf , @steve-todorov ,

There is another problem with the deployment of all these artifacts that I've realized. Basically, when an example sub-module has been changed, we will need to bump the versions for all of the other ones as well, because if they have already been deployed to the Github Package Registry, then the deployment for all of them will fail.

Do you guys have any suggestions on how we could easily sort this our for all of them? Should we use the maven-versions-plugin to bump the version on each merged to master (and add a step for this as well)?

@steve-todorov
Copy link
Member

maven-versions-plugin will only work for maven artifacts (sbt, mvn and maybe groovy?). npm uses the package.json and it would need additional work to update the version. We could try doing it :)

However, we'll then need to address this as well:
strongbox/strongbox-examples#28 (comment)

@j4ckofalltrades
Copy link
Contributor

j4ckofalltrades commented Oct 29, 2020

One other option is to append the latest commit hash (maybe trimmed to first ~6-10 characters) to the version number. like in https://maven.apache.org/maven-ci-friendly.html and it should be fairly simple to do in other non-Maven based artifacts as well.

GitHub Actions provides it via the GITHUB_SHA environment variable.

@carlspring
Copy link
Member Author

Another option would be to switch the version to YYYYMMDD-hhmm or something along these lines.

@carlspring
Copy link
Member Author

carlspring commented Oct 29, 2020

The hash would probably be easier and cleaner, but it would also be less human-intelligible (and it would be hard to tell what the latest version is, unless you look it up via the commit history). Not that anyone would really be using these artifacts for anything else than testing our integration with the Github Package Registry via Strongbox.

@j4ckofalltrades
Copy link
Contributor

@carlspring

Okay let's go with the append timestamp yyyyMMdd-hhmm to the version approach. I've opened pull requests for updating the existing gradle workflow strongbox/strongbox-examples#31 plus the other remaining mvn-based ones - sbt strongbox/strongbox-examples#30 and ant-ivy strongbox/strongbox-examples#32.

If all good then it should also be applied to the maven workflow.

BjoernAkAManf added a commit to BjoernAkAManf/strongbox-examples that referenced this issue Nov 13, 2020
@steve-todorov steve-todorov removed the hacktoberfest Pre-selected issues for Hacktoberfest label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants