빌드 디버깅

문제점 해결 팁을 사용하여 빌드의 IBM Cloud® Code Engine 빌드 및 실행 문제점을 해결하는 방법을 알아보십시오.

콘솔 또는 CLI 에서 빌드를 실행하는지 여부에 관계없이 CLI를 사용하여 빌드의 문제점을 해결하십시오.

  1. 빌드 실행의 세부사항을 표시하려면 ibmcloud ce buildrun get --name BUILDRUN_NAME 명령을 실행하십시오.
  2. 명령 출력에서 Reason을 검토하십시오.

앱이 예상대로 작동하지 않는 경우, 로그 및 시스템 이벤트를 보면 문제점을 디버그하는 데 도움이 될 수 있는 정보가 있습니다.

고려할 빌드 제한사항

프로젝트당 가질 수 있는 빌드 구성의 최대 수는 100입니다. 프로젝트당 총 100개의 빌드 실행으로 제한되어 있어 한계를 넘으면 이전 빌드 실행을 제거하거나 정리해야 합니다.

메모리와 CPU를 포함한 빌드의 한계에 대한 자세한 정보는 Code Engine의 한계 및 할당량을 참조하십시오.

CLI를 사용하면 ibmcloud ce project get 명령을 사용하여 한계 및 현재 사용량에 대한 정보를 표시할 수 있습니다. 예를 들어, 다음과 같습니다.

ibmcloud ce project get --name myproject

출력 예

Getting project 'myproject'...
OK
Name:                                      myproject
ID:                         abcdabcd-abcd-abcd-abcd-f1de4aab5d5d
Status:                                    active
Enabled:                                   true
Application Private Visibility Supported:  true
Selected:                                  true
Region:                                    us-south
Resource Group:             default
Service Binding Service ID: ServiceId-1234abcd-abcd-abcd-1111-1a2b3c4d5e6f
Age:                        52d
Created:                                   Tue, 28 Sep 2021 05:12:16 -0500
Updated:                                   Tue, 28 Sep 2021 05:12:19 -0500
Quotas:
Category                                  Used  Limit
App revisions                             2    120
Apps                                      1     40
Build runs                                1     100
Builds                                    2     100
Configmaps                                2     100
CPU                                       0     128
Ephemeral storage                         0     512G
Functions                                 0     20
Instances (active)                        0     250
Instances (total)                         0     2500
Job runs                                 13     100
Jobs                                      2     100
Memory                                    0     512G
Secrets                                   6     100
Subscriptions (cron)                      0     100
Subscriptions (IBM Cloud Object Storage)  0     100
Subscriptions (Kafka)                     0     100

내 빌드의 로그 가져오기

로그는 빌드 실행 시 문제점을 해결하는 데 도움이 될 수 있습니다. CLI 또는 콘솔을 사용하여 빌드 로그를 볼 수 있습니다.

콘솔에서 내 빌드의 로그 가져오기

콘솔에서 특정 빌드 실행 인스턴스에 대한 로그를 표시할 수 있습니다.

  1. Code Engine 대시보드로 이동하십시오.
  2. 프로젝트를 선택하거나 프로젝트를 작성하십시오.
  3. 프로젝트 페이지에서 이미지 빌드를 클릭하십시오.
  4. 이미지 빌드 탭에서 이미지 빌드의 이름을 클릭하여 정의된 빌드의 빌드 페이지를 열거나 빌드를 작성 하십시오.
  5. 정의된 빌드에 대한 빌드 페이지의 빌드 실행 섹션에서 빌드 실행 인스턴스의 이름을 클릭하십시오. 빌드 실행을 작성하려면 빌드 제출을 클릭해야 합니다.
  6. 빌드 실행 인스턴스 페이지에서 빌드 로그 정보를 확인할 수 있습니다. 자세한 로깅 정보를 보려면 특정 빌드 단계를 펼치십시오.

자세한 정보는 콘솔에서 빌드 로그 보기 를 참조하십시오.

CLI를 사용하여 내 빌드의 로그 가져오기

빌드 실행에 관한 로그를 표시하려면 ibmcloud ce buildrun logs 명령을 사용하십시오. 이 명령을 사용하여 빌드 실행의 이름을 기반으로 빌드 실행의 모든 인스턴스에 대한 로그를 표시할 수 있습니다.

mybuildrun 빌드 실행의 모든 인스턴스에 대한 로그를 보려면 --name 옵션으로 빌드 실행의 이름을 지정하십시오. 예를 들면, 다음과 같습니다.

ibmcloud ce buildrun logs --name mybuildrun

출력 예

