How do you create an OpenShift application named myjava from a git repository at https://mygitrepo using the context directory java?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

How do you create an OpenShift application named myjava from a git repository at https://mygitrepo using the context directory java?

Explanation:
The main idea is to tell OpenShift exactly where to pull the application source from and which subdirectory to use as the build context. oc new-app can take a Git URL as the source, and you can guide it with options to name the app and to point to the correct subdirectory inside that repository. Using the Git URL plus the specified subdirectory ensures OpenShift uses the contents under that java folder as the source for the build, and it assigns the application the name myjava. This is the right approach because the context-dir option directs the build to a specific path inside the repository, which is necessary when the repository contains multiple projects or components. If you omit the context directory, OpenShift would try to build from the repository root, which may not contain the necessary build files, leading to a failure. Other options are incorrect because they either use a different command or a template mechanism that isn’t applicable to this scenario. So the best approach is to run a command that references the Git repository, sets the app name, and specifies the context directory, yielding an app named myjava built from the contents of java in that repository.

The main idea is to tell OpenShift exactly where to pull the application source from and which subdirectory to use as the build context. oc new-app can take a Git URL as the source, and you can guide it with options to name the app and to point to the correct subdirectory inside that repository.

Using the Git URL plus the specified subdirectory ensures OpenShift uses the contents under that java folder as the source for the build, and it assigns the application the name myjava. This is the right approach because the context-dir option directs the build to a specific path inside the repository, which is necessary when the repository contains multiple projects or components.

If you omit the context directory, OpenShift would try to build from the repository root, which may not contain the necessary build files, leading to a failure. Other options are incorrect because they either use a different command or a template mechanism that isn’t applicable to this scenario.

So the best approach is to run a command that references the Git repository, sets the app name, and specifies the context directory, yielding an app named myjava built from the contents of java in that repository.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy