Skip to content

Commit

Permalink
Merge pull request #491 from ripleymj/fix-lint
Browse files Browse the repository at this point in the history
Fix lint
  • Loading branch information
laurelmay authored Apr 3, 2022
2 parents a9e9bc2 + feac220 commit a78e07c
Show file tree
Hide file tree
Showing 26 changed files with 162 additions and 149 deletions.
6 changes: 5 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
skip_list:
# Package installs should not use latest
- package-latest
warn_list:
- fqcn-builtins
- ignore-errors
- experimental
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
4 changes: 2 additions & 2 deletions .github/workflows/auto-update-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Update Ubuntu ISO file name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get install -q -y jq
Expand All @@ -31,7 +31,7 @@ jobs:
echo "::set-output name=iso_file::$ISO_NAME"
echo "::set-output name=mirror_url::$MIRROR_URL"
- name: Open a pull request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
commit-message: >-
Update to Ubuntu ${{ steps.iso.outputs.version }}
Expand Down
70 changes: 30 additions & 40 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@ jobs:
name: Run Ansible lint tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install ansible ansible-lint
pip3 install ansible ansible-lint yamllint
- name: Run ansible-lint
run: |
ansible-lint -R -r lintrules/ansible local.yml oem.yml
ansible-lint -R -r lintrules/ansible
- name: Run actions yamllint
run: |
yamllint .github/workflows/*yml
Packer:
name: Run Packer lint tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
Expand All @@ -37,27 +40,36 @@ jobs:
- name: Run jsonlint
run: |
jsonlint packer/*json
- name: Fetch and unzip packer nightly
run: |
wget -nv -O $HOME/packer.zip https://github.com/hashicorp/packer/releases/download/nightly/packer_linux_amd64.zip
unzip -d $HOME/packer $HOME/packer.zip
- name: Install Hashicorp repo
run: >
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg &&
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]
https://apt.releases.hashicorp.com $(lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list
- name: Install Packer
run: |
sudo apt-get update
sudo apt-get install -y -qq packer
- name: Packer validate
run: |
$HOME/packer/packer validate packer/ubuntu-build.json
$HOME/packer/packer validate packer/mint-build.json
$HOME/packer/packer validate -var-file=packer/beta-vars.json packer/mint-build.json
packer validate packer/ubuntu-build.json
packer validate packer/mint-build.json
# Allow beta/test builds to fail validation
packer validate -var-file=packer/beta-vars.json packer/mint-build.json || true
Python:
name: Run Python lint tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get -q install python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev gir1.2-vte-2.91
- name: Install dependencies
run: |
Expand All @@ -82,43 +94,21 @@ jobs:
- name: Run Shellcheck
run: |
shellcheck --shell=bash scripts/oem-build roles/user/files/csvmprofile
YAML:
name: Run YAML lint tests
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install yamllint
- name: Run actions yamllint
run: |
yamllint .github/workflows/*yml
- name: Run top-level yamllint
run: |
yamllint *yml
- name: Run role-level yamllint
run: |
yamllint roles/*/*/*yml
Hashes:
name: Validate file hashes
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install aiohttp jinja2 pyyaml
- name: Configure download cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/hashlint
key: hashlint-cache-${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ rules:
min-spaces-inside: 1
max-spaces-inside: 1
line-length: disable
truthy:
truthy:
allowed-values: ["yes", "no", "true", "false"]
check-keys: false
6 changes: 3 additions & 3 deletions roles/adv_prog_pkgs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
# tasks file for adv-prog-pkgs
- name: Install advanced language packages
apt:
ansible.builtin.apt:
name: '{{ adv_prog_pkgs_adv_lang }}'
state: latest

- name: Install source control packages
apt:
ansible.builtin.apt:
name: '{{ adv_prog_pkgs_source_control }}'
state: latest

- name: Install code editor packages
apt:
ansible.builtin.apt:
name: '{{ adv_prog_pkgs_code_editor }}'
state: latest
8 changes: 4 additions & 4 deletions roles/basic_prog_pkgs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# tasks file for basic-prog-pkgs
- name: Install introductory development packages
apt:
ansible.builtin.apt:
name: '{{ basic_prog_pkgs_intro_development }}'
state: latest

- name: Copy idlerc prefs
copy:
ansible.builtin.copy:
src: .idlerc
dest: '{{ item.homedir }}'
owner: '{{ item.uid }}'
Expand All @@ -15,7 +15,7 @@
mode: "0640"
loop: "{{ real_users }}"
- name: Copy mimeapps Idle pref
copy:
ansible.builtin.copy:
src: mimeapps.list
dest: '{{ item.homedir }}/.config/'
owner: '{{ item.uid }}'
Expand All @@ -24,7 +24,7 @@
force: no
loop: "{{ real_users }}"
- name: Set Idle pref in existing mimeapps
lineinfile:
ansible.builtin.lineinfile:
path: '{{ item.homedir }}/.config/mimeapps.list'
regexp: '^text/x-python='
line: 'text/x-python=idle-python3.6.desktop;gedit.desktop;pluma.desktop'
Expand Down
18 changes: 9 additions & 9 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# role without error as common is used in both of those.

- name: Check Ubuntu release
set_fact:
ansible.builtin.set_fact:
ubuntu_release: "{{ lookup('ini', 'UBUNTU_CODENAME type=properties file=/etc/os-release') }}"

- name: Process all pending installs
Expand All @@ -15,12 +15,12 @@
environment:
DEBIAN_FRONTEND: noninteractive
- name: Ensure log directory exists
file:
ansible.builtin.file:
path: "{{ log_directory }}"
state: directory
mode: "0755"
- name: Create directory for shared data
file:
ansible.builtin.file:
path: "{{ share_directory }}"
state: directory
owner: root
Expand All @@ -30,29 +30,29 @@
# The policy file must go in /usr/share/polkit-1. It is the only location that
# policykit checks
- name: Install policykit policy for Ansible wrapper
copy:
ansible.builtin.copy:
src: edu.jmu.uug.ansiblewrapper.policy
dest: /usr/share/polkit-1/actions/
mode: "0644"
- name: Install Ansible wrapper GUI script
template:
ansible.builtin.template:
src: uug_ansible_wrapper.py
dest: '{{ uug_ansible_wrapper }}'
mode: "0755"
- name: Install JMU-colored Tux icon
copy:
ansible.builtin.copy:
src: jmu-tux.svg
dest: "/usr/share/icons/hicolor/scalable/apps/{{ tux_icon_name }}.svg"
mode: "0644"
notify: Update icon cache

- name: Ensure local applications folder exists
file:
ansible.builtin.file:
path: "{{ wrapper_desktop_file_path }}"
state: directory
mode: "0755"
- name: Copy shortcut to desktop file directory
template:
ansible.builtin.template:
src: desktop-template.desktop.j2
dest: "{{ wrapper_desktop_file_path }}/jmucs_config.desktop"
mode: "0755"
Expand All @@ -62,7 +62,7 @@
- include_tasks: mint_only.yml
when: "ansible_distribution == 'Linux Mint'"
- name: Refresh apt cache
apt:
ansible.builtin.apt:
update_cache: yes
changed_when: false
ignore_errors: yes
6 changes: 3 additions & 3 deletions roles/common/tasks/mint_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# tasks file for Linux Mint

- name: Create directory for custom MintReport script
file:
ansible.builtin.file:
path: /usr/share/linuxmint/mintreport/reports/001_Run-JMU-CS-Config-Tool
mode: "0755"
owner: root
group: root
state: directory
- name: Install custom MintReport script
template:
ansible.builtin.template:
src: CustomMintReportInfo.py
dest: /usr/share/linuxmint/mintreport/reports/001_Run-JMU-CS-Config-Tool/MintReportInfo.py
mode: "0644"
owner: root
group: root

- name: Set Linux Mint mirrors
template:
ansible.builtin.template:
src: mint.j2
dest: /etc/apt/sources.list.d/official-package-repositories.list
owner: root
Expand Down
2 changes: 1 addition & 1 deletion roles/common/tasks/ubuntu_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# tasks file for Ubuntu

- name: Set Ubuntu mirrors
template:
ansible.builtin.template:
src: ubuntu.j2
dest: /etc/apt/sources.list
owner: root
Expand Down
16 changes: 9 additions & 7 deletions roles/eclipse/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
---
# tasks file for eclipse
- name: Remove Mint Eclipse
apt:
ansible.builtin.apt:
name: '{{ eclipse_remove_mint }}'
state: absent
- name: Check Eclipse
stat:
ansible.builtin.stat:
path: '{{ eclipse.zip }}'
register: st
- block:
- name: Fetch Eclipse bundle
get_url:
ansible.builtin.get_url:
url: '{{ eclipse.url }}'
dest: '{{ eclipse.zip }}'
checksum: 'sha1:{{ eclipse.hash[ansible_architecture] }}'
timeout: 30
force: yes
mode: "0644"
register: url_output
ignore_errors: true
- name: Fetch Eclipse bundle from backup server
get_url:
ansible.builtin.get_url:
url: '{{ eclipse.url_backup }}'
dest: '{{ eclipse.zip }}'
checksum: 'sha1:{{ eclipse.hash[ansible_architecture] }}'
timeout: 30
force: yes
mode: "0644"
when: url_output.failed
- name: Remove old Eclipse directory
file:
ansible.builtin.file:
path: '{{ eclipse.install_path }}'
state: absent
- name: Unpack Eclipse bundle
unarchive:
ansible.builtin.unarchive:
dest: '{{ global_base_path }}'
src: '{{ eclipse.zip }}'
owner: root
Expand All @@ -49,7 +51,7 @@
args:
creates: '{{ eclipse.install_path }}/plugins/net.sf.eclipsecs.checkstyle*'
- name: Install Eclipse desktop icon
template:
ansible.builtin.template:
src: eclipse.desktop.j2
dest: /usr/local/share/applications/eclipse.desktop
mode: "0644"
Expand Down
Loading

0 comments on commit a78e07c

Please sign in to comment.