I'm quite new to ansible and I have been working on writing an ansible role to automate the incremental upgrade process for Jenkins. Part of this process has involved creating a loop which executes on the condition that the current version of Jenkins installed on the instance is older than the target version.
# Install the incremental upgraded version of Jenkins
- name: upgrade and restart jenkins on each iterative upgrade
yum:
name: "jenkins-{{ item.jenkins_target_version }}"
state: present
when: (jenkins_current_version | float) < "{{ item.jenkins_target_version_filtered }}"
loop: "{{ packages }}"
notify: restart jenkins
when: (jenkins_current_version | float) < jenkins_target_filtered
The loop should cycle through the list of packages which looks like this
packages:
- { jenkins_target_version: 2.176-1.1, jenkins_target_version_filtered: 2.176 }
- { jenkins_target_version: 2.190-1.1, jenkins_target_version_filtered: 2.190 }
- { jenkins_target_version: 2.204-1.1, jenkins_target_version_filtered: 2.204 }
- { jenkins_target_version: 2.222-1.1, jenkins_target_version_filtered: 2.222 }
- { jenkins_target_version: 2.235-1.1, jenkins_target_version_filtered: 2.235 }
- { jenkins_target_version: 2.249-1.1, jenkins_target_version_filtered: 2.249 }
- { jenkins_target_version: 2.263-1.1, jenkins_target_version_filtered: 2.263 }
- { jenkins_target_version: 2.277-1.1, jenkins_target_version_filtered: 2.277 }
- { jenkins_target_version: 2.289-1.1, jenkins_target_version_filtered: 2.289 }
- { jenkins_target_version: 2.303-1.1, jenkins_target_version_filtered: 2.303 }
- { jenkins_target_version: 2.319-1.1, jenkins_target_version_filtered: 2.319 }
- { jenkins_target_version: 2.332-1.1, jenkins_target_version_filtered: 2.332 }
- { jenkins_target_version: 2.343-1.1, jenkins_target_version_filtered: 2.343 }
- { jenkins_target_version: 2.346-1.1, jenkins_target_version_filtered: 2.346 }
And only install the version on the target system if it is a newer iteration than what is currently installed. The loop seems to work correctly and installs the upgrade of jenkins on the target instance, the problem is that I want to execute a series of handler tasks whenever jenkins has been upgraded.
The handlers are a series of tasks stored in a file in the handlers folder that restart the service and check that things are back up and running ok (among other things). The problem is that the handler tasks are not called and executed upon completion of each iterative upgrade. I'm looking for advice on how I can make this happen, thanks in advance.
Q: "I want to execute a series of handler tasks."
A: Use the keyword listen to select more tasks. For example, given the handlers
shell> cat handlers/restart_jenkins.yml
- debug:
msg: Restart service
listen: restart jenkins
- debug:
msg: Check that things are back up and running ok
listen: restart jenkins
- debug:
msg: |-
Do whatever you want next
{{ out.results|json_query('[].stdout') }}
listen: restart jenkins
The playbook
- hosts: test_11
gather_facts: false
vars:
packages:
- {target: 2.176-1.1, current: 2.176}
- {target: 2.190-1.1, current: 2.190}
- {target: 2.204-1.1, current: 2.205}
tasks:
- command: "echo install {{ item.target }}"
register: out
notify: restart jenkins
loop: "{{ packages }}"
when: item.current is version(item.target, "<")
- meta: flush_handlers
- debug:
msg: Continue ...
handlers:
- import_tasks: handlers/restart_jenkins.yml
gives
PLAY [test_11] *******************************************************************************
TASK [command] *******************************************************************************
changed: [test_11] => (item={'target': '2.176-1.1', 'current': 2.176})
changed: [test_11] => (item={'target': '2.190-1.1', 'current': 2.19})
skipping: [test_11] => (item={'target': '2.204-1.1', 'current': 2.205})
TASK [meta] **********************************************************************************
RUNNING HANDLER [debug] **********************************************************************
ok: [test_11] =>
msg: Restart service
RUNNING HANDLER [debug] **********************************************************************
ok: [test_11] =>
msg: Check that things are back up and running ok
RUNNING HANDLER [debug] **********************************************************************
ok: [test_11] =>
msg: |-
Do whatever you want next
['install 2.176-1.1', 'install 2.190-1.1']
TASK [debug] *********************************************************************************
ok: [test_11] =>
msg: Continue ...
PLAY RECAP ***********************************************************************************
test_11 : ok=5 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Notes:
The use case of installing new versions in a loop doesn't make sense. The play here serves the only purpose of demonstrating the functionality of handlers.
Flush the handlers if you don't want to wait till the end of the playbook.
Related
Hi can anyone help me how to deploy serverless with specific stage, I have 1 app with 2 stage dev and prod. When deploy to dev its working fine and successfully deployed, but with prod stage always get below error:
Error:
UPDATE_FAILED: FilterOptionLambdaFunction (AWS::Lambda::Function)
Resource handler returned message: "Lambda function xxxxxxx-api-prod-xxxxxx could not be found" (RequestToken: ee621797-de45-aa3f-118b-8f512d4a5f62, HandlerErrorCode: NotFound)
I tried to comment all function and leave 1 function to test deploy, but received another error as below:
Error:
UPDATE_FAILED: EnterpriseLogAccessIamRole (AWS::IAM::Role)
Unable to retrieve Arn attribute for AWS::Logs::LogGroup, with error message Resource of type 'AWS::Logs::LogGroup' with identifier '{"/properties/LogGroupName":"/aws/lambda/xxxxx-api-prod-api"}' was not found.
Here is my serverless.yml:
org: xxxxxx
app: comeby-api
service: comeby-scheduler-api
frameworkVersion: "3"
custom:
serverless-offline:
noPrependStageInUrl: true
myEnvironment:
MESSAGE:
prod: "This is production environment"
staging: "This is staging environment"
dev: "This is development environment"
useDotenv: true
provider:
name: aws
runtime: nodejs14.x
region: ap-southeast-1
stage: prod
functions:
api:
handler: handler.handler
events:
- httpApi: "*"
# Alikhsan
SyncAlikhsanSB2:
SyncAlikhsanAMT:
SyncAlikhsanASG:
SyncAlikhsanIOI:
SyncAlikhsanJSB:
SyncAlikhsanSPY:
# Sync Product
Shopify:
SyncSenheng:
SyncXilnix:
Puma:
# Anything
FilterOption:
AriadneMaps:
handler: scheduler/update/AriadneMaps.handler
description: "Update Ariadne Maps (to view report of total visitor of specific store) in Database"
memorySize: 512
timeout: 900
events:
- schedule:
rate: cron(00 22 * * ? *)
enabled: true
- http:
path: /cron/ariadne
method: get
SendEmailUpdateProduct:
ReportPurchasing:
UpdateProductPricePuma:
UpdateFootFallCam:
plugins:
# - serverless-dotenv-plugin
- serverless-offline
- serverless-offline-scheduler
I am guessing from those UPDATE_FAILEDs, you are using the same serverless file for both dev and prod deployment. Based on this assumption, you may have to provide separate service names for both of your deployments. If you have deployed to the dev environment already with service name comeby-scheduler-api, the next deployment for prod stage with the same service name will try to override the previous deployment.
In my case, I tackled this using 2 separate serverless configuration files (one for dev and the other for prod). For dev deployment, my config file serverless-dev.yml looks like the following.
service: service-dev
provider:
name: aws
role: arn:aws:iam::<aws-account-id>:role/<my-lambda-role-name>
region: <region>
runtime: python3.8
environment:
DB_HOST: <host>
DB_PASSWORD: <pass>
DB_PORT: <port>
DB_DATABASE: <db_name>
DB_USER: <db_user>
plugins:
- serverless-python-requirements
- serverless-secrets-plugin
- serverless-api-compression
package:
patterns:
- '!venv/**'
- '!__pycache__/**'
- '!node_modules/**'
- '!test/**'
functions:
Lambda1:
handler: lambda_file_name.handler_function_name
memorySize: 512
timeout: 900
events:
- s3:
bucket: <bucket_name_for_this_lambda_trigger>
event: s3:ObjectCreated:*
rules:
- prefix: <filter_trigger_file_prefix>
- suffix: <filter_trigger_file_suffix>
existing: <true if an existing s3 bucket, false otherwise>
Whereas for the prod, the serverless-prod.yml file is,
service: service-prod
provider:
name: aws
role: arn:aws:iam::<aws-account-id>:role/<my-lambda-role-name>
region: <region>
runtime: python3.8
... rest is similar
My deployment commands for these separate stages are.
sls deploy -s dev -c serverless-dev.yml
sls deploy -s prod -c serverless-prod.yml
Hello I'm new to writing Ansible Playbooks but I'm trying to have my playbook install Jenkins. It installs Jenkins just fine but the issue becomes that it wants me to do the initial unlock before installing plugins, creating jobs etc. I've seen in here a few times people saying you just need to add this to your playbook and you should be good. When I add it and then run the playbook it still has this issue even if I do it from a brand new server. Wondering what everyone has done to get by this issue. Thanks for your assistance!
Code I've seen from other posts:
Gets error "Cannot get CSRF" when trying to install jenkins-plugin using ANSIBLE
- name: Jenkins Skip startUp for MI
lineinfile:
dest=/etc/sysconfig/jenkins
regexp='^JENKINS_JAVA_OPTIONS='
line='JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
register: result_skip_startup_wizard
My Playbook
---
# jenkins
- name: Create jenkins group
group:
name: jenkins
state: present
- name: Create jenkins user
user:
name: jenkins
group: jenkins
state: present
- name: Import jenkins gpg key
rpm_key:
state: present
key: http://pkg.jenkins.io/redhat-stable/jenkins.io.key
validate_certs: no
- name: Download Jenkins repo
get_url:
url: http://get.jenkins.io/redhat-stable/jenkins-2.332.3-1.1.noarch.rpm
dest: /etc/yum.repos.d/
- name: Install java
yum:
name: java-11-openjdk
state: present
- name: Install Jenkins
package:
name: /etc/yum.repos.d/jenkins-2.332.3-1.1.noarch.rpm
state: latest
- name: Jenkins Skip startUp for MI
lineinfile:
dest=/etc/sysconfig/jenkins
regexp='^JENKINS_JAVA_OPTIONS='
line='JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
register: result_skip_startup_wizard
- name: Start and Enable Jenkins
systemd:
name: jenkins
state: started
enabled: true
- name: Sleep for 30 seconds and continue with Jenkins buildout
wait_for: timeout=30
For reference this is what I see in the server when I check the file and then when I just grep for the process.
jenkins 8474 1 34 18:29 ? 00:00:20 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
You can see the changes though do get put in the file as mentioned from above. Which makes me think even after restarting the service its not seeing the new option. I even manually stopped jenkins and then started but it still did not pick it up.
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"
A little late here but I figured I'd leave a comment in here as well as I discovered when I was testing that the setup depended on the version of Jenkins you were attempting to install. Versions I tested are the comment lines above the code.
On the latest line it is just an assumption on my part not a guarantee.
# testing for jenkins 2.319.1
- name: Jenkins Skip startUp for MI
lineinfile:
dest=/etc/sysconfig/jenkins
regexp='^JENKINS_JAVA_OPTIONS='
line='JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
register: result_skip_startup_wizard
# below works for 2.332.1 or latest
- name: Jenkins Skip startUp for MI
lineinfile:
dest=/usr/lib/systemd/system/jenkins.service
regexp='^Environment="JAVA_OPTS=-Djava.awt.headless=true'
line='Environment="JAVA_OPTS=-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
register: result_skip_startup_wizard
I am trying using Jenkins to run Katalon test but I have failure when finish katalon test.
here detail what i have done:
Run Test on Katalon it's work fine no error,
jenkins Failed After runing Katalon test,
Change Jenkinsfile Script with chrome no-sanbox (error)
if you have idea what going on here or find what I miss please let me know, I have work on this few days but still no clue.
here details of my Jenkinsfile, I have declare all variable before.
stage ("Regression Test") {
echo 'regression test'
node ('kre-centos') {
cleanWs deleteDirs: true
checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[credentialsId: 'ci-cd', url: "${katalonRepoUrl}"]], branches: [[name: "${katalonBranch}"]]]
withCredentials([string(credentialsId: 'katalon-api-key', variable: 'secret')]) {
echo "workspace : ${workspace}"
sh """
pwd
ls
/katalon01/katalon-studio-engine/katalonc -noSplash -runMode=console \
-projectPath='${workspace}/${katalonProjectName}' -retry=0 \
-testSuiteCollectionPath="Test Suites/${katalonTestSuiteName}" \
-executionProfile="default" -browserType="Chrome (headless)" \
-apiKey=${secret}
"""
}
}
}
Here details of jenkins log
+ pwd
/katalon01/jenkins-agent/workspace/Framework/framework-katalon
+ ls
build.gradle
console.properties
debug.log
FRM-Katalon.prj
Include
Object Repository
Profiles
Scripts
settings
Test Cases
Test Suites
+ /katalon01/katalon-studio-engine/katalonc -noSplash -runMode=console -projectPath=/katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj -retry=0 '-testSuiteCollectionPath=Test Suites/FRM_Katalon' -executionProfile=default '-browserType=Chrome (headless)' -apiKey= 8490e2f6-9949-4610-b043-*******
Katalon workspace folder is set to default location: /tmp/session-f1cdbf48
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
177 2.4.7.xx-2016111****-e46 = ACTIVE
INFO: Katalon Version: 7.5.2
INFO: Command-line arguments: -runMode=console -projectPath=/katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj -retry=0 -testSuiteCollectionPath=Test Suites/FRM_Katalon -executionProfile=default -browserType=Chrome (headless) -apiKey=******** 8490e2f6-9949-4610-b043-********
INFO: User working dir: /katalon01/jenkins-agent/workspace/Framework/framework-katalon
INFO: Error log: /tmp/session-f1cdbf48/.metadata/.log
INFO: Katalon TestOps server URL: https://analytics.katalon.com
INFO: Katalon Store server URL: https://store.katalon.com
INFO: User home: /katalon01/jenkins-agent
INFO: Java vendor: Oracle Corporation
INFO: Java version: 1.8.0_262
INFO: Local OS: Linux 64bit
INFO: CPU load: 0%
INFO: Total memory: 7316 MB
INFO: Free memory: 1013 MB
Start getting machine ID on Linux
End getting machine ID on Linux c05973d029ca9e78c8*******
Start appending additional signatures
hardwareSerialNumber
osDependentUsername jenkins
End appending additional signatures c05973d029ca9e78c8d1437*****__jenkins
INFO: Machine ID: 6546c254cb38a5280********
Activating...
Start activating offline...
Search for valid offline licenses in folder: /katalon01/jenkins-agent/.katalon/license
The number of valid offline licenses: 0
Offline activation failed.
Start activating online...
Cleaning up workspace
Opening project file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/FRM-Katalon.prj
Warning! Please run Katalon execution command outside of the project folder.
Generating global variables...
Parsing custom keywords...
Project 'FRM-Katalon' opened
Start reloading plugins...
Katalon version: 7.5.2
Plugin info URL: https://store.katalon.com/api/products/ks?appVersion=7.5.2&appType=ENGINE&licenseType=ENTERPRISE
Start check license task
chromedriver is located at default location: /katalon01/katalon-studio-engine/configuration/resources/drivers/chromedriver_linux64/chromedriver. In case your browser is updated to a newer version, please use this command to update chromdriver: --config -webui.autoUpdateDrivers=true
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512................................0/7(0%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512.0/7(0%)
--------------------------------------------------------------------------------
Launcher status after execution process completed: Running
Start writing execution.uuid file to folder: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512
Start generating JUnit report folder at: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512...
JUnit report were generated at folder: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512...............................4/7(57%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
........................................................................4/7(57%)
--------------------------------------------------------------------------------
Uploading report to Katalon TestOps...
Start sending test result to Katalon TestOps
Uploading log files of test suite collection
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution.uuid
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution0.log
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/execution.properties
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/Test Suite_Application Controller/20200814_092512/JUnit_Report.xml
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/FRM_Katalon/20200814_092512/JUnit_Report.xml
Sending file: /katalon01/jenkins-agent/workspace/Framework/framework-katalon/Reports/20200814_092512/FRM_Katalon/20200814_092512/20200814_092512.rp
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512..............................7/7(100%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
.......................................................................7/7(100%)
--------------------------------------------------------------------------------
Katalon TestOps: Start uploading report to Katalon TestOps server: https://analytics.katalon.com
Katalon TestOps - Execution URL: https://analytics.katalon.com/from-ks/execution-result?teamId=50***&projectId=62***&id=6941***
End sending to Katalon TestOps
Report has been sent to Katalon TestOps
--------------------------------------------------------------------------------
Test Suites/FRM_Katalon - 20200814_092512..............................7/7(100%)
--------------------------------------------------------------------------------
Test Suites/Test Suite_Application Controller - Chrome - 20200814_092512........
.......................................................................7/7(100%)
--------------------------------------------------------------------------------
Execution completed. Exit code: 1.
Start clean up session
End check license task
End clean up session
Start release license task
License released
End release license task
All launchers terminated
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Posting build status of FAILED to bitbucketERROR: script returned exit code 1
Finished: FAILURE
Here details of Katalon error log
2020-08-14 08:40:21 - [TEST_CASE][FAILED] - Test Cases/Application Controller/TS-001_Login Logout Positive Case: Test Cases/Application Controller/TS-001_Login Logout Positive Case FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: 'http://10.172.**.***:3000/'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at TS-001_Login Logout Positive Case.run(TS-001_Login Logout Positive Case:19)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1597394411452.run(TempTestSuite1597394411452.groovy:37)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'devopstools-katalon', ip: '10.172.**.***', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1127.el7.x86_64', java.version: '1.8.0_262'
Driver info: driver.version: CChromeDriver
remote stacktrace: #0 0x55edd4eed*** <unknown>
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19))
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
... 19 more
Try updating your Chrome options with
ChromeOptions options = new ChromeOptions();
...
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
as suggested here.
UPDATE:
To switch from Katalon keywords to Selenium commands use the DriverFactory library. Add this to the top of your script:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
System.setProperty("webdriver.chrome.driver", "C:\\test\\chromedriver.exe")
ChromeOptions options = new ChromeOptions()
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
WebDriver driver = new ChromeDriver(options)
DriverFactory.changeWebDriver(driver)
For more information see here.
I'm experiencing a strage behavior with my ansible playbook. I'm installing a jenkins server via YUM and add some plugins atferwards.
Basically my playbook works fine but most of the time I run into an issue with the plugins installation. Ansible says it is installing the plugins but the directory remains completely empty and the jenkins log does not show any sign of actually installing a plugin (normaly jenkins logs each plugin installation).
Ansible output from playbook
TASK [Install Plugins on behalf of jenkins user <THE_ADMIN_USER>] ****************************
task path: /home/pd03056a/ansible-playbooks/tasks/install-plugins-master.yml:2
changed: [<SERVERNAME>] => (item={u'key': u'ace-editor'}) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": {"key": "ace-editor"}, "plugin": "ace-editor", "state": "present"}
changed: [<SERVERNAME>] => (item={u'key': u'active-directory'}) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": {"key": "active-directory"}, "plugin": "active-directory", "state": "present"}
changed: [<SERVERNAME>] => (item={u'key': u'ant'}) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": {"key": "ant"}, "plugin": "ant", "state": "present"}
...
My tasklooks like this:
# Jenkins master: install plugins
- name: Install Plugins on behalf of jenkins user {{jenkins_admin_user}} (Servername = {{ inventory_hostname_short }})
jenkins_plugin:
name: "{{ item.key }}"
url: "http://{{ inventory_hostname_short }}:8080"
url_username: "{{jenkins_admin_user}}"
url_password: "{{jenkins_admin_pass}}"
environment:
http_proxy: "http://{{proxy_user}}:{{proxy_pass}}#<THE_SERVER>:80"
https_proxy: "http://{{proxy_user}}:{{proxy_pass}}#<THE_SERVER>:80"
register: plugin_result
until: plugin_result is success
retries: 10
delay: 2
with_items: # no version = latest
- { key: "ace-editor"}
- { key: "active-directory"}
- { key: "ant"}
- { key: "..."}
The contents of the directory right after running the playbook:
$ ls -al /var/lib/jenkins/plugins/
drwxr-xr-x 2 jenkins jenkins 4096 Aug 12 12:54 .
drwxr-xr-x 11 jenkins jenkins 4096 Aug 12 12:57 ..
Directory is totally empty ... I deleted /var/lib/jenkins completely after each try so there is no way any old content remains on the HDD (rm -rf /var/lib/jenkins). I'm a little confused with the ansible message as well. For each plugin it says "changed". But how can something get changed after it was deleted entirely? I would expect something along the lines of "created" oder "added".
Then every once in a while (mostly after waiting some time) the playbook works perfectly normal with all plugins installations for no apparent reason. Maybe there is some kind of cache inside ansible causing this behavior? I'm grateful for any hint. Thanks guys and best regards. Sebastian
I have a playbook with section "pause" and prompt. If I create job within Jenkins with Pipeline plugin and run this job I get
[WARNING]: Not waiting from prompt as stdin is not interactive
and job is failed. The question is how I can run job in interactive mode or how I can pause playbook within exact task and push combination Ctrl+c+c (because ansible module 'pause' is working only like that)? I have googled a few time and tried to do that with
def userInput = input(
id: 'Password', message: 'input your input: ', ok: 'ok',
parameters: [string(defaultValue: '', description: '.....', name: 'INPUT_TEST')])
But I can't push keys combination and can't understand how I can pause jenkins job on specific ansible task within playbook.
Pipeline example:
pipeline {
agent { label 'master' }
environment {
WORKDIR = '/home/jenkins/'
}
stages {
stage('Checkout') {
agent { label 'master' }
steps {
sh '''cd $WORKDIR
ansible-playbook -vvvv manual_playbooks/test.yml'''
}
}
stage ('Echo') {
agent { label 'master' }
steps {
sh 'echo something'
}
}
}
}
Playbook example:
---
- name: test
hosts: localhost
tasks:
- name: Echo start
shell: echo 'start playbook'
- pause:
prompt: "do you want to continue?"
echo: yes
private: no
register: prompt_status
- name: Continue tasks
shell: echo 'Continue full flow'
register: reset_account_response
when: prompt_status.user_input is defined and
prompt_status.user_input == "yes"
- fail:
msg: "Unexpected user input while prompting approval"
when: prompt_status.user_input is defined and
prompt_status.user_input != "yes"
Many thanks.
Why not put a when clause on your pause task to check for the existence of some other variable and then pass that in using Ansible's -e option when running the playbook through Jenkins.