Uploading Files to OBS
CodeArts Build allows you to upload build products to OBS. You can use this build action as required.
For details about the restrictions on using OBS, see Restrictions and Limitations.
Preparations
- Access the CodeArts Build Homepage from the project list.
- In the navigation pane, choose .
- Select IAM user from the Create Endpoint drop-down list box. In the displayed dialog box, enter the following information and click Confirm.
- Service Endpoint Name: Assign a custom name to the endpoint. Enter a maximum of 256 characters, including letters, digits, hyphens (-), underscores (_), periods (.), and spaces.
- Access key ID (AK) and secret access key (SK) are used like passwords to authenticate users who make API requests.
On the CodeArts Build homepage, click Console, hover the cursor on the username in the upper right corner, and choose My Credentials from the drop-down list. In the navigation pane on the left, choose Access Keys to create a user key.
Build on GUI
Add Upload Files to OBS, when configuring build actions. Set the parameters according to Table 1.
Parameter |
Description |
---|---|
Action Name |
Assign a custom name to the build action. The name can contain:
|
Authorized User |
Select the user. Your files will be pushed to the user's OBS.
|
IAM Account |
Expand the drop-down list and select the service endpoint created in Preparations for the specific IAM account. Then, use the service endpoint to push the files to the user's OBS. This parameter is mandatory when Authorized User is set to Other. |
Build Directory |
Directory for storing build results. If no file name is specified for OBS storage, use wildcard characters to upload multiple files. Example: **/target/*.?ar uploads all JAR and WAR packages built with Maven.
Examples:
|
Bucket Name |
Name of the target OBS bucket. (Cross-region upload is not supported.) |
OBS Directory |
Optional. Directory for storing build results on OBS (for example, application/version/). You can leave this parameter blank or enter ./ to store build results to the OBS root directory. |
File Name |
Optional.
Enter the name (without the directory) that the resulting build file will be stored as in OBS.
|
Headers |
Optional. Add one or more custom response headers during the file upload. The headers will be included in the response to download objects or query the object metadata. For example, you can set the key to x-frame-options and value to false to prevent web pages stored in OBS from being embedded into by third-party web pages. |
Continue After Failure |
Specify whether to proceed after the current action fails by setting the parameter to either Yes or No. |
Build with Code
Modify the code in the BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
version: 2.0 # The value must be 2.0. steps: BUILD: - upload_obs: inputs: artifact_path: "**/target/*.?ar" bucket_name: codecitest-obs obs_directory: "./" # artifact_dest_name: "" # upload_directory: true # headers: # x-frame-options: true # test: test # commit: ${commitId} ignore_fail: true |
Parameter |
Type |
Description |
---|---|---|
artifact_path |
String |
Optional. Directory for storing build results. If no file name is specified for OBS storage, use wildcard characters to upload multiple files. Example: **/target/*.?ar uploads all JAR and WAR packages built with Maven.
Examples:
The default value is bin/*. |
bucket_name |
String |
Name of the target OBS bucket. (Cross-region upload is not supported.) |
obs_directory |
String |
Optional. Directory for storing build results on OBS (for example, application/version/). You can leave this parameter blank or enter ./ to store build results to the OBS root directory. The default value is ./. |
artifact_dest_name |
String |
Optional.
Enter the name (without the directory) that the resulting build file will be stored as in OBS.
|
upload_directory |
Bool |
Optional. Specify whether to enable the function of uploading folders.
The default value is false. |
headers |
Map |
Optional. Add one or more custom response headers during the file upload. The headers will be included in the response to download objects or query the object metadata. For example, you can set the value of x-frame-options to false to prevent web pages stored in OBS from being embedded into by third-party web pages. |
ignore_fail |
String |
Whether to proceed after the current action fails.
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot