Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with session cookie and crumb #1

Open
gitqlt opened this issue Dec 23, 2020 · 0 comments
Open

Build with session cookie and crumb #1

gitqlt opened this issue Dec 23, 2020 · 0 comments

Comments

@gitqlt
Copy link

gitqlt commented Dec 23, 2020

With Jenkins 2.263.1 (docker image)

(See: https://support.cloudbees.com/hc/en-us/articles/219257077-CSRF-Protection-Explained)

  - name: Get crumb and session cookie
    uri:
      url: "http://<<yourip:port>>/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)"
      method: GET
      user: "{{ Uname }}"
      password: "{{ Pass }}"
      force_basic_auth: yes
      status_code: 200
      return_content: yes
    register: cookiecrumb

  - name: Queue build
    uri:
      url: http://<<yourip:port>>/job/<<FolderName>>/job/<<JobName>>/build
      method: POST
      user: "{{ Uname }}"
      password: "{{ Pass }}"
      force_basic_auth: yes
      status_code: 201
      headers:
        Cookie: "{{ cookiecrumb.cookies_string }}"
        Jenkins-Crumb: "{{ cookiecrumb.content[14:] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant