In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
The Build process is often complex, so TeamCtiy allows you to implement different application scenarios through build steps. You can do only one thing per build step, and then organize a series of build steps to execute sequentially to complete the build process. First, take a look at the overview of build step configuration:
Each Build step corresponds to a build runner that does the real work behind it. What we need to do is to conceive the process of build and then implement it through a series of build steps. During the build process, these build steps are executed sequentially one after another. Of course, you can easily arrange the order of your build steps through the UI provided by TeamCity.
Execution strategy of Build steps
TeamCity determines whether to run the next build step based on the return status of the previous build step and the current build status. The state of the build step is determined to fail when the following conditions are met: the execution of the build step returns a non-zero exit code and the failure condition of the build is configured to work. In other cases, the status of the build step is considered successful.
We can specify different execution strategies in the build step to tell TeamCity whether or not to perform the next build step:
Only if build status is successful
This step is performed only if the entire build is in a successful state.
Before starting to run the build step, build agent requests the status of the entire build from the TeamCity Server, and skips the execution of the step if the state of the build has already failed.
If all previous steps finished successfully
All previous build steps must be successful.
This type does not send requests to TeamCity Server, but only analyzes whether previous build steps have failed.
Even if some of previous steps failed
Even if the previous build step fails, it will be executed.
The build step is executed regardless of whether the previous build step has failed or the state of the entire build has failed.
Always, even if build stop command was issued
Always execute, even if you receive a command to stop build, to execute the build step.
Even if the user cancels the execution of the entire build in the previous build step, the build step will still be executed. But during the execution of this build step, if you cancel build, you can terminate its execution.
Next we will demonstrate how to create a command line type build step.
Add Build steps manually
TeamCity provides a very intelligent "Auto-detect build steps" function, mainly to search for recognizable compiled configuration files in the VCS directory and then automatically generate build steps. This approach is relatively simple, and we mainly introduce ways to manually configure build steps that can support complex configurations, so please select "Add build step".
Runner type
TeamCity has built-in support for almost all build types:
We can choose the build type of our own project, and of course we can choose a more generic type: Command Line. It can execute scripts we write, such as bat scripts in windows and shell scripts in linux. Haha, with the ability to execute scripts, what else can't be done!
Let's take a look at how to create a build of type Command Line. Please select a Runner type of type Command Line.
Step name
You can set a name for each build step. Note that this is not a required option, you can choose to fill in nothing.
Execute step
Please choose the appropriate implementation strategy, which we have explained in detail earlier.
Working directory
The working directory is very important for the command to be executed. If the setting is incorrect, there will be an error that the file cannot be found, so be sure to set it carefully. You can manually enter the path relative to the checkout directory, or you can select it through the tool on the right. If you want the working directory to be the directory of checkout, you don't need to set it up, just leave it blank.
Custom script
When selecting the Custom script type, we can write script commands directly in the input box. The advantage of this is that you don't have to manage script files, because TeamCity packages the script commands you write into script files that are executed at build.
Executable with parameters
If it is a complex script, we still want to write it as a separate script file, so that it is easier to maintain and manage. What if you want to pass parameters to a separate script file at this point?
Select the Executable with parameters type, you can execute script files or executable binaries, and you can pass command-line arguments. In the figure above, we pass the checkout directory to the test.bat script file.
Create multiple steps
In order to complete the complex compilation process, multiple steps are often needed to be executed sequentially. TeamCity also provides functionality that allows users to reorder build steps.
The image above shows the scenario of clicking the "Reorder build steps" button after adding two build steps. The build steps are listed and you can reorder them with mouse drag. When you are done, just click the "Apply" button.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.