Saturday, 5 November 2016

What is the connection between jenkins master and slave?

Q 81.  What is the connection between master and slave?

In a standard Jenkins master/slave setup, Jenkins is only installed on the master. That is where you see the user interface and start/configure build jobs.
The slaves execute the jobs. 

There is no Jenkins installation here other than a small Java app to have Jenkins communicate to/from the slave. Jenkins talks to these slaves through the slave.jar app over e.g. SSH via the SSH Slaves Plugin and can monitor if the slave is running, etc.

How to create p4 client spec ?

Q 84. How to create p4 client spec ?

Create or edit a client workspace specification and its view.
The command p4 workspace is an alias for p4 client.
Syntax

p4 [g-opts] client [-f] [-t template] [clientname]
p4 [g-opts] client -o [-t template] [clientname]
p4 [g-opts] client -d [-f [-Fs]]clientname
p4 [g-opts] client -s [-S stream | -t clientnameclientname
p4 [g-opts] client -S stream [[-c change] -o] [clientname]
p4 [g-opts] client -i [-f]
p4 [g-opts] client -d -f --serverid=serverid [-Fs]

Explain p4 branch spec ?

Q 86. Explain p4 branch spec ?


Create or edit a branch mapping and its view.


p4 [g-opts] branch [-f] branchspec
p4 [g-opts] branch -d [-f] branchspec
p4 [g-opts] branch [-S stream] [-P parent] -o branchspec
p4 [g-opts] branch -i [-f]

What are different types of views?Explain the difference.

Q  87. What are different types of views?Explain the difference.


Views are required in order to use Clearcase. A unique view assigned to a user will:
  • allow a developer access to the VOB data (source code storage)
  • provide a workspace are where users can privately modify VOB data without disturbing the view of the VOB data held by other developers. Changes are only accessible by others when a file is checked into the VOB from the users private space.
There are three types of views:

  • Snapshot view: Changes and updates by others are not available to a snapshot view until a new "snapshot" is taken.
  • Web view: accessible from Clearcase Web interface. Similar to a snapshot view.
  • Dynamic view: access to all versions of VOB elements and view private objects as they are checked into the VOB

What is the command to edit config spec?

Q 89. What is the command to edit config spec?
  • ClearCase—Edit the config spec of a dynamic view:
edcs [ –tag view-tag ] [ file ]
  • ClearCase—Edit the config spec of a snapshot view:
edcs [ –ove/rwrite | –ren/ame ] [ –cti/me | –pti/me ] [ file ]
  • ClearCase Remote client—Edit the config spec of a web view:
edcs [ –ove/rwrite | –ren/ame ] [ –pti/me ] [ file ]
  • ClearCase Remote client—Edit the config spec of an automatic view:

edcs [ –ove/rwrite | –ren/ame ] [ file ]

How to set view using script?

Q 90. How to set view using script?
Try using below two ways:
Run cleartool setview prior to calling the script:

Example:

$ cat /tmp/script.sh
#!/bin/sh
/usr/atria/bin/cleartool pwv

$ cleartool setview new_view
[new_view]$ /tmp/script.sh
Working directory view: new_view
Set view: new_view




 Run the cleartool setview command and exec into the script:

Example:

$ cleartool setview -exec /tmp/script.sh new_view
Working directory view: new_view
Set view: new_view

What is difference between $*, $@ , $_and $0?

Q.46 . What is difference between $*, $@ , $_and $0?

$#
The number of arguments supplied to a script.
$*
All the arguments are double quoted. If a script receives two arguments, $* is equivalent to $1 $2. 
The "$*" special parameter takes the entire list as one argument with spaces between
$@
All the arguments are individually double quoted. If a script receives two arguments, $@ is equivalent to $1 $2.
The "$@" special parameter takes the entire list and separates it into separate arguments.
$?
The exit status of the last command executed.
$0
Gives File Name


test.sh
#!/bin/sh
 
echo "File Name: $0"
echo "First Parameter : $1"
echo "Second Parameter : $2"
echo "Quoted Values: $@"
echo "Quoted Values: $*"
echo "Total Number of Parameters : $#"
Here is a sample run for the above script −

$./test.sh Foo Bar
File Name : ./test.sh
First Parameter : Foo
Second Parameter : Bar
Quoted Values: Foo Bar
Quoted Values: Foo Bar
Total Number of Parameters : 2


$echo $?
0
 
Tricks and Tips