-
Notifications
You must be signed in to change notification settings - Fork 305
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
Integrated code lifecycle
: Unify ssh usage config condition for build agents
#10293
base: develop
Are you sure you want to change the base?
Integrated code lifecycle
: Unify ssh usage config condition for build agents
#10293
Conversation
Integrated code lifecycle
: Unify ssh config for build agents
…uild-agent-ssh-config
…uild-agent-ssh-config
Integrated code lifecycle
: Unify ssh config for build agentsIntegrated code lifecycle
: Unify ssh usage condition for build agents
Integrated code lifecycle
: Unify ssh usage condition for build agentsIntegrated code lifecycle
: Unify ssh usage config condition for build agents
…uild-agent-ssh-config
…uild-agent-ssh-config
…uild-agent-ssh-config
…uild-agent-ssh-config
…uild-agent-ssh-config
WalkthroughThis pull request updates the Changes
Sequence Diagram(s)sequenceDiagram
participant UA as User/Application
participant CFG as Configuration Provider
participant GS as BuildJobGitService
UA->>GS: Initialize build job
GS->>CFG: Retrieve setting for SSH usage (useSshForBuildAgent)
CFG-->>GS: Return SSH configuration value
alt SSH enabled
GS->>GS: Call init() and validate sshUrlTemplate
GS-->>UA: Throw RuntimeException if sshUrlTemplate is missing
else
GS->>GS: Proceed without SSH
end
UA->>GS: Request Git URI via getGitUri()
GS->>GS: Call overridden useSsh() method
GS-->>UA: Return appropriate Git URI based on SSH configuration
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobGitService.java (1)
78-80
: Consider using a more specific exception type.While the validation logic is correct, consider using a more specific exception type like
IllegalStateException
instead ofRuntimeException
to better indicate the nature of the configuration error.- throw new RuntimeException("No SSH url template was set but should use SSH for build agent authentication."); + throw new IllegalStateException("No SSH url template was set but should use SSH for build agent authentication.");
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobGitService.java
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/main/java/**/*.java`: naming:CamelCase; principles:{sin...
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobGitService.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobGitService.java (3)
48-49
: LGTM!The field declaration follows Java naming conventions and correctly uses constructor injection with a default value of
false
for backward compatibility.
53-65
: LGTM!The method is well-documented and correctly implements the override to use the configuration value, aligning with the PR objectives.
104-104
: LGTM!The implementation correctly uses the overridden
useSsh()
method to determine the URI type, maintaining consistency with the new SSH configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm, would be great if you could add it in the template application.properties with a descriptive comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code 👍
dd9f329
Thanks good idea, I added it in application-localvc.yml with a small comment. Does it make sense to you like this? |
…uild-agent-ssh-config
Checklist
General
Server
Motivation and Context
While trying to find right configuration values I found the current behaviour of config
artemis.version-control.build-agent-use-ssh
quite confusing.artemis.version-control.build-agent-use-ssh
actually only controls wether a keypair will be generated at the startup of an buildagent and what the getPublicKeyAsString() method returns (this result is stored in the hazelcast map where core nodes can read it).However, the actual condition wether the build agent will configure ssh in the BuildJobGitService currently depends on the useSsh() method in the parent AbstractGitService which returns true if the 2 configuration values
ssh-host-key-path
andssh-template-clone-url
are present.Currently configuring
build-agent-use-ssh: false
butssh-host-key-path
andssh-template-clone-url
being present will not create a keypair, and not push the public key into the hazelcast store, but still try configure ssh on the build agent.If keys get manually generated in the configured
ssh-template-clone-url
and thisbuild-agent-use-ssh
is supposed to just prevent the creation of a new key thenbuild-agent-use-ssh:false
would also prevent public key being put into hazelcast (because getPublicKeyAsString() returns null then.) Which seems weird.Description
I suggest to override
useSsh()
in BuildJobGitService to check on configurationbuild-agent-use-ssh
to be consistent with the conditions for generating the keypair and throwing a RuntimeException ifbuild-agent-use-ssh:true
but nossh-template-clone-url
is setSteps for Testing
Testserver States
You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.
Review Progress
Code Review
Manual Tests
Test Coverage
Summary by CodeRabbit