Skip to content

Commit 0069d34

Browse files
authored
Get the local datalab git version and pass it to the docker build (#37)
* Get the local datalab git version and pass it to the API docker build * Get the local datalab git version and pass it to the API docker build * Also pass app version in build * Bump README versions * Fix ansible lint suggestions
1 parent 724af20 commit 0069d34

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Attempts will be made to tabulate the supported versions of datalab with each re
2525
|---|---|
2626
| v0.1.x | v0.4.x |
2727
| v0.2.x | v0.4.x |
28-
| v0.3.x | v0.5.x+ |
28+
| v0.3.x | v0.5.0-rc.x |
29+
| v0.4.x | v0.5.x |
2930

3031

3132
## Overview

ansible/roles/datalab/tasks/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@
1212
dest: "{{ ansible_user_home_dir }}/datalab/pydatalab/.env"
1313
mode: "0644"
1414

15+
- name: Get git tag version locally to use as fact # noqa: command-instead-of-module
16+
delegate_to: localhost
17+
ansible.builtin.shell:
18+
cmd: set -o pipefail && git describe --tags --match 'v*' | sed 's/^v//' | sed 's/-rc/rc/' | sed 's/-/+/'
19+
chdir: "{{ playbook_dir }}/../src/datalab"
20+
register: git_tag
21+
changed_when: false
22+
23+
- name: Set fact for git tag version
24+
ansible.builtin.set_fact:
25+
git_tag: "{{ git_tag.stdout }}"
26+
27+
- name: Write git version to a .env file to be loaded by build
28+
ansible.builtin.copy:
29+
content: "SETUPTOOLS_SCM_PRETEND_VERSION={{ git_tag }}\nVUE_APP_GIT_VERSION={{ git_tag }}"
30+
dest: "{{ ansible_user_home_dir }}/datalab/.env_version"
31+
mode: "0644"
32+
1533
- name: Copy encrypted API config file from vault
1634
ansible.builtin.copy:
1735
src: "{{ playbook_dir }}/vaults/datalab/prod_config.json"
@@ -38,6 +56,7 @@
3856
build: always
3957
env_files:
4058
- "{{ ansible_user_home_dir }}/datalab/pydatalab/.env"
59+
- "{{ ansible_user_home_dir }}/datalab/.env_version"
4160

4261
- name: Check whether ssh config exists
4362
ansible.builtin.stat:
@@ -85,6 +104,7 @@
85104
build: always
86105
env_files:
87106
- "{{ ansible_user_home_dir }}/datalab/webapp/.env"
107+
- "{{ ansible_user_home_dir }}/datalab/.env_version"
88108

89109
- name: Add daily backup task to crontab
90110
ansible.builtin.cron:

0 commit comments

Comments
 (0)