Skip to content

Commit 6dadbfa

Browse files
committed
Update existing steps to adjust ocp 4.0
1 parent ad001d4 commit 6dadbfa

File tree

3 files changed

+17
-75
lines changed

3 files changed

+17
-75
lines changed

features/step_definitions/images/jenkins.rb

Lines changed: 11 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,16 @@
103103
# non-SSO login.
104104
# Installation step also installs based on this.
105105
Given /^I log in to jenkins$/ do
106-
if env.version_ge("3.4", user: user) && user.password?
106+
if env.version_ge("3.4", user: user) && env.version_le("3.11", user: user) && user.password?
107107
step %Q/I perform the :jenkins_oauth_login web action with:/, table(%{
108108
| username | <%= user.name %> |
109109
| password | <%= user.password %> |
110110
})
111+
elsif env.version_gt("3.11", user: user) && user.password?
112+
step %Q/I perform the :jenkins_multi_oauth_login web action with:/, table(%{
113+
| username | <%= user.name %> |
114+
| password | <%= user.password %> |
115+
})
111116
else
112117
step %Q/I perform the :jenkins_standard_login web action with:/, table(%{
113118
| username | admin |
@@ -118,10 +123,12 @@
118123
end
119124

120125
Given /^I update #{QUOTED} slave image for jenkins #{NUMBER} server$/ do |slave_name,jenkins_version|
121-
le39 = env.version_le("3.9", user: user)
122126

123127
step 'I store master major version in the clipboard'
124-
if le39 or jenkins_version == '1'
128+
129+
if env.version_gt("3.11", user: user)
130+
print "Skipped, agent images don't need update above openshift 4.0"
131+
elsif env.version_le("3.9", user: user) or jenkins_version == '1'
125132
step %Q/I perform the :jenkins_update_cloud_image web action with:/, table(%{
126133
| currentimgval | registry.access.redhat.com/openshift3/jenkins-slave-#{slave_name}-rhel7 |
127134
| cloudimage | <%= product_docker_repo %>openshift3/jenkins-slave-#{slave_name}-rhel7:v<%= cb.master_version %> |
@@ -131,7 +138,7 @@
131138
| currentimgval | openshift3/jenkins-agent-maven-35-rhel7 |
132139
| cloudimage | <%= product_docker_repo %>openshift3/jenkins-agent-maven-35-rhel7:v<%= cb.master_version %> |
133140
})
134-
elsif slave_name == 'nodejs'
141+
else slave_name == 'nodejs'
135142
step %Q/I perform the :jenkins_update_cloud_image web action with:/, table(%{
136143
| currentimgval | openshift3/jenkins-agent-nodejs-8-rhel7 |
137144
| cloudimage | <%= product_docker_repo %>openshift3/jenkins-agent-nodejs-8-rhel7:v<%= cb.master_version %> |
@@ -140,63 +147,3 @@
140147

141148
step 'the step should succeed'
142149
end
143-
144-
Given /^I have a jenkins server with above 40 cluster$/ do
145-
146-
last_startup_check = monotonic_seconds
147-
if !user.password?
148-
step %Q/I run the :new_app client command with:/, table(%{
149-
| p | ENABLE_OAUTH=false |
150-
| template | jenkins-persistent |
151-
})
152-
step 'the step should succeed'
153-
else
154-
step %Q/I run the :new_app client command with:/, table(%{
155-
| template | jenkins-persistent |
156-
})
157-
step 'the step should succeed'
158-
end
159-
160-
step 'I wait for the "jenkins" service to become ready up to 600 seconds'
161-
cb.jenkins_svc = service
162-
cache_resources *service.pods, route("jenkins", service("jenkins"))
163-
cb.jenkins_pod = pod
164-
cb.jenkins_route = route
165-
cb.jenkins_dns = cb.jenkins_route.dns
166-
cb.jenkins_major_version = 2
167-
168-
timeout = 600
169-
wait_string = "Finished Download metadata."
170-
171-
started = wait_for(timeout) {
172-
since = monotonic_seconds - last_startup_check
173-
res = user.cli_exec(
174-
:logs,
175-
resource_name: cb.jenkins_pod.name,
176-
since: "#{since.to_i + 5}s",
177-
_quiet: true
178-
)
179-
last_startup_check += since
180-
res[:response].include? wait_string
181-
}
182-
if started
183-
logger.info "Jenkins log line found: #{wait_string}"
184-
else
185-
raise "Jenkins failed to start within #{timeout} seconds"
186-
end
187-
end
188-
189-
Given /^I log into jenkins with above 40 cluster$/ do
190-
if user.password?
191-
step %Q/I perform the :jenkins_multi_oauth_login web action with:/, table(%{
192-
| username | <%= user.name %> |
193-
| password | <%= user.password %> |
194-
})
195-
else
196-
step %Q/I perform the :jenkins_standard_login web action with:/, table(%{
197-
| username | admin |
198-
| password | password |
199-
})
200-
end
201-
step 'the step should succeed'
202-
end

lib/environment.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,11 @@ def get_version(user:)
240240
if obtained[:request_opts][:url].include?("/version/openshift") &&
241241
!obtained[:success]
242242
# seems like pre-3.3 version, lets hardcode to 3.2
243+
# After bug 1692670 fix, will recover hardcode to '3.2'.
243244
obtained[:props] = {}
244-
obtained[:props][:openshift] = "v3.2"
245-
@major_version = obtained[:props][:major] = 3
246-
@minor_version = obtained[:props][:minor] = 2
245+
obtained[:props][:openshift] = "v4.0"
246+
@major_version = obtained[:props][:major] = 4
247+
@minor_version = obtained[:props][:minor] = 0
247248
elsif obtained[:success]
248249
@major_version = obtained[:props][:major].to_i
249250
@minor_version = obtained[:props][:minor].to_i

lib/rules/web/images/jenkins_2/jenkins_2.xyaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,8 @@ jenkins_multi_oauth_login:
603603
Logtext.click();
604604
return true;
605605
expect_result: true
606-
- command: |
607-
var Authtype = document.getElementsByClassName("idp")[1]
608-
if (typeof(Authtype) == "undefined"){
609-
return true;
610-
}
611-
Authtype.click();
612-
return true;
613-
expect_result: true
606+
- command: return document.getElementsByClassName("idp")[1].click()
607+
expect_result: ~
614608
elements:
615609
- selector:
616610
id: inputUsername

0 commit comments

Comments
 (0)