Skip to content

Commit

Permalink
Linting fixes (#77)
Browse files Browse the repository at this point in the history
* Linting fixes

* Wrong indent

* Fix conflicts
  • Loading branch information
enolfc authored Aug 6, 2024
1 parent db0f366 commit 13e8e24
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 202 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/shasum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ jobs:
# Runs the Super-Linter action
- name: Calculate the sum for new images
run: |
for f in $(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep "appdb.*\.yaml")
for f in $(git diff --name-only \
${{ github.event.pull_request.base.sha }} \
| grep "appdb.*\.yaml")
do
[ -e "$f" ] || continue
echo "Testing $f"
url=$(yq eval .appdb.url "$f")
curl -I "$url" || exit 1
# now download and shasum
sha_url=$(curl -s "$url" | sha512sum | cut -f1 -d"-" | tr -d "[:space:]")
sha_url=$(curl -s "$url" \
| sha512sum \
| cut -f1 -d"-" \
| tr -d "[:space:]")
sha_appdb=$(yq eval .appdb.sha512 "$f")
if [ "$sha_url" != "$sha_appdb" ]
then
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The repository has a GitHub action workflow that will try to build images from
changes detected in the `*.json` files. This starts a VM at an EGI site (SCAI)
that will:

1. get the repo files at the current commit
1. get the repository files at the current commit
1. install packer
1. build the image described in the json
1. upload to another site (IFCA-LCG2)
Expand Down
15 changes: 9 additions & 6 deletions builder/cloud-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ write_files:
cd /var/tmp/egi || exit
# Valid GitHub token to access the repo
OAUTH_TOKEN="%TOKEN%"
COMMIT_SHA="%REF%"
SHORT_COMMIT_SHA="%SHORT_REF%"
IMAGE="%IMAGE%"
FEDCLOUD_LOCKER_TOKEN="%FEDCLOUD_LOCKER_TOKEN%"
Expand All @@ -57,10 +55,15 @@ write_files:
cat /var/log/image-build.log >>"/var/tmp/egi/$VM_ID"
export PATH="/var/tmp/egi/.venv/bin:$PATH"
# try 10 times, otherwise just die
/var/tmp/egi/builder/refresh.sh cloud.egi.eu "$(cat /var/tmp/egi/.refresh_token)" backend
OS_TOKEN="$(yq -r '.clouds.backend.auth.token' /etc/openstack/clouds.yaml)"
retry -t 25 -d 200 -- openstack --os-cloud backend --os-token "$OS_TOKEN" \
object create --name "$VM_ID" fedcloud-vmi "/var/tmp/egi/$VM_ID"
/var/tmp/egi/builder/refresh.sh cloud.egi.eu \
"$(cat /var/tmp/egi/.refresh_token)" \
backend
OS_TOKEN="$(yq -r '.clouds.backend.auth.token' \
/etc/openstack/clouds.yaml)"
retry -t 25 -d 200 -- openstack --os-cloud backend \
--os-token "$OS_TOKEN" \
object create --name "$VM_ID" \
fedcloud-vmi "/var/tmp/egi/$VM_ID"
path: /usr/local/bin/notify.sh
permissions: '0755'
- content: |
Expand Down
13 changes: 7 additions & 6 deletions centos/provisioners/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
- hosts: all
tasks:
- name: Include cloud-init recipe
include_tasks: cloud-init.yaml
- name: Include "{{ansible_distribution_major_version}}" network recipe
include_tasks: "network-centos{{ansible_distribution_major_version}}.yaml"
- name: Include clean-up recipe
include_tasks: clean.yaml
- name: Include cloud-init recipe
include_tasks: cloud-init.yaml
- name: Include "{{ansible_distribution_major_version}}" network recipe
include_tasks: "network-centos{{ansible_distribution_major_version}}.yaml"
- name: Include clean-up recipe
include_tasks: clean.yaml
29 changes: 15 additions & 14 deletions centos/provisioners/init.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
- hosts: all
gather_facts: False
tasks:
- name: install python
raw: test -e /usr/bin/python || test -e /usr/bin/python3 || (yum install -y python39)
- name: install python
raw: test -e /usr/bin/python || test -e /usr/bin/python3 || (yum install -y python39)

- hosts: all
tasks:
- name: update packages
yum:
name: '*'
state: latest
- name: get the rpm package facts
package_facts:
manager: "auto"
- name: Rebuilding initramfs for kernel
command: |
dracut -f --no-hostonly /boot/initramfs-{{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }}.img
{{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }}
loop: "{{ ansible_facts.packages['kernel'] }}"
- name: update packages
yum:
name: '*'
state: latest
- name: get the rpm package facts
package_facts:
manager: "auto"
- name: Rebuilding initramfs for kernel
command: |
dracut -f --no-hostonly /boot/initramfs-{{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }}.img
{{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }}
loop: "{{ ansible_facts.packages['kernel'] }}"
17 changes: 9 additions & 8 deletions ubuntu/provisioners/appliance.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- hosts: all
roles:
- cloud-init
- role: grycap.docker
vars:
docker_version: "5:20.10.8~3-0~{{ansible_distribution | lower}}-{{ansible_distribution_release}}"
docker_compose_version: 1.29.2
docker_install_pip: false
- appliance
- cleanup
- cloud-init
- role: grycap.docker
vars:
docker_version: "5:20.10.8~3-0~{{ansible_distribution | lower}}-{{ansible_distribution_release}}"
docker_compose_version: 1.29.2
docker_install_pip: false
- appliance
- cleanup
7 changes: 4 additions & 3 deletions ubuntu/provisioners/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- hosts: all
become: true
roles:
- cloud-init
- docker
- cleanup
- cloud-init
- docker
- cleanup
10 changes: 5 additions & 5 deletions ubuntu/provisioners/init.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- hosts: all
become: true
gather_facts: False
tasks:
- name: install python
raw: test -e /usr/bin/python || (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal || DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal)
- name: install python
raw: test -e /usr/bin/python || (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal || DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal)

- hosts: all
become: true
tasks:
- name: update packages
apt: upgrade=dist

- name: update packages
apt: upgrade=dist
Loading

0 comments on commit 13e8e24

Please sign in to comment.