Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
skip_list:
- var-naming[no-role-prefix]
- galaxy[no-changelog]
- galaxy[version-incorrect]
- meta-runtime[unsupported-version]
exclude_paths:
- actionlint.yml
- .github/
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The is primarily used to alter the behaviour of linters executed by super-linter.
# See https://editorconfig.org/

# shfmt will default to indenting shell scripts with tabs,
# define the indent as 2 spaces
[bin/*]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .github/linters/actionlint.yml
47 changes: 47 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Lint

on: # yamllint disable-line rule:truthy
workflow_call:

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

steps:
- uses: actions/checkout@v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0
submodules: true

- name: Run ansible-lint
uses: ansible/ansible-lint@v25.4.0

- name: Load super-linter configuration
# Use grep inverse matching to exclude eventual comments in the .env file
# because the GitHub Actions command to set environment variables doesn't
# support comments.
# yamllint disable-line rule:line-length
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
run: grep -v '^#' super-linter.env >> "$GITHUB_ENV"
if: always()

- name: Run super-linter
uses: super-linter/super-linter@v7.3.0
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Build and test PR

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened
branches:
- main

jobs:
lint:
uses: ./.github/workflows/lint.yml
24 changes: 24 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
extends: default

rules:
brackets:
forbid: non-empty
comments:
# https://github.com/prettier/prettier/issues/6780
min-spaces-from-content: 1
# https://github.com/adrienverge/yamllint/issues/384
comments-indentation: false
document-start: disable
# 160 chars was the default used by old E204 rule, but
# you can easily change it or disable in your .yamllint file.
line-length:
max: 160
# We are adding an extra space inside braces as that's how prettier does it
# and we are trying not to fight other linters.
braces:
min-spaces-inside: 0 # yamllint defaults to 0
max-spaces-inside: 1 # yamllint defaults to 0
octal-values:
forbid-implicit-octal: true # yamllint defaults to false
forbid-explicit-octal: true # yamllint defaults to false
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# caas-repo2docker

This repository adapts [repo2docker](https://repo2docker.readthedocs.io) for use within the
This repository adapts [repo2docker](https://repo2docker.readthedocs.io) for use within the
Cluster-as-a-Service system of the [Azimuth Cloud Portal](https://github.com/azimuth-cloud/azimuth).

## Developing locally

To run the GitHub Actions linters locally, use:

```sh
docker run --rm \
-e RUN_LOCAL=true \
--env-file "super-linter.env" \
-v "$(pwd)":/tmp/lint \
ghcr.io/super-linter/super-linter:v7.3.0
```

```sh
ansible-lint -c .ansible-lint.yml
```
1 change: 1 addition & 0 deletions actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
4 changes: 2 additions & 2 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ gathering = smart
forks = 30
host_key_checking = False
remote_tmp = /tmp
collections_path = collections
roles_path = roles
collections_path = .ansible/collections
roles_path = .ansible/roles
12 changes: 6 additions & 6 deletions repo2docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
- name: Provision infrastructure
hosts: openstack
pre_tasks:
- name: Check that Notebook repository URL exists
uri:
- name: Check that Notebook repository URL exists
ansible.builtin.uri:
url: "{{ cluster_repository }}"
when: (cluster_state | default('present')) == 'present'
roles:
- cluster_infra
post_tasks:
post_tasks:
- name: Wait for Jupyter notebook to become available
uri:
ansible.builtin.uri:
url: "http://{{ zenith_fqdn_repo2docker }}"
method: GET
follow_redirects: safe
Expand All @@ -29,9 +29,9 @@
delay: 10
until: "repo2docker_uri is not failed"
when: (cluster_state | default('present')) == 'present'

- name: Wait for Monitoring to become available
uri:
ansible.builtin.uri:
url: "http://{{ zenith_fqdn_monitoring }}"
method: GET
follow_redirects: safe
Expand Down
18 changes: 11 additions & 7 deletions roles/cluster_infra/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
---

- name: Install Terraform binary
include_role:
ansible.builtin.include_role:
name: azimuth_cloud.terraform.install

- name: Make Terraform project directory
file:
ansible.builtin.file:
path: "{{ terraform_project_path }}"
state: directory
mode: "0755"

- name: Write backend type configuration
copy:
ansible.builtin.copy:
content: |
terraform {
backend "{{ terraform_backend_type }}" { }
}
dest: "{{ terraform_project_path }}/backend.tf"
mode: "0644"

- name: Write backend configuration options
copy:
ansible.builtin.copy:
content: "{{ terraform_backend_config | to_json }}"
dest: "{{ terraform_project_path }}/backend_config.json"
mode: "0644"

- name: Template Terraform files into project directory
template:
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ terraform_project_path }}/{{ item }}"
mode: "0644"
loop:
- outputs.tf
- providers.tf
Expand All @@ -38,5 +42,5 @@
state: "{{ terraform_state }}"
backend_config_files:
- "{{ terraform_project_path }}/backend_config.json"
force_init: yes
init_reconfigure: yes
force_init: true
init_reconfigure: true
14 changes: 14 additions & 0 deletions super-linter.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Detect that default branch is devel when running locally
DEFAULT_BRANCH=main

# Don't validate JSCPD
VALIDATE_JSCPD=false

# Don't validate JS standard because it conflicts with JS prettier
VALIDATE_JAVASCRIPT_STANDARD=false

# Don't validate Ansible because ansible-lint is more flexible
VALIDATE_ANSIBLE=false

# Don't validate YAML prettier because yamllint is sufficient
VALIDATE_YAML_PRETTIER=false
16 changes: 8 additions & 8 deletions ui-meta/repo2docker.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: "repo2docker"
label: "Jupyter Notebook"
description: >-
Interactively explore Jupyter Notebooks from an existing GitHub, GitLab,
description: >-
Interactively explore Jupyter Notebooks from an existing GitHub, GitLab,
Zenodo or Figshare repository. Powered by repo2docker.
logo: https://raw.githubusercontent.com/jupyter/design/master/logos/Square%20Logo/squarelogo-greytext-orangebody-greymoons/squarelogo-greytext-orangebody-greymoons.png
logo: https://raw.githubusercontent.com/jupyter/design/master/logos/Square%20Logo/squarelogo-greytext-orangebody-greymoons/squarelogo-greytext-orangebody-greymoons.png # yamllint disable-line rule:line-length

parameters:
- name: cluster_repository
label: "Notebook Repository"
description: |-
Jupyter notebook source repository compatible with
[repo2docker](https://repo2docker.readthedocs.io/en/latest/usage.html#using-repo2docker).
[repo2docker](https://repo2docker.readthedocs.io/en/latest/usage.html#using-repo2docker).
Examples are available from [Binder](https://github.com/binder-examples).
kind: "string"
immutable: true
options:
placeholder: "e.g. https://github.com/binder-examples/conda"

- name: cluster_flavor
kind: "cloud.size"
label: "Jupyter Notebook size"
Expand All @@ -25,11 +25,11 @@ parameters:
options:
min_ram: 4096
min_disk: 20

- name: cluster_volume_size
label: "Volume size (GB)"
description: |-
The size of the data volume for the node.
The size of the data volume for the node.
The data volume will be available at `/data`.
kind: "cloud.volume_size"
default: 10
Expand All @@ -51,7 +51,7 @@ usage_template: |-
services:
- name: repo2docker
label: Jupyter Notebook
icon_url: https://raw.githubusercontent.com/jupyter/design/master/logos/Square%20Logo/squarelogo-greytext-orangebody-greymoons/squarelogo-greytext-orangebody-greymoons.png
icon_url: https://raw.githubusercontent.com/jupyter/design/master/logos/Square%20Logo/squarelogo-greytext-orangebody-greymoons/squarelogo-greytext-orangebody-greymoons.png # yamllint disable-line rule:line-length
- name: monitoring
label: Monitoring
icon_url: https://raw.githubusercontent.com/cncf/artwork/master/projects/prometheus/icon/color/prometheus-icon-color.png