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
26 changes: 26 additions & 0 deletions .github/linters/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration for file paths. The keys are glob patterns to match to file
# paths relative to the repository root. The values are the configurations for
# the file paths. Note that the path separator is always '/'.
# The following configurations are available.
#
# "ignore" is an array of regular expression patterns. Matched error messages
# are ignored. This is similar to the "-ignore" command line option.
paths:
# .github/workflows/**/*.yml:
# ignore: []

.github/workflows/cleanup-ci-resources.yml:
ignore: [ "string should not be empty" ]

.github/workflows/test-backup-restore.yml:
ignore: [ "string should not be empty" ]

.github/workflows/test-ha.yml:
ignore: [ "string should not be empty" ]

.github/workflows/test-singlenode.yml:
ignore: [ "string should not be empty" ]

.github/workflows/test-upgrade.yml:
ignore: [ "string should not be empty" ]

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-rstudio-server

This repository adapts [RStudio](https://posit.co/products/open-source/rstudio/) for use within the
This repository adapts [RStudio](https://posit.co/products/open-source/rstudio/) 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
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
6 changes: 3 additions & 3 deletions rstudio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- cluster_infra
post_tasks:
- name: Wait for RStudio to become available
uri:
ansible.builtin.uri:
url: "http://{{ zenith_fqdn_rstudio }}"
method: GET
follow_redirects: safe
Expand All @@ -24,9 +24,9 @@
delay: 10
until: "rstudio_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
17 changes: 17 additions & 0 deletions super-linter.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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

# Don't validate using kubeconform because it wants an appTemplate schema
VALIDATE_KUBERNETES_KUBECONFORM=false
6 changes: 3 additions & 3 deletions ui-meta/rstudio.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "rstudio"
label: "R-Studio Server"
description: >-
description: >-
Run an R-Studio Server instance for easy web-based access to an R-Studio environment running on cloud hardware.
logo: https://raw.githubusercontent.com/rstudio/hex-stickers/main/thumbs/RStudio.png

parameters:
parameters:
- name: cluster_flavor
kind: "cloud.size"
label: "Machine size"
Expand Down Expand Up @@ -34,7 +34,7 @@ parameters:
immutable: true

usage_template: |-
The RStudio Server web interface can be accessed from the services list.
The RStudio Server web interface can be accessed from the services list.
The `data` directory within RStudio interface should be used to store any long-lived research data.

services:
Expand Down