/** * Overrides all values in the map by the given map. * See {@link #override(String, String)}. * @return this */ public EnvVars overrideAll(Map<String,String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(),e.getValue()); } return this; }
private void withRegion(@Nonnull EnvVars localEnv) throws IOException, InterruptedException { if (!StringUtils.isNullOrEmpty(this.step.getRegion())) { this.getContext().get(TaskListener.class).getLogger().format("Setting AWS region %s %n ", this.step.getRegion()); localEnv.override(AWSClientFactory.AWS_DEFAULT_REGION, this.step.getRegion()); localEnv.override(AWSClientFactory.AWS_REGION, this.step.getRegion()); this.envVars.overrideAll(localEnv); } }
private void withProfile(@Nonnull EnvVars localEnv) throws IOException, InterruptedException { if (!StringUtils.isNullOrEmpty(this.step.getProfile())) { this.getContext().get(TaskListener.class).getLogger().format("Setting AWS profile %s %n ", this.step.getProfile()); localEnv.override(AWSClientFactory.AWS_DEFAULT_PROFILE, this.step.getProfile()); localEnv.override(AWSClientFactory.AWS_PROFILE, this.step.getProfile()); this.envVars.overrideAll(localEnv); } }
/** * Overrides all values in the map by the given map. Expressions in values will be expanded. * See {@link #override(String, String)}. * @return {@code this} */ public EnvVars overrideExpandingAll(@Nonnull Map<String,String> all) { for (String key : new OverrideOrderCalculator(this, all).getOrderedVariableNames()) { override(key, expand(all.get(key))); } return this; }
private void withEndpointUrl(@Nonnull EnvVars localEnv) throws IOException, InterruptedException { if (!StringUtils.isNullOrEmpty(this.step.getEndpointUrl())) { this.getContext().get(TaskListener.class).getLogger().format("Setting AWS endpointUrl %s %n ", this.step.getEndpointUrl()); localEnv.override(AWSClientFactory.AWS_ENDPOINT_URL, this.step.getEndpointUrl()); this.envVars.overrideAll(localEnv); } }
@Override public void expand(EnvVars env) throws IOException, InterruptedException { env.override("SSH_AUTH_SOCK", execution.getSocket()); } }
private void withFederatedUserId(@Nonnull EnvVars localEnv) { if (!StringUtils.isNullOrEmpty(this.step.getFederatedUserId())) { AWSSecurityTokenService sts = AWSClientFactory.create(AWSSecurityTokenServiceClientBuilder.standard(), this.envVars); GetFederationTokenRequest getFederationTokenRequest = new GetFederationTokenRequest(); getFederationTokenRequest.setDurationSeconds(this.step.getDuration()); getFederationTokenRequest.setName(this.step.getFederatedUserId()); getFederationTokenRequest.setPolicy(ALLOW_ALL_POLICY); GetFederationTokenResult federationTokenResult = sts.getFederationToken(getFederationTokenRequest); Credentials credentials = federationTokenResult.getCredentials(); localEnv.override(AWSClientFactory.AWS_ACCESS_KEY_ID, credentials.getAccessKeyId()); localEnv.override(AWSClientFactory.AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); localEnv.override(AWSClientFactory.AWS_SESSION_TOKEN, credentials.getSessionToken()); this.envVars.overrideAll(localEnv); } }
@Override public void expand(EnvVars env) throws IOException, InterruptedException { env.override("WORKSPACE", path); } }
/** * Overrides all values in the map by the given map. * See {@link #override(String, String)}. * @return this */ public EnvVars overrideAll(Map<String,String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(),e.getValue()); } return this; }
/** * Overrides all values in the map by the given map. * See {@link #override(String, String)}. * @return this */ public EnvVars overrideAll(Map<String,String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(),e.getValue()); } return this; }
/** * Overrides all values in the map by the given map. See * {@link #override(String, String)}. * * @return this */ public EnvVars overrideAll(Map<String, String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(), e.getValue()); } return this; }
/** * Overrides all values in the map by the given map. * See {@link #override(String, String)}. * @return this */ public EnvVars overrideAll(Map<String,String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(),e.getValue()); } return this; }
/** * Overrides all values in the map by the given map. * See {@link #override(String, String)}. * @return this */ public EnvVars overrideAll(Map<String,String> all) { for (Map.Entry<String, String> e : all.entrySet()) { override(e.getKey(),e.getValue()); } return this; }
@Override public void expand(EnvVars env) throws IOException, InterruptedException { env.override("DYNVAR", execution.value); } }
/** * Expands the list of environment variables by inheriting current env variables. */ private static EnvVars inherit(Map<String,String> overrides) { EnvVars m = new EnvVars(EnvVars.masterEnvVars); for (Map.Entry<String,String> o : overrides.entrySet()) m.override(o.getKey(),m.expand(o.getValue())); return m; }
/** * Expands the list of environment variables by inheriting current env * variables. */ private static EnvVars inherit(Map<String, String> overrides) { EnvVars m = new EnvVars(EnvVars.masterEnvVars); for (Map.Entry<String, String> o : overrides.entrySet()) { m.override(o.getKey(), m.expand(o.getValue())); } return m; } /**
/** * Expands the list of environment variables by inheriting current env variables. */ private static EnvVars inherit(Map<String,String> overrides) { EnvVars m = new EnvVars(EnvVars.masterEnvVars); for (Map.Entry<String,String> o : overrides.entrySet()) m.override(o.getKey(),m.expand(o.getValue())); return m; }
/** * Expands the list of environment variables by inheriting current env variables. */ private static EnvVars inherit(Map<String,String> overrides) { EnvVars m = new EnvVars(EnvVars.masterEnvVars); for (Map.Entry<String,String> o : overrides.entrySet()) m.override(o.getKey(),m.expand(o.getValue())); return m; }
/** * Overrides all values in the map by the given map. Expressions in values will be expanded. * See {@link #override(String, String)}. * @return {@code this} */ public EnvVars overrideExpandingAll(@Nonnull Map<String,String> all) { for (String key : new OverrideOrderCalculator(this, all).getOrderedVariableNames()) { override(key, expand(all.get(key))); } return this; }
@Override protected EnvVars getEnvironment(FilePath pwd, EnvVars environment) { // Check if conversion required if (!convert) // If not required return the environment directly return environment; // Get a new one environment = new EnvVars(environment); // Add the working directory in the path so `./` are useless on UNIX environment.override("PATH+", pwd.getRemote()); // Return the environment return environment; }