Skip to content

Commit

Permalink
Merge pull request toptal#5 from toptal/revert-2-add-async-option
Browse files Browse the repository at this point in the history
Revert "Add async option"
  • Loading branch information
romanrod authored Jul 1, 2021
2 parents 6acd0bd + 7486703 commit 1958956
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 16 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,4 @@ jobs:
job_name: "the-name-of-your-jenkins-job"
job_params: '{"param_1":"value_1", "param_2":"value_2"}'
job_timeout: "3600" # Default 30 sec. (optional)
async: false # Default to false (optional)
```

It's also possible to trigger a Jenkins job without waiting for it to finish by setting async option as true
7 changes: 0 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ inputs:
description: 'Jenkins job timeout period. Default 30 seconds'
required: false
default: '30'
async:
description: 'Set to true if you want to just trigger the job without waiting for it to finish'
required: false
default: false
outputs:
jenkins_job_url:
description: 'URL to the job details'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
7 changes: 1 addition & 6 deletions jenkins/job_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Jenkins
class JobClient

attr_reader :async_mode, :jenkins_url, :jenkins_user, :jenkins_token, :job_name, :job_params, :job_timeout
attr_reader :jenkins_url, :jenkins_user, :jenkins_token, :job_name, :job_params, :job_timeout

DEFAULT_TIMEOUT = 30
INTERVAL_SECONDS = 10
Expand All @@ -13,7 +13,6 @@ def initialize(args)
@jenkins_user = args['INPUT_JENKINS_USER']
@jenkins_token = args['INPUT_JENKINS_TOKEN']
@job_name = args['INPUT_JOB_NAME']
@async_mode = args['INPUT_ASYNC']
@job_params = JSON.parse(args['INPUT_JOB_PARAMS'])
@job_timeout = args['INPUT_JOB_TIMEOUT'] || DEFAULT_TIMEOUT
end
Expand All @@ -22,11 +21,7 @@ def call
crumb = get_crumb
queue_item_location = queue_job(crumb, job_name, job_params)
job_run_url = get_job_run_url(queue_item_location, job_timeout)
puts "::set-output name=jenkins_job_url::#{job_run_url}"
puts "Job run URL: #{job_run_url}"

exit(0) if @async_mode

job_progress(job_run_url, job_timeout)
exit(0)
end
Expand Down

0 comments on commit 1958956

Please sign in to comment.