Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
kszkepzes
old
kszkepzes-backend
Commits
1bc791d6
Commit
1bc791d6
authored
2 years ago
by
Torma Kristóf
Browse files
Options
Downloads
Patches
Plain Diff
Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist
parent
46904968
No related branches found
No related tags found
1 merge request
!13
Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist
Pipeline
#43309
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+54
-63
54 additions, 63 deletions
.gitlab-ci.yml
with
54 additions
and
63 deletions
.gitlab-ci.yml
+
54
−
63
View file @
1bc791d6
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
image
:
python:3.11
image
:
python:3.11
#services:
# - postgres:13
variables
:
variables
:
POSTGRES_DB
:
kszkepzes
POSTGRES_DB
:
kszkepzes
CONTAINER_IMAGE
:
'
harbor.sch.bme.hu/kszk/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME'
CONTAINER_IMAGE
:
harbor.sch.bme.hu/kszk/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
cache
:
cache
:
key
:
'
$CI_JOB_NAME-$CI_COMMIT_REF_SLUG
'
key
:
"
$CI_JOB_NAME-$CI_COMMIT_REF_SLUG
"
paths
:
paths
:
-
.cache/pip
-
"
.cache/pip
"
-
env/
-
env/
stages
:
stages
:
-
Test and Flake8
-
Test and Flake8
-
Docker Build
-
Docker Build
-
deploy
-
deploy
-
test
Flake8
:
Flake8
:
stage
:
Test and Flake8
stage
:
Test and Flake8
only
:
only
:
-
dev
-
dev
-
master
-
master
-
tags
-
tags
tags
:
[
kszk
]
tags
:
-
kszk
script
:
script
:
-
python -V
-
python -V
-
python3 -m venv env
-
python3 -m venv env
-
source env/bin/activate
-
source env/bin/activate
-
pip install -r requirements/production.txt
-
pip install -r requirements/production.txt
-
flake8 --max-line-length=125 --exclude=src/kszkepzes,migrations,env
-
flake8 --max-line-length=125 --exclude=src/kszkepzes,migrations,env
# TODO write tests
# Test:
# stage: Test and Flake8
# only:
# - dev
# - master
# tags: [kszk]
# variables:
# DATABASE_URL: 'postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB'
# SECRET_KEY: 'secret'
# AUTHSCH_KEY: 'secret'
# AUTHSCH_SECRET: 'secret'
# script:
# - python -V
# - python3 -m venv env
# - source env/bin/activate
# - pip install -r requirements/production.txt
# - python src/manage.py test
Docker build to KSZK registry
:
Docker build to KSZK registry
:
stage
:
Docker Build
stage
:
Docker Build
tags
:
[
kszk
]
tags
:
-
kszk
only
:
only
:
-
tags
-
tags
image
:
image
:
name
:
gcr.io/kaniko-project/executor:debug
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
'
'
]
entrypoint
:
-
'
'
script
:
script
:
-
echo "{\"auths\":{\"harbor.sch.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
echo "{\"auths\":{\"harbor.sch.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}"
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CONTAINER_IMAGE
> /kaniko/.docker/config.json
-
"
/kaniko/executor
--context
$CI_PROJECT_DIR
--dockerfile
$CI_PROJECT_DIR/Dockerfile
--destination
$CONTAINER_IMAGE"
Deploy to Kubernetes
:
Deploy to Kubernetes
:
stage
:
deploy
stage
:
deploy
image
:
alpine
image
:
alpine
tags
:
[
kszk
]
tags
:
-
kszk
environment
:
environment
:
name
:
master
name
:
master
before_script
:
before_script
:
...
@@ -79,9 +65,14 @@ Deploy to Kubernetes:
...
@@ -79,9 +65,14 @@ Deploy to Kubernetes:
script
:
script
:
-
cd k8s
-
cd k8s
-
sed -i "s|##IMAGETAG##|${CI_COMMIT_REF_NAME}|" deployment.yml
-
sed -i "s|##IMAGETAG##|${CI_COMMIT_REF_NAME}|" deployment.yml
# A kovetkezo ket sor egy undorito workaround a mindig valtozo init kontenerek miatt letrejovo es beakado replicasetek miatt. Pls replace, ha van jobb otlet.
-
kubectl delete deployment --namespace=devteam-kszk-bme-hu apache-kszkepzes ||
-
kubectl delete deployment --namespace=devteam-kszk-bme-hu apache-kszkepzes ||
true
true
-
kubectl delete deployment --namespace=devteam-kszk-bme-hu kszkepzes-backend ||
true
-
kubectl delete deployment --namespace=devteam-kszk-bme-hu kszkepzes-backend ||
true
-
kubectl apply -f deployment.yml
-
kubectl apply -f deployment.yml
only
:
only
:
-
tags
-
tags
sast
:
stage
:
test
include
:
-
template
:
Security/SAST.gitlab-ci.yml
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment