# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This job runs on Zuul node itself, thus it's only localhost here - hosts: localhost vars: latest_tag: latest org: airshipit image: deckhand new_tag: "{{ zuul.newrev }}" token: "{{ airship_deckhand_quay_creds.token }}" quay_repo_api_url: "https://quay.io/api/v1/repository" tasks: - name: Debug Zuul vars debug: var: zuul - block: - name: Get id of the container image currently tagged as latest uri: url: "{{ quay_repo_api_url }}/{{ org }}/{{ image }}/tag/?specificTag={{ latest_tag }}&limit=1" return_content: yes register: response_1 - name: Debug response debug: var: response_1 - block: - name: Add latest commit id tag onto the image currently tagged as latest uri: url: "{{ quay_repo_api_url }}/{{ org }}/{{ image }}/tag/{{ new_tag }}" method: PUT headers: Authorization: "Bearer {{ token }}" body_format: json body: image: "{{ response_1.json.tags[0].docker_image_id }}" status_code: 201 return_content: yes register: response_2 - name: Debug response debug: var: response_2