Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(management): added Dependency Track and SonarQube for GoLang projects #25

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Exceptions are acceptable depending on the circumstances (critical bug fixes tha
- added the code check step for GoLang inside the GitHub Actions provider - [#19](https://github.com/rios0rios0/pipelines/issues/19)
- added the binary release feature for GoLang pipelines
- added a script into the Golang `delivery` to seed the database using `Goose`
- added Dependency Track and SonarQube for GoLang projects
- added K8s deployment for all languages in GitLab CI

### Changed

Expand Down
4 changes: 2 additions & 2 deletions gitlab/global/stages/50-deployment/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ deployment:qa:
tags:
- 'dev-gitlab-runner-onprem'
rules:
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $K8S_DEPLOYMENT_NAME"

deployment:prod:
extends: 'deployment:qa'
environment:
name: 'prod'
rules:
- if: "$CI_COMMIT_TAG"
- if: "$CI_COMMIT_TAG && $K8S_DEPLOYMENT_NAME"
2 changes: 2 additions & 0 deletions gitlab/golang/go-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ include:
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/golang/stages/30-tests/go.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/golang/stages/40-delivery/docker.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/40-delivery/release.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/50-deployment/k8s.yaml'

stages:
- 'code check (style/quality)'
- 'security (sca/sast)'
- 'tests'
- 'delivery'
- 'deployment'
26 changes: 26 additions & 0 deletions gitlab/golang/stages/35-management/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include:
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/abstracts/default-variables.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/35-management/abstracts.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/golang/abstracts/go.yaml'

report:sonarqube:
extends: '.sonarqube'
script:
# Get the latest tag as the current project version
- version=$(git describe --tags --abbrev=0)
- 'if [ -z "$version" ]; then echo "Could not find the version tag in the repository"; exit 1; fi'
# Update sonar-project.properties
- echo "sonar.projectVersion=$version" >> sonar-project.properties
- echo "Updated sonar.projectVersion to $version"
- !reference [ .sonarqube, script ]

report:dependency-track:
extends: [ '.go', '.dependency-track' ]
script:
- go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest
# Determine the directory to use
- dir="cmd"
rios0rios0 marked this conversation as resolved.
Show resolved Hide resolved
- '[ -d "$(pwd)/main" ] && dir="main"'
- cyclonedx-gomod app -json -output "$PREFIX$REPORT_PATH/bom.json" -packages -files -licenses -main $dir
- apt update && apt install -y --no-install-recommends curl jq
rios0rios0 marked this conversation as resolved.
Show resolved Hide resolved
- !reference [ .dependency-track, script ]
2 changes: 2 additions & 0 deletions gitlab/javascript/yarn-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include:
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/javascript/stages/36-packaging/docker.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/40-delivery/docker.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/40-delivery/release.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/50-deployment/k8s.yaml'

stages:
- 'code check (style/quality)'
Expand All @@ -14,3 +15,4 @@ stages:
- 'management'
- 'packaging'
- 'delivery'
- 'deployment'
3 changes: 2 additions & 1 deletion gitlab/python/pdm-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ include:
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/python/stages/35-management/pdm.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/40-delivery/docker.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/40-delivery/release.yaml'
#- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/python/stages/5-deployment/k8s.yaml'
- remote: 'https://raw.githubusercontent.com/rios0rios0/pipelines/main/gitlab/global/stages/50-deployment/k8s.yaml'

stages:
- 'code check (style/quality)'
- 'security (sca/sast)'
- 'tests'
- 'management'
- 'delivery'
- 'deployment'