diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33a53aa..3681ac5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,7 +79,7 @@ fatjar: - ./gradlew fatJarLatest artifacts: paths: - - 'build/libs/provs-fatjar.jar' + - 'build/libs/provs.jar' reports: # To ensure we've access to this file in the next stage dotenv: generate_executables.env @@ -105,8 +105,8 @@ release: ref: '$CI_COMMIT_TAG' assets: links: - - name: provs-fatjar.jar - url: https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${FATJAR_JOB_ID}/artifacts/raw/build/libs/provs-fatjar.jar + - name: provs.jar + url: https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${FATJAR_JOB_ID}/artifacts/raw/build/libs/provs.jar after_script: - echo "---------- End CI ----------" diff --git a/README.md b/README.md index 8abd8a1..82f2a65 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,59 @@ -# Provs-core +# Provs framework +Provs is a framework for automating tasks for provisioning reasons and other purposes. + +It combines +* being able to use the power of shell commands +* a clear and detailed result summary of the built-in execution handling (incl. failure handling and reporting) +* the convenience and robustness of a modern programming language + + +### Write once, run everywhere + +Tasks can be run + +* locally +* remotely +* in a local docker container +* in a remote container + +Additionally, it is possible to define a custom processor if needed. -This repo is part of the [provs framework](https://gitlab.com/domaindrivenarchitecture/provs-docs). It provides the core component with -* execution engine -* failure handling -* multiple execution processors -* execution summary and logging -* support for secrets ## Usage -For usage examples it is recommended to have a look at [provs-scripts](https://gitlab.com/domaindrivenarchitecture/provs-scripts) or provs-ubuntu-extensions. +### Prerequisites + +* A **Java Virtual machine** (JVM) is required. +* Download the latest `provs.jar` from: https://gitlab.com/domaindrivenarchitecture/provs/-/releases + + +### Show usage options + + +`java -jar provs.jar -h` + +### Provision a desktop workplace locally + +Ensure a config file is in place (default config file name is "WorkplaceConfig.yaml") with at least the workplace type specified, e.g. +```type: MINIMAL``` + +Possible types are currently: MINIMAL, OFFICE or IDE. + +Run: + +`java -jar provs.jar -l` + +### Provision a desktop workplace remotely + +`java -jar provs.jar -i -r -u ` + +You'll be prompted for the password of the remote user. + + +## Build the jar-file yourself + +* Clone this repo +* Build the fatjar file by `./gradlew fatJarLatest` +* In folder build/libs you'll find the file `provs.jar` + +The fatjar is a Java jar-file incl. all required dependencies. diff --git a/build.gradle b/build.gradle index d6edc08..68d6f6a 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization' group = 'org.domaindrivenarchitecture.provs' -version = '0.8.21-SNAPSHOT' +version = '0.8.21' repositories { mavenCentral() @@ -98,7 +98,7 @@ task fatJarLatest(type: Jar) { 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' } with jar - archiveFileName = 'provs-fatjar.jar' + archiveFileName = 'provs.jar' } task uberjarWorkplace(type: Jar) { diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt index e765e4f..82a9069 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt @@ -12,9 +12,6 @@ import java.io.File /** * Provisions according to the options either a meissa workplace, reposOnly or gopassOnly. * Locally or on a remote machine. If remotely, the remote host and remote user are specified by args parameters. - * - * Get help with: - * java -jar build/libs/provs-meissa-latest.jar meissa.provs.application.CliKt main -h */ fun main(args: Array) { val cliCommand = parseCli(args) @@ -77,7 +74,7 @@ private fun retrievePassword(cliCommand: CliCommand): Secret? { if (cliCommand.isValidRemote()) { if (cliCommand.sshWithPasswordPrompt) { password = - PromptSecretSource("Password for user $cliCommand.userName!! on $cliCommand.remoteHost!!").secret() + PromptSecretSource("Password for user ${cliCommand.userName!!} on ${cliCommand.remoteHost!!}").secret() } else if (cliCommand.sshWithGopassPath != null) { password = GopassSecretSource(cliCommand.sshWithGopassPath).secret() } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/CliCommand.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/CliCommand.kt index 1a04831..1999670 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/CliCommand.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/CliCommand.kt @@ -39,9 +39,7 @@ class CliCommand( } fun parseCli(args: Array): CliCommand { - val parser = ArgParser("provs") - - val configFileName by parser.argument(ArgType.String, description = "the config file name to apply").optional() + val parser = ArgParser("java -jar provs.jar") val remoteHost by parser.option( ArgType.String, shortName = @@ -51,6 +49,11 @@ fun parseCli(args: Array): CliCommand { ArgType.Boolean, shortName = "l", description = "provision to local machine - either localHost or remoteHost must be specified" ) + val configFileName by parser.option( + ArgType.String, + shortName = "c", + description = "the config file name to apply" + ).default("WorkplaceConfig.yaml") val userName by parser.option( ArgType.String, shortName = "u",