-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial code import * fix: align .gitignore with other repos * Add build pipelines * Add sonarqube configuration * Add sonar exclusions * Update parent reference Co-authored-by: Radoslaw Orlowski <[email protected]> Co-authored-by: Radoslaw Orlowski <[email protected]>
- Loading branch information
1 parent
ed06271
commit 0736359
Showing
16 changed files
with
1,080 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
# Compiled class file | ||
*.class | ||
*/.idea | ||
*.iml | ||
|
||
# Log file | ||
*.log | ||
.DS_Store | ||
*.bu | ||
|
||
# BlueJ files | ||
*.ctxt | ||
.m2/ | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
.gradle | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
java/target/ | ||
api-tests/target | ||
java/build/ | ||
java/.classpath | ||
java/.project | ||
java/.settings/ | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
.terraform | ||
|
||
node_modules/ | ||
/api-tests-karate/target/ | ||
/.idea/ | ||
target/ | ||
reports/ | ||
|
||
java/emulatorcert.crt | ||
|
||
*.crt |
195 changes: 195 additions & 0 deletions
195
build/azDevOps/azure/azure-pipelines-javaspring-deploy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
############################################################################################################################# | ||
# This is a generated file which includes some replacements. # | ||
# It is still very much recommended to go through this and ensure all variables are correct for your business/domain # | ||
# All variables are defined in a global scope. # | ||
# All Terraform produced resource names are using a labels module ensuring a predictable naming convention # | ||
# E.g.: variables for company, project, stage and domain will produce a name of `$company-$project-$stage-$domain` # | ||
# NB: Some resources e.g. blob storage only allow for alpha numeric characters so the name is adjusted accordingly # | ||
# ==> `$company$project$stage$domain` # | ||
############################################################################################################################# | ||
name: "$(Build.SourceBranchName)-init" | ||
|
||
pr: | ||
- main | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- 'main' | ||
paths: | ||
include: | ||
- '*' | ||
|
||
resources: | ||
repositories: | ||
- repository: templates | ||
type: github | ||
name: amido/stacks-pipeline-templates | ||
# TODO replace with the published branch | ||
ref: feature/yml-template | ||
# EXCHANGE THIS FOR YOUR OWN ENDPOINT CONNECTION TO GITHUB | ||
# REPOSITORY IS PUBLIC | ||
endpoint: amidostacks | ||
|
||
containers: | ||
# Container for Java Build and Testing | ||
- container: azul_java | ||
image: azul/zulu-openjdk-debian:11 | ||
# Container for inlining Jacoco assets as Azure DevOps strips them | ||
# https://github.com/microsoft/azure-pipelines-tasks/issues/3027 | ||
- container: node | ||
image: amidostacks/node-14:0.0.1 | ||
# Container for Sonar Scanner | ||
- container: sonar_scanner | ||
image: amidostacks/ci-sonarscanner:0.0.2 | ||
# Container for Kubernetes Deployment | ||
- container: k8s_deploy | ||
image: amidostacks/ci-k8s:0.0.12 | ||
|
||
variables: | ||
- template: azuredevops-vars.yml | ||
|
||
stages: | ||
- stage: Build | ||
variables: | ||
# You can find notes in the READMEs around which values to use for each ENV variable group | ||
- group: stacks-credentials-nonprod-kv | ||
- group: amido-stacks-java-modules | ||
- group: amido-stacks-java-modules-commons | ||
jobs: | ||
# Compile, test and deploy to an artifact repository the Java module | ||
- job: ModuleBuild | ||
pool: | ||
vmImage: $(pool_vm_image) | ||
steps: | ||
- checkout: self | ||
|
||
- checkout: templates | ||
|
||
# Updates the build number in Azure DevOps (requires refresh in the UI to see) | ||
- bash: | | ||
echo '##vso[Build.UpdateBuildNumber]${{ variables.docker_image_tag }}' | ||
displayName: 'Update: Build Number' | ||
# Validates all YAML files in the repo to check they adhere to standards | ||
- template: templates/java-modules/test-validate-yaml.yml@templates | ||
parameters: | ||
pipeline_scripts_directory: "${{ variables.self_pipeline_scripts_dir }}" | ||
container: "k8s_deploy" | ||
yamllint_config_file: "${{ variables.yamllint_config_file }}" | ||
yamllint_scan_directory: "${{ variables.yamllint_scan_directory }}" | ||
|
||
# Builds the Java app, runs tests and deploy to the artifact repository | ||
- template: templates/java-modules/build-java.yml@templates | ||
parameters: | ||
repo_root_dir: "${{ variables.self_repo_dir }}" | ||
project_root_dir: "${{ variables.self_project_dir }}" | ||
pipeline_scripts_directory: "${{ variables.self_pipeline_scripts_dir }}" | ||
# Maven | ||
maven_cache_directory: "${{ variables.maven_cache_directory }}" | ||
maven_surefire_reports_dir: "${{ variables.maven_surefire_reports_dir }}" | ||
maven_allowed_test_tags: "${{ variables.maven_allowed_test_tags}}" | ||
maven_package_version: "${{ variables.maven_package_version }}" | ||
maven_settings_file: "${{ variables.maven_settings_file }}" | ||
# Artifactory | ||
artifactory_username: "$(artifactory-username)" | ||
artifactory_password: "$(artifactory-password)" | ||
# Docker | ||
docker_build_container: "${{ variables.docker_java_image }}" | ||
# Vulnerability Scanning | ||
vulnerability_scan: "${{ variables.vulnerability_scan }}" | ||
vulnerability_scan_fail_build_on_detection: "${{ variables.vulnerability_scan_fail_build_on_detection }}" | ||
project_type: "${{ variables.java_project_type }}" | ||
|
||
# Performs static code analysis, such as Sonar Cloud | ||
- template: templates/java-modules/test-static-code-analysis.yml@templates | ||
parameters: | ||
project_root_dir: "${{ variables.self_project_dir }}" | ||
pipeline_scripts_directory: "${{ variables.self_pipeline_scripts_dir}}" | ||
# PR / Branch vars | ||
source_branch_ref: "$(source_branch_ref)" | ||
target_branch_ref: "$(target_branch_ref)" | ||
pullrequest_number: "$(pullrequest_number)" | ||
# Sonar | ||
sonar_enable: ${{ variables.sonar_enable }} | ||
sonar_container: "${{ variables.sonar_container }}" | ||
sonar_host_url: "${{ variables.sonar_host_url }}" | ||
sonar_project_name: "$(SONAR_PROJECT_NAME)" | ||
sonar_project_key: "$(SONAR_PROJECT_KEY)" | ||
sonar_token: "$(SONAR_TOKEN)" | ||
sonar_organisation: "$(SONAR_ORGANIZATION)" | ||
# Probably `GitHub` or `vsts` | ||
sonar_pullrequest_provider: "GitHub" | ||
sonar_remote_repo: "${{ variables.self_remote_repo }}" | ||
sonar_command: "${{ variables.sonar_command }}" | ||
# Docker | ||
docker_image_tag: "${{ variables.docker_image_tag }}" | ||
|
||
# Post build tasks, such as Test and Coverage upload, and publishing artefacts | ||
- template: templates/java-modules/post-build-tasks.yml@templates | ||
parameters: | ||
project_root_dir: "${{ variables.self_project_dir }}" | ||
functional_test_project_root_dir: "${{ variables.self_functional_testproject_dir }}" | ||
# Build Output File | ||
# files to be persisted across stages | ||
build_file: false | ||
build_file_path: "${{ variables.build_artifact_deploy_path }}" | ||
build_file_artefact_name: "${{ variables.build_artifact_deploy_name }}" | ||
# Functional tests | ||
functional_test: ${{ variables.functional_test }} | ||
functional_test_artefact_name: "${{ variables.functional_test_artefact_name }}" | ||
functional_test_artefact_path: "${{ variables.functional_test_artefact_path }}" | ||
vulnerability_scan: "${{ variables.vulnerability_scan }}" | ||
vulnerability_scan_report: "${{ variables.vulnerability_scan_report }}" | ||
java_project_type: "${{ variables.java_project_type }}" | ||
functional_test_project_type: "${{ variables.functional_test_project_type }}" | ||
# Coverage test | ||
coverage_test: ${{ variables.coverage_test }} | ||
|
||
# Build, test and deploy to an artifact repository the archetype based on the Java module | ||
- job: ArchetypeBuild | ||
dependsOn: ModuleBuild | ||
pool: | ||
vmImage: $(pool_vm_image) | ||
steps: | ||
- checkout: self | ||
|
||
- checkout: templates | ||
|
||
# Updates the build number in Azure DevOps (requires refresh in the UI to see) | ||
- bash: | | ||
echo '##vso[Build.UpdateBuildNumber]${{ variables.docker_image_tag }}' | ||
displayName: 'Update: Build Number' | ||
# Validates all YAML files in the repo to check they adhere to standards | ||
- template: templates/java-modules/test-validate-yaml.yml@templates | ||
parameters: | ||
pipeline_scripts_directory: "${{ variables.self_pipeline_scripts_dir }}" | ||
container: "k8s_deploy" | ||
yamllint_config_file: "${{ variables.yamllint_config_file }}" | ||
yamllint_scan_directory: "${{ variables.yamllint_scan_directory }}" | ||
|
||
# Builds the Java archetype and deploy to the artifact repository | ||
- template: templates/java-modules/build-java-archetype.yml@templates | ||
parameters: | ||
repo_root_dir: "${{ variables.self_repo_dir }}" | ||
project_root_dir: "${{ variables.self_project_dir }}" | ||
pipeline_scripts_directory: "${{ variables.self_pipeline_scripts_dir }}" | ||
# Maven | ||
maven_cache_directory: "${{ variables.maven_cache_directory }}" | ||
maven_surefire_reports_dir: "${{ variables.maven_surefire_reports_dir }}" | ||
maven_allowed_test_tags: "${{ variables.maven_allowed_test_tags}}" | ||
maven_package_version: "${{ variables.maven_package_version }}" | ||
maven_pom_file: "${{ variables.maven_archetype_pom_file }}" | ||
maven_archetype_properties_file: "${{ variables.maven_archetype_properties_file }}" | ||
maven_settings_file: "${{ variables.maven_settings_file }}" | ||
maven_repository_server: "${{ variables.maven_repository_server }}" | ||
# Artifactory | ||
artifactory_username: "$(artifactory-username)" | ||
artifactory_password: "$(artifactory-password)" | ||
# Docker | ||
docker_build_container: "${{ variables.docker_java_image }}" | ||
# Vulnerability Scanning | ||
vulnerability_scan: "${{ variables.vulnerability_scan }}" | ||
vulnerability_scan_fail_build_on_detection: "${{ variables.vulnerability_scan_fail_build_on_detection }}" | ||
project_type: "${{ variables.java_project_type }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
variables: | ||
- name: region | ||
value: westeurope | ||
- name: company | ||
value: amido | ||
- name: project | ||
value: stacks | ||
- name: domain | ||
value: java-core-commons | ||
- name: self_repo | ||
value: stacks-java-core-commons | ||
- name: self_generic_name | ||
value: $(project)-$(domain) | ||
|
||
- name: component | ||
value: core-commons | ||
|
||
- name: role | ||
value: backend | ||
# | ||
# SelfConfig | ||
# If you haven't specified source_repo at cli runtime please ensure you replace it here | ||
# It is case sensitive for TFS based repos | ||
|
||
- name: self_remote_repo | ||
value: "amido/$(self_repo)" | ||
- name: self_repo_src | ||
value: java | ||
- name: self_post_deploy_test_src | ||
value: "api-tests" | ||
- name: self_repo_dir | ||
value: "$(Agent.BuildDirectory)/s/$(self_repo)" | ||
- name: self_project_dir | ||
value: "$(self_repo_dir)/$(self_repo_src)" | ||
- name: self_functional_testproject_dir | ||
value: "$(self_repo_dir)/$(self_post_deploy_test_src)" | ||
- name: self_repo_tf_src | ||
value: deploy/azure/app/kube | ||
- name: self_repo_tf_dir | ||
value: "$(self_repo_dir)/$(self_repo_tf_src)" | ||
|
||
- name: self_pipeline_repo | ||
value: "$(Agent.BuildDirectory)/s/stacks-pipeline-templates" | ||
- name: self_pipeline_scripts_dir | ||
value: "$(self_pipeline_repo)/scripts" | ||
- name: self_pipeline_templates_dir | ||
value: "$(self_pipeline_repo)/templates" | ||
|
||
# Versioning | ||
- name: version_major | ||
value: 0 | ||
- name: version_minor | ||
value: 0 | ||
- name: version_revision | ||
value: "$[counter(join(variables['version_major'], join('-', variables['version_minor'])), 0)]" | ||
|
||
# PR / Branch vars | ||
- name: source_branch_ref | ||
value: "$[coalesce(variables['System.PullRequest.SourceBranch'], variables['Build.SourceBranch'])]" | ||
- name: target_branch_ref | ||
value: "$[coalesce(variables['System.PullRequest.TargetBranch'], '')]" | ||
- name: pullrequest_number | ||
value: "$[coalesce(variables['System.PullRequest.PullRequestNumber'], variables['System.PullRequest.PullRequestId'], '')]" | ||
|
||
# Docker Config | ||
- name: docker_dockerfile_path | ||
value: "." | ||
- name: docker_image_name | ||
value: "$(self_generic_name)" | ||
- name: docker_image_tag | ||
value: "${{ variables.version_major }}.${{ variables.version_minor }}.$(version_revision)-$(Build.SourceBranchName)" | ||
- name: docker_java_image | ||
value: "azul_java" | ||
|
||
- name: resource_def_name | ||
value: java-core-commons | ||
|
||
# BUILD ARTIFACTS across stages | ||
- name: build_artifact_deploy_path | ||
value: "${{ variables.self_repo_dir }}/deploy/k8s/app" | ||
- name: build_artifact_deploy_name | ||
value: "${{ variables.self_generic_name }}" | ||
|
||
# DEFAULT IMAGE RUNNER | ||
- name: pool_vm_image | ||
value: ubuntu-20.04 | ||
|
||
# Maven | ||
- name: maven_package_version | ||
value: "${{ variables.version_major }}.${{ variables.version_minor }}.$(version_revision)-$(Build.SourceBranchName)" | ||
- name: maven_cache_directory | ||
value: "./.m2" | ||
- name: maven_surefire_reports_dir | ||
value: "target/surefire-reports" | ||
- name: maven_allowed_test_tags | ||
value: "Unit | Component | Integration" | ||
- name: maven_archetype_pom_file | ||
value: "target/generated-sources/archetype/pom.xml" | ||
- name: maven_archetype_properties_file | ||
value: "archetype.properties" | ||
- name: maven_settings_file | ||
value: "./.mvn/settings.xml" | ||
- name: maven_repository_server | ||
value: stacks.releases::https://amidostacks.jfrog.io/artifactory/default-maven-local | ||
|
||
# Test | ||
- name: functional_test | ||
value: false | ||
- name: coverage_test | ||
value: false | ||
|
||
# Vulnerability Scan | ||
- name: vulnerability_scan | ||
value: true | ||
- name: vulnerability_scan_report | ||
value: "target/dependency-check-report.html" | ||
- name: vulnerability_scan_fail_build_on_detection | ||
value: false | ||
|
||
# Yamllint | ||
- name: yamllint_config_file | ||
value: "${{ variables.self_repo_dir }}/yamllint.conf" | ||
- name: yamllint_scan_directory | ||
value: "." | ||
|
||
# Build Task Naming | ||
- name: java_project_type | ||
value: "Stacks Java commons module" | ||
- name: functional_test_project_type | ||
value: "Functional API Tests" | ||
|
||
# Sonar | ||
- name: sonar_enable | ||
value: true | ||
- name: sonar_container | ||
value: "sonar_scanner" | ||
- name: sonar_host_url | ||
value: "https://sonarcloud.io" | ||
- name: sonar_command | ||
value: "sonar-scanner" | ||
|
||
# GitHub infomration | ||
- name: create_release | ||
value: true | ||
- name: github_release_service_connection | ||
value: GitHubReleases | ||
- name: github_org | ||
value: $(company) |
Oops, something went wrong.