In a CodePipeline stage, you can specify parameter overrides for AWS CloudFormation actions. Parameter overrides let you specify template parameter values that override values in a template configuration file. AWS CloudFormation provides functions to help you to specify dynamic values (values that are unknown until the pipeline runs).
Override Jenkins stage Function
For example, in your pipeline, you might have a source stage where CodePipeline copies your AWS Lambda function source code to the artifact store. In the next stage, you have an AWS CloudFormation template that creates the Lambda function, but AWS CloudFormation requires the file name to create the function. You must use the Fn::GetArtifactAtt function to pass the exact S3 bucket and file names.
The following parameter overrides specify the BucketName and ObjectKey parameters by retrieving the S3 bucket name and file name of the LambdaFunctionSource artifact. This example assumes that CodePipeline copied Lambda function source code and saved it as an artifact, for example, as part of a source stage.
In a subsequent stage, stack B uses the outputs from stack A. In the ParameterOverrides property, the example uses the Fn::GetParam function to specify the StackBInputParam parameter. The resulting value is the value associated with the StackAOutputName key.
There are several built-inhelper functionsto simplify some common use cases. These functions allow you to do things likeaccess a particular stage by name, strip non-alphanumerical characters out of astring, or parse JSON.
Context values are similar to helper properties, except that they are specificto a particular stage. This includes the stage name, status, start or end time,and so on. You can use context values in combination with the #stage helperfunction to access properties of a particular stage. For example,$#stage("Deploy to Prod")["type"] returns the stage type (in this case,deploy).
We can override environment variables, but there are some limitations to it. Any variable defined in the pipeline environment block can be overridden in the local stage environment. We can check this by overriding the USER_ID to 32, and this variable will override the variable from the pipeline level environment.
I think sls invoke local -f myFunction -p /path/to/event.json is one of the most useful commands in my toolbox. Not only can you live test functions locally by simulating events, but you can completely manipulate the environment by passing in the -s flag with a stage name.
Typically, this is used for natural classification. For example, we could have a group called environments that includes the groups dev, stage, prod. This means we could set variables in the environment group and override them in the dev group. You could similarly have a parent group called functions that contains the groups web, database, and loadbalancer.
This usage does not solve the problem of group intersection since child groups only override their parents. Child groups can override variables within the parent, but the above organization has not established any relationship between group categories, like environments and functions. The variable precedence between the two categories is still undefined.
When two or more threads attempt to complete, completeExceptionally, or cancel a CompletableFuture, only one of them succeeds. In addition to these and related methods for directly manipulating status and results, CompletableFuture implements interface CompletionStage with the following policies: Actions supplied for dependent completions of non-async methods may be performed by the thread that completes the current CompletableFuture, or by any other caller of a completion method.
All async methods without an explicit Executor argument are performed using the ForkJoinPool.commonPool() (unless it does not support a parallelism level of at least two, in which case, a new Thread is created to run each task). To simplify monitoring, debugging, and tracking, all generated asynchronous tasks are instances of the marker interface CompletableFuture.AsynchronousCompletionTask.
All CompletionStage methods are implemented independently of other public methods, so the behavior of one method is not impacted by overrides of others in subclasses.
CompletableFuture also implements Future with the following policies: Since (unlike FutureTask) this class has no direct control over the computation that causes it to be completed, cancellation is treated as just another form of exceptional completion. Method cancel has the same effect as completeExceptionally(new CancellationException()). Method isCompletedExceptionally() can be used to determine if a CompletableFuture completed in any exceptional fashion.
In case of exceptional completion with a CompletionException, methods get() and get(long, TimeUnit) throw an ExecutionException with the same cause as held in the corresponding CompletionException. To simplify usage in most contexts, this class also defines methods join() and getNow(T) that instead throw the CompletionException directly in these cases.
Since:1.8Nested Class SummaryNested Classes Modifier and TypeClass and Descriptionstatic interface CompletableFuture.AsynchronousCompletionTaskA marker interface identifying asynchronous tasks produced by async methods.Constructor SummaryConstructors Constructor and DescriptionCompletableFuture()Creates a new incomplete CompletableFuture.Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and TypeMethod and DescriptionCompletableFutureacceptEither(CompletionStage other, Runnable action, Executor executor)Returns a new CompletionStage that, when this and the other given stage complete normally, executes the given action using the supplied executor.CompletableFuturerunAfterEither(CompletionStage other, Runnable action)Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action.CompletableFuturerunAfterEitherAsync(CompletionStage other, Runnable action)Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using this stage's default asynchronous execution facility.CompletableFuturerunAfterEitherAsync(CompletionStage other, Runnable action, Executor executor)Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using the supplied executor.static CompletableFuturerunAsync(Runnable runnable)Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool.commonPool() after it runs the given action.static CompletableFuturerunAsync(Runnable runnable, Executor executor)Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action.static CompletableFuturesupplyAsync(Supplier supplier)Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool.commonPool() with the value obtained by calling the given Supplier.static CompletableFuturesupplyAsync(Supplier supplier, Executor executor)Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier.CompletableFuturethenAccept(Consumer other, Runnable action, Executor executor)Description copied from interface: CompletionStageReturns a new CompletionStage that, when this and the other given stage complete normally, executes the given action using the supplied executor. See the CompletionStage documentation for rules covering exceptional completion.Specified by:runAfterBothAsync in interface CompletionStageParameters:other - the other CompletionStageaction - the action to perform before completing the returned CompletionStageexecutor - the executor to use for asynchronous executionReturns:the new CompletionStageapplyToEitherpublic CompletableFuture applyToEither(CompletionStage other, Runnable action, Executor executor)Description copied from interface: CompletionStageReturns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using the supplied executor. See the CompletionStage documentation for rules covering exceptional completion.Specified by:runAfterEitherAsync in interface CompletionStageParameters:other - the other CompletionStageaction - the action to perform before completing the returned CompletionStageexecutor - the executor to use for asynchronous executionReturns:the new CompletionStagethenComposepublic CompletableFuture thenCompose(Function
By default, the config-overrides.js file exports a single function to use when customising the webpack configuration for compiling your react app in development or production mode. It is possible to instead export an object from this file that contains up to three fields, each of which is a function. This alternative form allows you to also customise the configuration used for Jest (in testing), and for the Webpack Dev Server itself.
The webpack field is used to provide the equivalent to the single-function exported from config-overrides.js. This is where all the usual rewires are used. It is not able to configure compilation in test mode because test mode does not get run through Webpack at all (it runs in Jest). It is also not able to be used to customise the Webpack Dev Server that is used to serve pages in development mode because create-react-app generates a separate Webpack configuration for use with the dev server using different functions and defaults.
The jest field in the module.exports object in config-overrides.js is used to specify a function that can be called to customise the Jest testing configuration in ways that are not possible in the jest section of the package.json file. For example, it will allow you to change some configuration options based on environment variables. This function is passed the default create-react-app Jest configuration as a parameter and is required to return the modified Jest configuration that you want to use. A lot of the time you'll be able to make the configuration changes needed simply by using a combination of the package.json file's jest section and a .babelrc file (or babel section in package.json) instead of needing to provide this jest function in config-overrides.js. 2ff7e9595c
Comments