Skip to content

Commit

Permalink
Added the Gryphon challenge (#43)
Browse files Browse the repository at this point in the history
Added the Gryphon challenge
Optimized the CI
Renamed lighttpd to prod and added Dind

Co-authored-by: Asaf Greenholts <asaf@cidersecurity.io>
Co-authored-by: Yaron Avital <yaron.avital@cidersecurity.io>
  • Loading branch information
3 people committed Nov 16, 2022
1 parent 7a4f365 commit bffc5cd
Show file tree
Hide file tree
Showing 304 changed files with 11,958 additions and 154 deletions.
59 changes: 8 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,12 @@ jobs:
resource_class: large
steps:
- checkout
- restore_cache:
keys:
- v1-docker-{{ .Branch }}
- run:
name: Load Docker layers cache
command: |
set +o pipefail
docker load -i ~/docker-layers.tar | true
- run:
name: Docker compose
command: |
python3 rename.py git
cp -R ctfd/data/ tmp-ctfd/
docker-compose -f docker-compose-dev.yaml up -d --build
- run:
name: Save Docker layers cache
command: |
DOCKER_IMAGES=$(docker images --format "{{ .Repository }}" --filter=reference="cidersecurity/goat-*")
DOCKER_LAYERS=$(for image in $DOCKER_IMAGES; do docker history $image -q | grep -v missing; done)
docker save -o ~/docker-layers.tar $DOCKER_LAYERS
- save_cache:
key: v1-docker-{{ .Branch }}-{{ epoch }}
paths:
- ~/docker-layers.tar
- run:
name: Install testing dependencies
command: |
Expand All @@ -44,17 +26,7 @@ jobs:
python3 -m pipenv install --deploy
- run:
name: Wait for services to start
command: |
for i in {1..30}
do
jenkins_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost:8080/login) || true
gitea_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost:3000/) || true
if [ "$jenkins_status_code" -eq 200 ] && [ "$gitea_status_code" -eq 200 ]; then
break
fi
sleep 1
done
sleep 80
command: ./wait.sh
- run:
name: Pytest
command: |
Expand All @@ -68,15 +40,6 @@ jobs:
VERSION: << pipeline.parameters.VERSION >>
steps:
- checkout
- restore_cache:
keys:
- v1-docker-{{ .Branch }}
- run:
name: Load Docker layers cache
command: |
echo $DOCKER_USERNAME | base64 | base64
set +o pipefail
docker load -i ~/docker-layers.tar | true
- run:
name: Docker compose
command: |
Expand All @@ -92,17 +55,7 @@ jobs:
python3 -m pipenv install --deploy
- run:
name: Wait for services to start
command: |
for i in {1..30}
do
jenkins_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost:8080/login) || true
gitea_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost:3000/) || true
if [ "$jenkins_status_code" -eq 200 ] && [ "$gitea_status_code" -eq 200 ]; then
break
fi
sleep 1
done
sleep 80
command: ./wait.sh
- run:
name: Pytest
command: |
Expand All @@ -121,13 +74,17 @@ jobs:
docker tag $ORG/goat-jenkins-agent:latest $ORG/goat-jenkins-agent:$VERSION
docker tag $ORG/goat-gitea:latest $ORG/goat-gitea:$VERSION
docker tag $ORG/goat-ctfd:latest $ORG/goat-ctfd:$VERSION
docker tag $ORG/goat-lighttpd:latest $ORG/goat-lighttpd:$VERSION
docker tag $ORG/goat-prod:latest $ORG/goat-prod:$VERSION
docker tag $ORG/goat-gitlab:latest $ORG/goat-gitlab:$VERSION
docker tag $ORG/goat-gitlab-runner:latest $ORG/goat-gitlab-runner:$VERSION
docker push $ORG/goat-jenkins-server:$VERSION
docker push $ORG/goat-jenkins-agent:$VERSION
docker push $ORG/goat-gitea:$VERSION
docker push $ORG/goat-ctfd:$VERSION
docker push $ORG/goat-lighttpd:$VERSION
docker push $ORG/goat-prod:$VERSION
docker push $ORG/goat-gitlab:$VERSION
docker push $ORG/goat-gitlab-runner:$VERSION
workflows:
version: 2
Expand Down
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
tmp-ctfd/

# macos
**/.DS_Store
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -12,21 +16,21 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
dist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
*.egg-info/
MANIFEST

# PyInstaller
Expand Down Expand Up @@ -132,3 +136,6 @@ dmypy.json

.idea/
tests/repositories/
gitlab/terraform.tfstate

!/gitlab/repositories/pygryphon/dist
3 changes: 3 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pytest = "*"
requests = "*"
jenkinsapi = "*"
gitpython = "*"
build = "*"
twine = "*"
python-gitlab = "*"

[dev-packages]

Expand Down
Loading

0 comments on commit bffc5cd

Please sign in to comment.