Skip to content

Support a custom username and password with the deploy script #2009

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/docs/contributing/building-photon.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ An architecture override is required to specify the deploy target's architecture

The `deploy` command is tested against Raspberry Pi coprocessors. Other similar coprocessors may work too.

The `deploy` command also supports a custom username and password, via the `user` and `password` flags. If you want to build the UI while deploying, pass in the `withBuildAndCopyUI` flag.

### Using PhotonLib Builds

The build process automatically generates a vendordep JSON of your local build at `photon-lib/build/generated/vendordeps/photonlib.json`.
Expand Down
16 changes: 15 additions & 1 deletion photon-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ tasks.register('copyClientUIToResources', Copy) {
into "${projectDir}/src/main/resources/web/"
}

tasks.named('processResources') {
dependsOn 'copyClientUIToResources'
}

tasks.register("buildAndCopyUI") {
dependsOn "npm_run_build"
finalizedBy "copyClientUIToResources"
Expand Down Expand Up @@ -74,7 +78,13 @@ remotes {

task findDeployTarget {
doLast {
if(project.hasProperty('tgtIP')){
if(project.hasProperty('tgtIP') && project.hasProperty('user') && project.hasProperty('password')){
//If user specified IP, user, and password, use those to deploy
findDeployTarget.ext.rmt = remotes.pi
findDeployTarget.ext.rmt.host = tgtIP
findDeployTarget.ext.rmt.user = user
findDeployTarget.ext.rmt.password = password
} else if(project.hasProperty('tgtIP')){
//If user specified IP, default to using the PI profile
// but adjust hostname to match the provided IP address
findDeployTarget.ext.rmt = remotes.pi
Expand Down Expand Up @@ -106,9 +116,13 @@ task findDeployTarget {
}

task deploy {
if(project.hasProperty("withBuildAndCopyUI")){
dependsOn 'buildAndCopyUI'
}
dependsOn findDeployTarget
dependsOn 'shadowJar'


doLast {
println 'Starting deployment to ' + findDeployTarget.rmt.host
println 'targetArch = ' + wpilibTools.platformMapper.currentPlatform.platformName
Expand Down
Loading