Unverified Commit 6d699e2d authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

option to use env variables instead of prompring for username and password

parent ff16099f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@
	<modelVersion>4.0.0</modelVersion>
	<modelVersion>4.0.0</modelVersion>
	<groupId>fr.mines-stetienne.ci.saref</groupId>
	<groupId>fr.mines-stetienne.ci.saref</groupId>
	<artifactId>saref-pipeline</artifactId>
	<artifactId>saref-pipeline</artifactId>
	<version>1.0.4</version>
	<version>1.0.5</version>
	<packaging>jar</packaging>
	<packaging>jar</packaging>


	<name>SAREF-Pipeline</name>
	<name>SAREF-Pipeline</name>
+8 −2
Original line number Original line Diff line number Diff line
@@ -157,7 +157,10 @@ public class CLIExecution implements SAREFCredentialsProvider {


	@Override
	@Override
	public String getUsername(String hostName) {
	public String getUsername(String hostName) {
		if (console != null) {
		if (System.getenv("ETSI_LABS_USERNAME") != null) {
			LOG.info("using username 'ETSI_LABS_USERNAME'");
			return System.getenv("ETSI_LABS_USERNAME");
		} else if (console != null) {
			return console.readLine(SAREF.getMessage(MESSAGE.account_name.toString(), hostName));
			return console.readLine(SAREF.getMessage(MESSAGE.account_name.toString(), hostName));
		} else if (System.getenv("GITLAB_CI") != null) {
		} else if (System.getenv("GITLAB_CI") != null) {
			LOG.info("using username 'gitlab-ci-token'");
			LOG.info("using username 'gitlab-ci-token'");
@@ -170,7 +173,10 @@ public class CLIExecution implements SAREFCredentialsProvider {


	@Override
	@Override
	public char[] getPassword(String hostName) {
	public char[] getPassword(String hostName) {
		if (console != null) {
		if (System.getenv("ETSI_LABS_PASSWORD") != null) {
			LOG.info("using password environment variable 'ETSI_LABS_PASSWORD'");
			return System.getenv("ETSI_LABS_PASSWORD").toCharArray();
		} if (console != null) {
			return console.readPassword(SAREF.getMessage(MESSAGE.account_password.toString(), hostName));
			return console.readPassword(SAREF.getMessage(MESSAGE.account_password.toString(), hostName));
		} else if (System.getenv("GITLAB_CI") != null) {
		} else if (System.getenv("GITLAB_CI") != null) {
			LOG.info("using password environment variable GITLAB_CI");
			LOG.info("using password environment variable GITLAB_CI");