Skip to content

Commit 1de27d0

Browse files
authored
Merge pull request awsdocs#65 from jumbosushi/add-sh-to-env-cmd-guide
Update build-env-ref-cmd.md
2 parents 91cb3d7 + ede4371 commit 1de27d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc_source/build-env-ref-cmd.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ You provide a set of commands for AWS CodeBuild to run in a build environment du
77
+ Use the AWS CLI or AWS SDKs to create a build project or change the settings of a build project\. Reference the source code that contains a buildspec file with your commands, or specify a single string that includes the contents of an equivalent buildspec file\. For more information, see [Create a build project](create-project.md) or [Change a build project's settings](change-project.md)\.
88
+ Use the AWS CLI or AWS SDKs to start a build, specifying a buildspec file or a single string that includes the contents of an equivalent buildspec file\. For more information, see the description for the `buildspecOverride` value in [Run a build](run-build.md)\.
99

10-
You can specify any Shell command\. In buildspec version 0\.1, CodeBuild runs each Shell command in a separate instance in the build environment\. This means that each command runs in isolation from all other commands\. Therefore, by default, you cannot run a single command that relies on the state of any previous commands \(for example, changing directories or setting environment variables\)\. To get around this limitation, we recommend that you use version 0\.2, which solves this issue\. If you must use version 0\.1, we recommend the following approaches:
10+
You can specify any Shell Command Language (sh) command\. In buildspec version 0\.1, CodeBuild runs each Shell command in a separate instance in the build environment\. This means that each command runs in isolation from all other commands\. Therefore, by default, you cannot run a single command that relies on the state of any previous commands \(for example, changing directories or setting environment variables\)\. To get around this limitation, we recommend that you use version 0\.2, which solves this issue\. If you must use version 0\.1, we recommend the following approaches:
1111
+ Include a shell script in your source code that contains the commands you want to run in a single instance of the default shell\. For example, you could include a file named `my-script.sh` in your source code that contains commands such as `cd MyDir; mkdir -p mySubDir; cd mySubDir; pwd;`\. Then, in your buildspec file, specify the command `./my-script.sh`\.
1212
+ In your buildspec file or on the **Build commands** setting for the `build` phase only, enter a single command that includes all of the commands you want to run in a single instance of the default shell \(for example, `cd MyDir && mkdir -p mySubDir && cd mySubDir && pwd`\)\.
1313

1414
If CodeBuild encounters an error, the error might be more difficult to troubleshoot compared to running a single command in its own instance of the default shell\.
1515

16-
Commands that are run in a Windows Server Core 2016 image use the Powershell shell\.
16+
Commands that are run in a Windows Server Core 2016 image use the Powershell shell\.

0 commit comments

Comments
 (0)