Skip to content

Commit

Permalink
added tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
monperrus committed Nov 21, 2024
1 parent d619654 commit 80cbb54
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 1 deletion.
40 changes: 39 additions & 1 deletion contributions/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Schedule
## Content

### Week 1

Expand Down Expand Up @@ -129,3 +129,41 @@ General Intro about the course.
1. [Metrics vs Logging for DevOps Monitoring (Comparing Prometheus and ELK Stack)](https://github.com/KTH/devops-course/tree/2024/contributions/presentation/week7/linussve-daniellw/README.md)
1. [Software licencing overview and compliance automation](https://github.com/KTH/devops-course/pull/2614)


### Tutorials

generated by tools/tutorials.py

1. [_Automated API testing using FastAPI, Startlette TestClient and Git Hooks_](https://github.com/KTH/devops-course/pull/2521)
1. [Building and integrating a slack bot with GitHub actions using Node.js](https://github.com/KTH/devops-course/pull/2615)
1. [Continuous delivery to GitHub container registry and containerization](https://github.com/KTH/devops-course/pull/2423)
1. [Creating and using flox environment(s) in an existing project.](https://github.com/KTH/devops-course/pull/2594)
1. [Creating a Robust Gatsby Web Service with Automated Testing and Deployment on GitHub](https://killercoda.com/daniellw/scenario/gatsby-tutorial)
1. [Data access testing using Testcontainers](https://github.com/KTH/devops-course/pull/2554)
1. [Database Visualization with Sampler](https://github.com/KTH/devops-course/pull/2555)
1. [Dependency Management and Security Auditing in npm with Snyk + GitHub Actions](https://github.com/KTH/devops-course/pull/2574)
1. [Deployments with Piku](https://github.com/KTH/devops-course/pull/2608)
1. [End-to-end training of a neural network to deployment in a live application](https://github.com/KTH/devops-course/pull/2519)
1. [Headless web testing using Selenium in Python](https://github.com/KTH/devops-course/pull/2572)
1. [Infracost with CI/CD pipeline](https://github.com/KTH/devops-course/pull/2595)
1. [Infrastructure as Code with Pulumi](https://killercoda.com/bepp-boop/scenario/pulumi)
1. [Managing project dependencies with Devbox](https://killercoda.com/arejula27/scenario/devbox-tutorial](https://killercoda.com/arejula27/scenario/devbox-tutorial))
1. [Mastering Docker: Building, Networking, and Optimizing Containers with Multi-Stage Builds and Advanced Features](https://github.com/KTH/devops-course/pull/2582)
1. [Monitoring ML Model Predictions with Prometheus](https://github.com/KTH/devops-course/pull/2563)
1. [Multibranch pipelines with ArgoCD](https://github.com/KTH/devops-course/pull/2430)
1. [Nixpkgs and its use for reproducible environments for better local testing.](https://github.com/KTH/devops-course/pull/2455)
1. [No title found](https://github.com/KTH/devops-course/pull/2542)
1. [Policy as Code with Kubewarden: Implement and Enforce Kubernetes Policies](https://killercoda.com/kubewarden-executable-tutorial)
1. [Profiling Python Applications Without Modifying Code With Py-Spy](https://github.com/KTH/devops-course/pull/2565)
1. [Real-Time Log Monitoring with Loki and Grafana](https://github.com/KTH/devops-course/pull/2517)
1. [REST API Fuzzing using Schemathesis](https://github.com/KTH/devops-course/pull/2632)
1. [SAST in go using gosec](https://github.com/KTH/devops-course/pull/2491)
1. [Security Linting in Python using Bandit](https://github.com/KTH/devops-course/pull/2424)
1. [Setting Up a Dashboard using Splunk](https://github.com/KTH/devops-course/pull/2451)
1. [Setting Up OPA for Kubernetes Policy Enforcement](https://killercoda.com/trighap52/course/scenarios/opa-tutorial)
1. [Simulating failures in applications using Chaos Mesh](https://github.com/KTH/devops-course/pull/2557)
1. [Simulating Serverless Architectures with LocalStack](https://github.com/KTH/devops-course/pull/2596)
1. [Using Ansible for Disaster Recovery automation](https://github.com/KTH/devops-course/pull/2488)
1. [Using Github Actions in combination with GitHub Pages to launch your Vue web service](https://github.com/KTH/devops-course/pull/2618)
1. [Using Skaffold for Local Kubernetes Development and CI/CD.](https://github.com/KTH/devops-course/pull/2573)
1. [Working with Kubernetes and Docker to deploy and scale a web application](https://github.com/KTH/devops-course/pull/2529)
82 changes: 82 additions & 0 deletions tools/tutorials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/python3
# list all tutorials

import subprocess

# get current date and time
import datetime
import re
import sys

# get output of command ls

# get output of command ls
# and store it in a variable

TASK="executable-tutorial"
output = subprocess.getoutput("git log --oneline contributions/"+TASK+"/").split("\n")
output.reverse()

def get_title(content):
lines = content.split("\n")
for idx in range(len(lines)):
line = lines[idx]
if line.startswith("## Title"):
if len(lines[idx+1].strip())>0:
# return next line
return lines[idx+1]
if len(lines[idx+2].strip())>0:
# return next line
return lines[idx+2]
return "No title found"

def get_killercoda(content, pr):
# match all urls
urls = re.findall(r"(https?://[^\s]+)", content)
# find a URL to killercoda
for url in urls:
if "killercoda" in url:
return url
return pr

PRs = {}
for i in output:
# print(i)
# get pull request id from commit message
# get commit message
commit_message = i
# get pull request id
pull_request_id = re.findall(r"[(]#([0-9]+)[)]", commit_message)
if len(pull_request_id) == 0:
continue
# print( pull_request_id )



# parse git output
# get commit hash
commit_hash = i.split(" ")[0]
# get list of files in the commit using git command
files = [x for x in subprocess.getoutput(f"git diff-tree --no-commit-id --name-only -r {commit_hash}").split("\n") if ".md" in x.lower() and (TASK in x)]
# print the commit hash
#print(commit_hash)
# get content of first file
# and print it
# print(files)
for file in files:
content = subprocess.getoutput(f"git show {commit_hash}:{file}")
# parse content as markdown
title = get_title(content)
pr = f"https://github.com/KTH/devops-course/pull/{pull_request_id[0]}"
url = get_killercoda(content, pr)
# we only print the first PR
if title not in PRs:
print(f"1. [{title}]({url})")
PRs[title] = [url]
else: PRs[title].append(url)






0 comments on commit 80cbb54

Please sign in to comment.