Getting build run 'mybuildrun'...
Getting instances of build run 'mybuildrun'...
Getting logs for build run 'mybuildrun'...
OK
mybuildrun-bvzbg-pod-tppvg/step-source-default:
2021/09/21 09:39:08 Info: ssh (/usr/bin/ssh): OpenSSH_8.0p1, OpenSSL 1.1.1g FIPS  21 Apr 2020
2021/09/21 09:39:08 Info: git (/usr/bin/git): git version 2.27.0
2021/09/21 09:39:08 Info: git-lfs (/usr/bin/git-lfs): git-lfs/2.11.0 (GitHub; linux amd64; go 1.14.4)
2021/09/21 09:39:08 /usr/bin/git clone --quiet --no-tags --branch main --depth 1 --single-branch -- https://github.com/IBM/CodeEngine /workspace/source
2021/09/21 09:39:09 /usr/bin/git -C /workspace/source submodule update --init --recursive --depth 1
2021/09/21 09:39:10 /usr/bin/git -C /workspace/source rev-parse --abbrev-ref HEAD
2021/09/21 09:39:10 Successfully loaded https://github.com/IBM/CodeEngine (main) into /workspace/source
2021/09/21 09:39:10 /usr/bin/git -C /workspace/source rev-parse --verify HEAD
mybuildrun-bvzbg-pod-tppvg/step-build-and-push:
INFO[0000] Retrieving image manifest golang:alpine
INFO[0000] Retrieving image golang:alpine from registry index.docker.io
INFO[0001] Retrieving image manifest alpine
INFO[0001] Retrieving image alpine from registry index.docker.io
INFO[0003] Built cross stage deps: map[0:[/codeengine]]
INFO[0003] Retrieving image manifest golang:alpine
INFO[0003] Returning cached image manifest
INFO[0003] Executing 0 build triggers
INFO[0003] Unpacking rootfs as cmd COPY ./helloworld /helloworld requires it.
INFO[0009] COPY ./helloworld /helloworld
INFO[0009] Taking snapshot of files...
INFO[0009] COPY codeengine.go /
INFO[0009] Taking snapshot of files...
INFO[0009] RUN go build -o /codeengine /codeengine.go
INFO[0009] Taking snapshot of full filesystem...
INFO[0017] cmd: /bin/sh
INFO[0017] args: [-c go build -o /codeengine /codeengine.go]
INFO[0017] Running: [/bin/sh -c go build -o /codeengine /codeengine.go]
INFO[0018] Taking snapshot of full filesystem...
INFO[0018] Saving file codeengine for later use
INFO[0018] Deleting filesystem...
INFO[0019] Retrieving image manifest alpine
INFO[0019] Returning cached image manifest
INFO[0019] Executing 0 build triggers
INFO[0019] Unpacking rootfs as cmd COPY --from=0 /codeengine /codeengine requires it.
INFO[0019] COPY --from=0 /codeengine /codeengine
INFO[0019] Taking snapshot of files...
INFO[0019] CMD /codeengine
INFO[0019] Pushing image to us.icr.io/acme-namespace/codeengine-sample
INFO[0023] Pushed image to 1 destinations

내 빌드에 관한 시스템 이벤트 정보 가져오기

시스템 이벤트 정보는 빌드 실행 시 문제점을 해결하는 데 도움이 될 수 있습니다. CLI를 사용하여 빌드의 시스템 이벤트 정보를 볼 수 있습니다.

  1. ibmcloud ce buildrun list 명령을 사용하여 프로젝트의 모든 빌드 실행을 나열하십시오. 예를 들면 다음과 같습니다.

    ibmcloud ce buildrun list  
    
  2. 빌드 실행의 세부사항을 가져오려면 ibmcloud ce buildrun get 명령을 사용하십시오. 예를 들어, 다음과 같습니다.

    ibmcloud ce buildrun get --name mybuildrun  
    

    출력 예

    Getting build run 'mybuildrun'...
    Run 'ibmcloud ce buildrun events -n mybuildrun' to get the system events of the build run.
    Run 'ibmcloud ce buildrun logs -f -n mybuildrun' to follow the logs of the build run.
    OK
    Name:          mybuilddrun
    [...]
    Created:       2021-06-01T11:43:24-04:00
    Summary:  Succeeded
    Status:   Succeeded
    Reason:   All Steps have completed executing
    Image:  us.icr.io/mynamespace/codeengine-codeengine-200
    

    빌드 실행에 대한 세분화된 세부사항을 원하는 경우 buildrun get 명령에 --o yaml 옵션을 사용하십시오(예: ibmcloud ce buildrun get --name myapp --o yaml). 이 옵션은 CLI에서 빌드 실행에 대한 자세한 정보를 표시할 때 유용합니다.

  3. 빌드 실행의 시스템 이벤트를 표시합니다. ibmcloud ce buildrun events 명령을 사용하십시오. 예를 들어, 다음과 같습니다.

    ibmcloud ce buildrun events --name mybuildrun
    

    출력 예

    Getting build run 'mybuildrun'...
    Getting instances of build run 'mybuildrun'...
    Getting events for build run 'mybuildrun'...
    OK
    mybuildrun-bvzbg-pod-tppvg:
        Type    Reason     Age    Source                Messages
        Normal  Scheduled  4m43s  default-scheduler     Successfully assigned 62ckpsxlh7x/mybuildrun-bvzbg-pod-tppvg to 10.242.0.17
        Normal  Pulled     4m42s  kubelet, 10.242.0.17  Container image "icr.io/obs/codeengine/tekton-pipeline/entrypoint-bff0a22da108bc2f16c818c97641a296:v0.23.0-rc6@sha256:43dd56a6c7c10f80300a861615f6f8d91c026deba744f81553a4e536b301b322" already present on machine
        Normal  Created    4m42s  kubelet, 10.242.0.17  Created container place-tools
        Normal  Started    4m41s  kubelet, 10.242.0.17  Started container place-tools
        Normal  Pulled     4m40s  kubelet, 10.242.0.17  Container image "icr.io/obs/codeengine/git:v0.8.100" already present on machine
        Normal  Created    4m40s  kubelet, 10.242.0.17  Created container step-source-default
        Normal  Started    4m40s  kubelet, 10.242.0.17  Started container step-source-default
        Normal  Pulled     4m40s  kubelet, 10.242.0.17  Container image "icr.io/obs/codeengine/buildkit/builder:v0.9.0-rc.19" already present on machine
        Normal  Created    4m40s  kubelet, 10.242.0.17  Created container step-build-and-push
        Normal  Started    4m40s  kubelet, 10.242.0.17  Started container step-build-and-push
    

    이벤트는 시스템에 한 시간 동안만 저장됩니다.