OpenShift 2 Flashcards

1
Q

Two type of bc triggers

A

Image change triggers
Webhook triggers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you view the triggers associated with a build configuration

A

oc describe bc/name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Add an image change trigger to a build

A

oc set triggers bc/name –from-image=project/image:tag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you remove an image change trigger from a bc

A

oc set triggers bc/name –from-image=project/image:tag –remove

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Add a webhook to a bc

A

oc set triggers bc/name –from-gitlab

oc set triggers bc/name –from-github

oc set triggers bc/name –from-bitbucket

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Remove a webhook from a bc

A

oc set triggers bc/name –from-gitlab –remove

oc set triggers bc/name –from-github –remove

oc set triggers bc/name –from-bitbucket –remove

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two types of post commit hooks?

A

Command: A executed using the exec system call.

Shell script: Runs a build hook with the /bin/sh -ic command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a command post-commit build hook

A

oc set build-hook bc/name –post-commit \
–command – bundle exec rake test –verbose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Create a shell script post-commit build hook

A

oc set build-hook bc/name –post-commit \
–script=”curl http://api.com/user/${USER}”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you tell S2I where to find its mandatory scripts (run, assemble)

A

Set io.openshift.s2i.scripts-url as label in the builder image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Ways to customize the s2i script:

A

1) override the default S2I scripts by providing your own S2I scripts in the .s2i/bin
2) create a wrapper script that invokes the default scripts, and then adds the necessary customization before or after the invocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

using skopeo how do you determine the location of the s2i script for rhscl/php-73-rhel7 S2I builder image

A

skopeo inspect
docker://myregistry.com/rhscl/php-73-rhel7 | grep io.openshift.s2i.scripts-url

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Command for skafolding s2i builder image

A

s2i create image_name directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do yous pecify the maven repo URL when creating an app?

A

–build-env MAVEN_MIRROR_URL=${URL}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to specify a build env variable?

A

–build-env ENV_VAR_NAME=VALUE

Do not put a space after the environment variable ENV_VAR_NAME=VALUE. The environment variable follows the NAME=VALUE format.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Types of post commit build hookds

A
  1. Command
  2. Shell script
17
Q

Set a command as post commit build hook

A

oc set build-hook bc/name –post-commit –command – bundle exec rake test –verbose

18
Q

Set a post commit build hook using the shell approach

A

oc set build-hook bc/name –post-commit \ –script=”curl http://api.com/user/${USER}”

19
Q

Start a build called hook and display logs

A

oc start-build hook -F

20
Q

Where do you put your s2i customizations

A

In your project under .s2i/bin

21
Q

How do you invoke the s2i run script during customization?

A

exec /usr/libexec/s2i/run

You must use exec to ensure that the default run script still runs with process ID 1.

22
Q

Create app from template stored in local file

A

oc new-app –file mytemplate.yaml -p PARAM1=value1

23
Q

Apply values to a template and store the result in a local file

A

oc process -f mytemplate.yaml -p PARAM1=value1 > myresourcelist.yaml

24
Q

list only parameters defined by a template

A

oc process -f mytemplate.yaml –parameters

25
Q

Print the list of env variable in a bc

A

oc set env bc/hook –list