Skip to content

Commit

Permalink
GitHub Actions rewritten + necessary code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Jan 1, 2020
1 parent 697d6be commit a19d322
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 62 deletions.
76 changes: 30 additions & 46 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,55 @@
name: "checks"
name: checks

on:
pull_request:
types: [opened, synchronize]
push:
branches: [master]

jobs:
command-check:
name: "Command check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Update repositories"
run: sudo apt update
- name: Update repositories
run: sudo apt update

- name: "Run tests"
run: |
sudo apt install -y pv siege
tests/ci_test.sh
- name: Run tests
run: |
sudo apt install -y pv siege
tests/ci_test.sh
markdown-lint-check:
name: "Markdown lint check"
markdownlint-check:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install markdownlint-cli"
run: npm install -g markdownlint-cli
- uses: actions/checkout@v2

- name: "Create markdownlint configuration file"
run: |
echo "{ MD013: false }" > /tmp/markdownlint_config.json
- name: "Run markdownlint"
run: find . -path ./node_modules -prune -o -name "*.md" -print0 | xargs -t -0 markdownlint -c /tmp/markdownlint_config.json
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v1.1.1
with:
files: .
config_file: .markdownlint.yml

markdown-spell-check:
name: "Markdown spell check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install markdown-spellcheck"
run: npm install -g markdown-spellcheck
- name: Install markdown-spellcheck
run: npm install -g markdown-spellcheck

- name: "Run mdspell"
run: mdspell '**/*.md' '!**/node_modules/**/*.md' --ignore-numbers --ignore-acronyms --report --en-gb
- name: Run mdspell
run: find . -type f -name "*.md" -exec mdspell --ignore-numbers --ignore-acronyms --report --en-gb {} \;

markdown-link-check:
name: "Markdown link check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: gaurav-nelson/github-action-markdown-link-check@0.4.0
- uses: actions/checkout@v2

- name: Link Checker
uses: gaurav-nelson/github-action-markdown-link-check@0.4.0
51 changes: 51 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: terraform

on:
pull_request:
types: [opened, synchronize]
paths:
- .github/workflows/terraform.yml
- terraform/**
push:
branches: [master]
paths:
- .github/workflows/terraform.yml
- terraform/**

jobs:
terraform-check:
name: Terraform Actions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Terraform Format
uses: hashicorp/terraform-github-actions@v0.6.4
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: fmt
tf_actions_working_dir: terraform/openstack
tf_actions_comment: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Terraform Init
uses: hashicorp/terraform-github-actions@v0.6.4
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: init
tf_actions_working_dir: terraform/openstack
tf_actions_comment: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Terraform Validate
uses: hashicorp/terraform-github-actions@v0.6.4
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: validate
tf_actions_working_dir: terraform/openstack
tf_actions_comment: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: yamllint

on:
pull_request:
types: [opened, synchronize]
paths:
- '**.yml'
- '**.yaml'
push:
paths:
- '**.yml'
- '**.yaml'

jobs:
yamllint-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: yamllint
uses: ibiqlik/action-yamllint@master
with:
file_or_dir: .
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD013:
code_blocks: false
tables: false
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 80
level: warning
16 changes: 8 additions & 8 deletions terrafrom/openstack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ resource "openstack_networking_router_v2" "private-router" {

# Create router interface for private subnet
resource "openstack_networking_router_interface_v2" "router-interface" {
count = "${var.environment_count}"
router_id = "${element(openstack_networking_router_v2.private-router.*.id, count.index)}"
subnet_id = "${element(openstack_networking_subnet_v2.private-subnet.*.id, count.index)}"
count = "${var.environment_count}"
router_id = "${element(openstack_networking_router_v2.private-router.*.id, count.index)}"
subnet_id = "${element(openstack_networking_subnet_v2.private-subnet.*.id, count.index)}"
}

# Create floating IP for nodes
Expand All @@ -80,7 +80,7 @@ resource "openstack_compute_instance_v2" "vms" {
security_groups = ["${openstack_networking_secgroup_v2.secgroup.name}"]

network {
uuid = "${element(openstack_networking_network_v2.private-network.*.id, count.index / var.vm_nodes )}"
uuid = "${element(openstack_networking_network_v2.private-network.*.id, count.index / var.vm_nodes)}"
fixed_ip_v4 = "${cidrhost(var.openstack_networking_subnet_cidr, var.vm_nodes_network_private_ip_last_octet + count.index % var.vm_nodes + 1)}"
access_network = true
}
Expand All @@ -95,18 +95,18 @@ resource "openstack_compute_floatingip_associate_v2" "floatingip-associate" {

# Wait for VMs to be fully up (accessible by ssh)
resource "null_resource" "vms" {
count = "${var.vm_nodes * var.environment_count}"
depends_on = ["openstack_compute_floatingip_associate_v2.floatingip-associate"]
count = "${var.vm_nodes * var.environment_count}"
depends_on = ["openstack_compute_floatingip_associate_v2.floatingip-associate"]

connection {
type = "ssh"
host = "${element(openstack_networking_floatingip_v2.floatingip.*.address, count.index)}"
#private_key = "${file("~/.ssh/id_rsa")}"
user = "${var.username}"
user = "${var.username}"
agent = true
}
provisioner "remote-exec" {
inline = [ ]
inline = []
}
}

Expand Down
10 changes: 5 additions & 5 deletions terrafrom/openstack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "openstack_auth_url" {

variable "openstack_availability_zone" {
description = "Availability zone in which to create the server"
default = "nova"
default = "nova"
}

variable "openstack_instance_flavor_name" {
Expand All @@ -21,22 +21,22 @@ variable "openstack_instance_image_name" {

variable "openstack_keypair_public_key" {
description = "SSH Public key location"
default = "~/.ssh/id_rsa.pub"
default = "~/.ssh/id_rsa.pub"
}

variable "openstack_networking_network_external_network_name" {
description = "External network name"
default = "public"
default = "public"
}

variable "openstack_networking_subnet_cidr" {
description = "CIDR for new network where all VMs will be connected"
default = "192.168.250.0/24"
default = "192.168.250.0/24"
}

variable "openstack_networking_subnet_dns_nameservers" {
description = "DNS servers"
default = ["8.8.8.8", "8.8.4.4"]
default = ["8.8.8.8", "8.8.4.4"]
}

variable "openstack_networking_floatingip" {
Expand Down
6 changes: 3 additions & 3 deletions yaml/fluentd-istio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ metadata:
spec:
match: "true" # match for all requests
actions:
- handler: handler.fluentd
instances:
- newlog.logentry
- handler: handler.fluentd
instances:
- newlog.logentry

0 comments on commit a19d322

Please sign in to comment.