Updated on 2023-10-30 GMT+08:00

Installing and Initializing obsutil

obsutil is used to upload software packages to OBS.

Prerequisites

  1. You have obtained AK/SK. For details, see Access Keys.
  2. You have obtained the endpoint of the region where ServiceStage is deployed. For details, see Regions and Endpoints.
  3. You have created a bucket in OBS in the same region as ServiceStage where the component is deployed to store software packages. For details, see Creating a Bucket .

Procedure

  1. Log in to the Linux VM where Jenkins is installed and install obsutil. For details, see Download and Installation.

    Before installing obsutil, run the following command on the Linux VM where Jenkins is located to check the VM OS type:

    echo $HOSTTYPE
    • If the command output is x86_64, download the obsutil software package for the AMD 64-bit OS.
    • If the command output is aarch64, download the obsutil software package for the ARM 64-bit OS.

  2. Initialize obsutil.

    {path}/obsutil config -i=ak -k=sk -e={endpoint}

    Where,

    • {path} is the obsutil installation path, for example, /root/tools/obsutil/obsutil_linux_amd64_5.4.6.
    • {endpoint} is the obtained endpoint of the region where ServiceStage is deployed.

  3. Check whether obsutil can be used to upload files to OBS.

    1. Create a test file.
      touch test.txt
    2. Use obsutil to upload the file.
      /root/tools/obsutil/obsutil_linux_amd64_5.4.6/obsutil cp test.txt obs://{OBS bucket name}

      Replace {OBS bucket name} with the name of the OBS bucket to be used. In this example, the bucket name is obs-mzc. Upload the test.txt file created in the current directory to the obs-mzc bucket. If the "Upload successfully" is displayed, the upload is successful.

      [root@ecs-jenkins jar]# /root/tools/obsutil/obsutil_linux_amd64_5.4.6/obsutil cp test1.txt obs://obs-mzc
      Start at 2023-07-24 06:09:53.49127587 +0000 UTC
      Parallel:      5                   Jobs:          5                   
      Threshold:     50.00MB             PartSize:      auto                
      VerifyLength:  false               VerifyMd5:     false               
      CheckpointDir: /root/.obsutil_checkpoint     
      [-----------------------------------------------------------------------------------------] 100.00% 138B/s 58B/58B 622ms
      Upload successfully, 58B, n/a, /root/jar/test1.txt --> obs://obs-mzc/test1.txt, cost [621], status [200], request id [000001898684BD614014A659111ABF74]