This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.7.6.2. 튜토리얼 개요
다음 튜토리얼에서는 OpenShift 클러스터를 사용할 수 있고 아티팩트를 생성할 수 있는 프로젝트가 있다고 가정합니다. 로컬에 git
및 oc
를 모두 사용할 수 있어야 합니다.
7.6.2.1. 튜토리얼: 로컬 코드 변경 빌드 링크 복사링크가 클립보드에 복사되었습니다!
기존 소스 리포지터리를 기반으로 새 애플리케이션을 생성하고 경로를 생성합니다.
oc new-app https://github.com/openshift/ruby-hello-world.git oc expose svc/ruby-hello-world
$ oc new-app https://github.com/openshift/ruby-hello-world.git $ oc expose svc/ruby-hello-world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 초기 빌드가 완료될 때까지 기다린 후 경로 호스트로 이동하여 애플리케이션의 페이지를 확인합니다. 시작 페이지가 표시됩니다.
oc get route ruby-hello-world
$ oc get route ruby-hello-world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 리포지토리를 로컬로 복제합니다.
git clone https://github.com/openshift/ruby-hello-world.git cd ruby-hello-world
$ git clone https://github.com/openshift/ruby-hello-world.git $ cd ruby-hello-world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
애플리케이션 보기를 변경합니다. 즐겨 찾는 편집기를 사용하여
views/main.rb
: <body
> 태그를 <body style="background-color:blue"
>로 변경하십시오. 로컬에서 수정된 소스를 사용하여 새 빌드를 시작합니다. 리포지토리의 로컬 디렉터리에서 다음을 실행합니다.
---- $ oc start-build ruby-hello-world --from-dir="." --follow ----
---- $ oc start-build ruby-hello-world --from-dir="." --follow ----
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
빌드가 완료되고 애플리케이션이 재배포되면 애플리케이션의 경로 호스트로 이동하여 파란색 배경이 있는 페이지가 생성됩니다.
로컬로 변경하고 oc start-build --from-dir
을 사용하여 코드를 빌드할 수 있습니다.
코드 분기를 생성하고, 변경 사항을 로컬에서 커밋하고, 리포지토리의 HEAD를 빌드 소스로 사용할 수도 있습니다.
git checkout -b my_branch git add . git commit -m "My changes" oc start-build ruby-hello-world --from-repo="." --follow
$ git checkout -b my_branch
$ git add .
$ git commit -m "My changes"
$ oc start-build ruby-hello-world --from-repo="." --follow