Add new challenge
This commit is contained in:
parent
0f871e9b9e
commit
979d11d13f
93
.gitignore
vendored
Normal file
93
.gitignore
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# celery beat schedule file
|
||||||
|
celerybeat-schedule
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
*.pyc
|
26
README.md
26
README.md
@ -62,7 +62,7 @@
|
|||||||
<td align="center"><a href="#HR"><img src="images/HR.png" width="110px;" height="75px;" alt="HR"/><br /><b>HR</b></a></td>
|
<td align="center"><a href="#HR"><img src="images/HR.png" width="110px;" height="75px;" alt="HR"/><br /><b>HR</b></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><a href="#scenarios"><img src="images/scenarios.png" width="110px;" height="75px;" alt="Scenarios"/><br /><b>Scenarios</b></a></td>
|
<td align="center"><a href="#challenges"><img src="images/challenges.png" width="110px;" height="75px;" alt="Challenges"/><br /><b>Challenges</b></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</center>
|
</center>
|
||||||
@ -4929,24 +4929,26 @@ you can show how you'd be able to mitigate that problem.
|
|||||||
Not only this will tell you what is expected from you, it will also provide big hint on the type of work you are going to do in the first months of your job.
|
Not only this will tell you what is expected from you, it will also provide big hint on the type of work you are going to do in the first months of your job.
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
## Scenarios
|
## Challenges
|
||||||
|
|
||||||
Scenarios are questions which don't have verbal answer and require you one of the following:
|
Challenges require you one of the following:
|
||||||
|
|
||||||
* Set up environments
|
* Set up environments
|
||||||
* Write scripts
|
* Write scripts
|
||||||
* Design and/or develop infrastructure projects
|
* Design and/or develop infrastructure projects
|
||||||
|
* Fix existing applications
|
||||||
|
|
||||||
These questions usually given as an home task to the candidate and they can combine several topics together.
|
These type of questions usually given as an home task to the candidate and they can combine several topics together.
|
||||||
Below you can find several scenario questions:
|
Below you can find several challenges:
|
||||||
|
|
||||||
* [Writing a Dockerfile and running a container](scenarios/write_dockerfile_run_container.md)
|
* [Writing a Dockerfile and running a container](challenges/write_dockerfile_run_container.md)
|
||||||
* [Elasticsearch & Kibana on AWS](scenarios/elk_kibana_aws.md)
|
* [Elasticsearch & Kibana on AWS](challenges/elk_kibana_aws.md)
|
||||||
* [Ansible, Minikube and Docker](scenarios/ansible_minikube_docker.md)
|
* [Ansible, Minikube and Docker](challenges/ansible_minikube_docker.md)
|
||||||
* [Cloud Slack bot](scenarios/cloud_slack_bot.md)
|
* [Cloud Slack bot](challenges/cloud_slack_bot.md)
|
||||||
* [Jenkins: writing scripts](scenarios/jenkins_scripts.md)
|
* [Jenkins: writing scripts](challenges/jenkins_scripts.md)
|
||||||
* [Jenkins: writing pipelines](scenarios/jenkins_pipelines.md)
|
* [Jenkins: writing pipelines](challenges/jenkins_pipelines.md)
|
||||||
* [CI for open source project](scenarios/ci_for_open_source_project.md)
|
* [CI for open source project](challenges/ci_for_open_source_project.md)
|
||||||
|
* [Flask, Containers and CI](challenges/flask_container_ci/README.md)
|
||||||
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
34
challenges/flask_container_ci/README.md
Normal file
34
challenges/flask_container_ci/README.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Your mission, should you choose to accept it, involves fixing the app in this directory, containerize it and set up a CI for it.
|
||||||
|
Please read carefully all the instructions.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Create a virtual environment with `python3 -m venv challenge_venv`
|
||||||
|
2. Activate it with `source challenge_venv/bin/activate`
|
||||||
|
3. Install requirements.txt `pip install -r requirements.txt`
|
||||||
|
|
||||||
|
## Run the app
|
||||||
|
|
||||||
|
1. Run `export FLASK_APP=app/app.py`
|
||||||
|
1. To run the app execute `flask run`. If it doesn't works, fix it
|
||||||
|
|
||||||
|
|
||||||
|
## Containers
|
||||||
|
|
||||||
|
Using Docker or Podman, containerize the flask app so users can run the following two commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t app:latest /path/to/Dockerfile
|
||||||
|
docker run -d -p 5000:5000 app
|
||||||
|
```
|
||||||
|
|
||||||
|
1. You can use any image base you would like
|
||||||
|
2. Containrize only what you need for running the application, nothing else.
|
||||||
|
|
||||||
|
## CI
|
||||||
|
|
||||||
|
Great, now that we have a working app and also can run it in a container, let's set up a CI for it so it won't break again in the future
|
||||||
|
|
||||||
|
1. The CI should run the tests in the app directory
|
||||||
|
2. There should be some kind of test for the Dockerfile you wrote
|
||||||
|
2. Add additional unit test (or another level of tests)
|
9
challenges/flask_container_ci/app/app.py
Normal file
9
challenges/flask_container_ci/app/app.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def hello_world():
|
||||||
|
return 'Hello, World!'
|
12
challenges/flask_container_ci/app/config.py
Normal file
12
challenges/flask_container_ci/app/config.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
SECRET_KEY = 'shhh'
|
||||||
|
CSRF_ENABLED = True
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
|
||||||
|
|
25
challenges/flask_container_ci/app/tests.py
Normal file
25
challenges/flask_container_ci/app/tests.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from config import basedir
|
||||||
|
from app import app
|
||||||
|
from app import db
|
||||||
|
|
||||||
|
class TestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
app.config['TESTING'] = True
|
||||||
|
app.config['WTF_CSRF_ENABLED'] = False
|
||||||
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'test.db')
|
||||||
|
self.app = app.test_client()
|
||||||
|
db.create_all()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
db.session.remove()
|
||||||
|
db.drop_all()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# We dont care about non alphanumerics filenames so we just ls | grep to shorten the script.
|
# We dont care about non alphanumerics filenames so we just ls | grep to shorten the script.
|
||||||
|
|
||||||
echo $(( $(ls ./scenarios/ | grep ".*md" -c) + $(grep \</summary\> -c README.md) ))
|
echo $(( $(ls ./challenges/ | grep ".*md" -c) + $(grep \</summary\> -c README.md) ))
|
||||||
|
Loading…
Reference in New Issue
Block a user