Skip to content

Commit ae14b0c

Browse files
committed
install vscode from microsoft package repositories
1 parent 332f334 commit ae14b0c

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

roles/vscode/tasks/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
- name: Add VSCode apt signing key if not present
4+
apt_key:
5+
id: BC528686B50D79E339D3721CEB3E94ADBE1229CF
6+
url: https://packages.microsoft.com/keys/microsoft.asc
7+
state: present
8+
9+
- name: Add Microsoft's VSCode repository into sources list
10+
apt_repository:
11+
repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
12+
state: present
13+
14+
- name: Install VSCode
15+
apt:
16+
name: code
17+
state: present

site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
- { role: testinfra, tags: "testinfra" }
1515
- { role: bashrc_d, tags: "bashrc_d" }
1616
- { role: git, tags: "git" }
17+
- { role: vscode, tags: "vscode" }

spec/test_vscode.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
def test_vscode_apt_sources_list_exists_(host):
3+
assert host.file('/etc/apt/sources.list.d/packages_microsoft_com_repos_vscode.list').exists
4+
5+
def test_vscode_apt_key_defined_(host):
6+
assert 'Microsoft (Release signing) <gpgsecurity@microsoft.com>' in host.run('apt-key list').stdout
7+
8+
def test_vscode_command_is_found_(host):
9+
assert host.run('which code').rc is 0
10+
11+
def test_vscode_version_command_succeeds_(host):
12+
assert host.run('code --version').rc is 0

0 commit comments

Comments
 (0)