rundeck / rundeck-cli

CLI tool for Rundeck
https://rundeck.github.io/rundeck-cli/
Apache License 2.0
132 stars 49 forks source link

Deleted jobs in SCM are not process until web UI is refreshed #344

Closed josemrs closed 3 years ago

josemrs commented 3 years ago

Hi, I am working with Rundeck CLI to automate some importing when I found that job deletion does not work as I expected.

Scenario

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm config -i import -p runooks
# Project: runooks
# SCM Plugin type: git-import
# SCM Plugin integration: import
config:
  strictHostKeyChecking: no
  gitPasswordPath:
  format: xml
  dir: /home/rundeck/projects/runooks/scm
  branch: master
  url: ssh://git@192.168.1.131:2200/jmrodriguez/rundeck-testing
  filePattern: .*\.xml
  useFilePattern: true
  pathTemplate: ${job.name}.${config.format}
  importUuidBehavior: preserve
  sshPrivateKeyPath: keys/rsa_key
  fetchAutomatically: true
  pullAutomatically: true

Steps to reproduce

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm status -i import -p runooks synchState: CLEAN message: actions:


- Delete one job **and** modify the other. Just deleting one job seems to work fine, the issue seems to arise when deleting **and** modifying. e.g.:

diff --git a/job1.xml b/job1.xml index 0e9e825..0dce92a 100644 --- a/job1.xml +++ b/job1.xml @@ -6,7 +6,7 @@

44dccdf9-72e8-460a-8012-e561fc7520aa
 <loglevel>INFO</loglevel>
 <name>job1</name>

Items: itemId: job1.xml deleted: false tracked: true job: jobName: job1 jobId: 44dccdf9-72e8-460a-8012-e561fc7520aa groupPath: group1/Admin

status: IMPORT_NEEDED


- Perform the import-jobs

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm perform --integration import --project runooks --action import-jobs --allitems

Action import-jobs was successful.

Result: SCM import Action was Successful: import-jobs


- Status still shows the pending deletion and inputs is wrong:

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm status -i import -p runooks synchState: DELETE_NEEDED message: 1 tracked file(s) were deleted actions: import-jobs

~/git/rundeck-testing [master] [None] $ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm inputs -i import -p runooks -a import-jobs Import remote Changes: Import the modifications to Rundeck Fields:

Items: itemId: job1.xml deleted: false tracked: true job: jobName: job1 jobId: 44dccdf9-72e8-460a-8012-e561fc7520aa groupPath: group1/Support

status: CLEAN


- Note that further perform actions does not change status or inputs

- Refresh the Web UI, It shows updated job statuses: 
  - '!' sign: "1 tracked file was deleted" 
  - Job 2 has a '+' sign: "Source file was deleted"

- Now perform import-jobs action again:

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm perform --integration import --project runooks --action import-jobs --allitems

Action import-jobs was successful.

Result: SCM import Action was Successful: import-jobs


- Status and inputs are now ok:

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm status -i import -p runooks synchState: CLEAN message: actions:

$ java -jar ~/Downloads/rundeck-cli-1.3.4-all.jar projects scm inputs -i import -p runooks -a import-jobs Import remote Changes: Import the modifications to Rundeck Fields:

Items: itemId: job1.xml deleted: false tracked: true job: jobName: job1 jobId: 44dccdf9-72e8-460a-8012-e561fc7520aa groupPath: group1/Support

status: CLEAN



- Web UI also shows the correct content, Job 2 is gone.

## Expected behaviour

All changes should be imported using exclusively the CLI, no Web UI interaction should be required.

The first perform import-jobs should have imported all changes **including** the deletion.

Refresh of the Web UI should not be necessary.

I could not replicate the Web UI refresh using the CLI.
gschueler commented 3 years ago

there were some issues in Rundeck 3.3 regarding regarding scm, maybe try Rundeck 3.3.11 release. I will close this issue as it is not specific to the rundeck-cli project. If you still have issues after trying the latest rundeck server release, please file any issues in https://github.com/rundeck/rundeck/issues