ffe5351dd1bffd3d8a8227616308be9d374c82e6
[infra/stack/kubernetes.git] / playbooks / roles / package / tasks / record-shas.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 # NOTE (fdegir): ansible-lint complains due to using command module for
21 # getting git sha and it is suppressed since it is not possible to get
22 # sha using ansible git module
23 - name: Fetch commit shas of repos
24   command: git rev-parse HEAD  # noqa 303
25   register: commit_shas
26   with_items:
27     - engine-kubernetes
28     - engine-kubespray
29     - engine-heat
30     - engine-bifrost
31     - engine
32   args:
33     chdir: "{{ git_folder }}/{{ item }}"
34   changed_when: false
35
36 - name: Populate dictionary to map repos to shas
37   set_fact:
38     repos_shas: "{{ repos_shas|default({}) | combine( {item.item | upper | replace('-', '_') + '_SHA': item.stdout} ) }}"
39   with_items: "{{ commit_shas.results }}"
40
41 - name: Record git SHAs to /tmp/release.properties file
42   lineinfile:
43     path: /tmp/release.properties
44     state: present
45     create: true
46     line: "{{ item.key }}={{ item.value }}"
47   with_dict: "{{ repos_shas }}"
48
49 - name: Copy /tmp/release.properties into offline package
50   copy:
51     src: /tmp/release.properties
52     dest: "{{ offline_pkg_folder }}/release.properties"
53     force: true
54
55 # vim: set ts=2 sw=2 expandtab: