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

Publish project binairies to Maven Repository Manager #232

Conversation

alecharp
Copy link
Collaborator

@alecharp alecharp commented Mar 2, 2023

Description

Resolves #231.

The main idea behind the split of the source of the application into modules is to allow external parties to create their own Probe and Scoring implementation and ran their version of the project.
However, the binaries necessary for this are not published to the Maven Repository Manager so those external parties cannot get the dependencies.

As this is a build modification, this is the test.

Submitter checklist

  • If the issue exists, it is well described and linked in the description
  • The description of this pull request is detailed and explain why this pull request is needed
  • The changeset is on a specific branch
    • feature/ for new feature, or improvements
    • fix/ for bug fixes
    • docs/ for any documentation changes
  • If required, the documentation has been updated
  • There is automated tests to cover the code change / addition
    • If there is no test, include an explanation why in the description
  • Run mvn verify locally and all tests are passing successfully
    • It is OK to create a pull request which has failing tests if it is created as a draft, is to fix a bug and the first commit is the test to prove the existence of the bug.
  • There is no new warnings (checkstyle nor spotbugs) on the code

@alecharp alecharp added the chore Related to the project configuration label Mar 2, 2023
@alecharp alecharp changed the title Chore/publish project java binaries Publish project binairies to Maven Repository Manager Mar 2, 2023
Jenkinsfile Outdated Show resolved Hide resolved
Jenkinsfile Outdated Show resolved Hide resolved
Thanks @lemeurherve

Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>
Jenkinsfile Outdated Show resolved Hide resolved
@alecharp
Copy link
Collaborator Author

alecharp commented Mar 2, 2023

It seems that the latest build error is due to authentication issue to deploy the binary to repo.jenkins-ci.io.

@dduportal
Copy link
Contributor

It seems that the latest build error is due to authentication issue to deploy the binary to repo.jenkins-ci.io.

As far as I can tell, infra.ci.jenkins.io does not have any credential allowing deployment to repo.jenkins-ci.org, because it was not designed for this use case.

There are multiple solutions for the next steps:

  • Allow deployment from infra.ci.jenkins.io, but restricted:

    • Only allowed to publish to a specific hosted repository (that may, or may not be aggrregated in repo.jenkins-ci.org/public => to be discussed)
    • Define a technical account with its credential (and credential rotation using the team calendar) only in the job in charge of thte deployment
  • Use the same CD process as plugins : safer but requires using GitHub Action for this task

@lemeurherve
Copy link
Member

lemeurherve commented Mar 3, 2023

There are multiple solutions for the next steps

We could also inverse the phase, "deploy" on ci.jenkins.io, and "verify" on infra.ci.jenkins.io, much simpler IMO.

ci.jenkins.io doesn't have the credentials either.

@alecharp
Copy link
Collaborator Author

I'm not sure I want to use a GHA for something we (Jenkins community) should support.

@alecharp
Copy link
Collaborator Author

For the moment, this is not mandatory. We can revisit this when it is.

@alecharp alecharp closed this Mar 14, 2023
@dduportal
Copy link
Contributor

I'm not sure I want to use a GHA for something we (Jenkins community) should support.

The safe, supported and automated way for deploying artefacts other than Jenkins Core to the Maven repository is the CD process.

Using Jenkins instead of GHA for this (an eventual cd.jenkins.io) is theorically posible but would require a JEP to have a disucssion and problem statement on the impacts (effort, risk analysis, advantages, etc.).

As much as I would like to use Jenkins everywhere in term of "public image", as much the effort for using it on a public project is a different matter : the impact on public image of code injection on a public artefact is clearly a risk compared to accepting that GHA is not an enemy or a concurent, but a tool that provides its benefit when needed.

For the moment, this is not mandatory. We can revisit this when it is.

No problem, we (jenkins infra) started to brainstorm on the solution we could provide specifically for the plugin health to map it to other components that are deployed.
If you have another of the jenkinsci or jenkins-infra projects in mind that already deploys to JFrog, we could check it to build a nice solution for these "exceptions" (e.g. not plugin, not core).

@alecharp do you know if Maven can use a GitHub release's published artifact (or if there could be a Maven repository per repository, that could, then, be mirrored on JFrog) ?

@alecharp
Copy link
Collaborator Author

For the moment, I don't think the project is as a state where (almost) all commit to main branch requires a release. So the CD process applied to Jenkins plugins is not suited for the project. This might evolves later but for now, I prefer to do the releases myself.

As the deployment of the project is in fact controlled by infra.ci.jenkins.io, the release process on my laptop is just generating a tag. The CI is then generating the binaries and the Docker image, deploy it to hub and that's it. The process to deploy the binaries could be controlled the same way where only infra.ci.jenkins.io could have to credentials to deploy to JFrog.

@alecharp do you know if Maven can use a GitHub release's published artifact (or if there could be a Maven repository per repository, that could, then, be mirrored on JFrog) ?

it seems to be technically possible (https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry) but that would mean to give infra.ci.jenkins.io permissions to write on the repository, no?

Not sure about the mirroring nor if, with the effort to reduce the bandwidth, it is something we should do. Users would just have to mirror the GitHub repository themself or declare it in their pom.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to the project configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish Maven binaries for core and test modules
3 participants