Skip to content

Commit

Permalink
init test-argo
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebchoi committed Nov 5, 2024
0 parents commit f8e03c3
Show file tree
Hide file tree
Showing 148 changed files with 5,157 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
generated/
generated-test/
target/
__pycache__/

# Poetry
dist/
poetry.toml

# IDEs
*.iml
.idea
.project
.settings
.classpath
.DS_Store
.vscode/
**/charts/*
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions>
<extension>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-build-cache-extension</artifactId>
<version>1.1.0</version>
</extension>
</extensions>
117 changes: 117 additions & 0 deletions .mvn/maven-build-cache-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd">

<!--
Maven build cache configuration for aiSSEMBLE
This feature requires Maven 3.9+, and is enabled by default. To disable it, you must pass the
-Dmaven.build.cache.skipCache=true flag to your build, or set `enabled` to `false` within this file. It is also
useful to look over the other build options available:
https://maven.apache.org/extensions/maven-build-cache-extension/parameters.html
-->

<configuration>
<enabled>true</enabled>
<hashAlgorithm>SHA-256</hashAlgorithm>
<validateXml>true</validateXml>
<remote enabled="false">
<url>http://host:port</url>
</remote>
<attachedOutputs>
<dirNames>
<dirName>../dist</dirName>
<dirName>quarkus-app</dirName>
<dirName>helm</dirName>
<dirName>docker</dirName>
<dirName>dockerbuild</dirName>
<dirName>krausening</dirName>
<!-- Reports needed on CI to ensure consistent reporting of QA metrics: -->
<dirName>../target/cucumber-reports</dirName>
<dirName>../target/surefire-reports</dirName>
<dirName>../target/failsafe-reports</dirName>
</dirNames>
</attachedOutputs>
<local>
<maxBuildsCached>5</maxBuildsCached>
</local>
<projectVersioning adjustMetaInf="true"/>
</configuration>

<input>
<global>
<glob>
{*.java,*.json,*.groovy,*.yaml,*.svcd,*.proto,*.xml,*.vm,*.ini,*.jks,*.properties,*.sh,*.bat,*.py,Dockerfile,*.feature}
</glob>
<includes>
<include>src/</include>
<include>tests/</include> <!-- Helm and Python modules -->
<include>templates/</include> <!-- Helm modules -->
<include>pom.xml</include>
<include>pyproject.toml</include>
</includes>
<excludes>
<exclude>poetry.lock</exclude>
<exclude>Chart.lock</exclude>
</excludes>
</global>
</input>
<executionControl>
<runAlways>
<goalsLists>
<goalsList artifactId="maven-install-plugin">
<goals>
<goal>install</goal>
</goals>
</goalsList>
<goalsList artifactId="maven-deploy-plugin">
<goals>
<goal>deploy</goal>
</goals>
</goalsList>
</goalsLists>
</runAlways>
<reconcile logAllProperties="true">
<plugins>
<plugin artifactId="maven-compiler-plugin" goal="compile">
<reconciles>
<reconcile propertyName="source"/>
<reconcile propertyName="target"/>
<reconcile propertyName="debug"/>
<reconcile propertyName="debuglevel"/>
</reconciles>
<!-- whitelist of logged properties-->
<logs>
<log propertyName="includes"/>
<log propertyName="excludes"/>
<log propertyName="argLine"/>
</logs>
</plugin>
<plugin artifactId="maven-enforcer-plugin" goal="enforce">
<reconciles>
<reconcile propertyName="skip" skipValue="true"/>
</reconciles>
<nologs>
<nolog propertyName="commandLineRules"/>
</nologs>
</plugin>
</plugins>
</reconcile>
</executionControl>
</cache>
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
2 changes: 2 additions & 0 deletions .tiltignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/charts
**/tmpcharts
6 changes: 6 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copyright (C) 2021 Booz Allen Hamilton Inc.

All Rights Reserved. You may not copy, reproduce, distribute, publish, display,
execute, modify, create derivative works of, transmit, sell or offer for resale,
or in any way exploit any part of this solution without Booz Allen Hamilton’s
express written permission.
88 changes: 88 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
allow_k8s_contexts('local')
docker_prune_settings(num_builds=1, keep_recent=1)

aissemble_version = '1.10.0-SNAPSHOT'

build_args = { 'DOCKER_BASELINE_REPO_ID': 'ghcr.io/',
'VERSION_AISSEMBLE': aissemble_version}

# Kafka
yaml = helm(
'test-argo-deploy/src/main/resources/apps/kafka-cluster',
values=['test-argo-deploy/src/main/resources/apps/kafka-cluster/values.yaml',
'test-argo-deploy/src/main/resources/apps/kafka-cluster/values-dev.yaml']
)
k8s_yaml(yaml)

# Add deployment resources here

k8s_kind('SparkApplication', image_json_path='{.spec.image}')


yaml = local('helm template oci://ghcr.io/boozallen/aissemble-spark-application-chart --version %s --values test-argo-pipelines/spark-pipeline/src/main/resources/apps/spark-pipeline-base-values.yaml,test-argo-pipelines/spark-pipeline/src/main/resources/apps/spark-pipeline-dev-values.yaml' % aissemble_version)
k8s_yaml(yaml)
k8s_resource('spark-pipeline', port_forwards=[port_forward(4747, 4747, 'debug')], auto_init=False, trigger_mode=TRIGGER_MODE_MANUAL)
# spark-worker-image
docker_build(
ref='test-argo-spark-worker-docker',
context='test-argo-docker/test-argo-spark-worker-docker',
build_args=build_args,
extra_tag='test-argo-spark-worker-docker:latest',
dockerfile='test-argo-docker/test-argo-spark-worker-docker/src/main/resources/docker/Dockerfile'
)


# policy-decision-point
docker_build(
ref='test-argo-policy-decision-point-docker',
context='test-argo-docker/test-argo-policy-decision-point-docker',
build_args=build_args,
dockerfile='test-argo-docker/test-argo-policy-decision-point-docker/src/main/resources/docker/Dockerfile'
)

yaml = helm(
'test-argo-deploy/src/main/resources/apps/metadata',
name='metadata',
values=['test-argo-deploy/src/main/resources/apps/metadata/values.yaml',
'test-argo-deploy/src/main/resources/apps/metadata/values-dev.yaml']
)
k8s_yaml(yaml)
yaml = helm(
'test-argo-deploy/src/main/resources/apps/spark-infrastructure',
name='spark-infrastructure',
values=['test-argo-deploy/src/main/resources/apps/spark-infrastructure/values.yaml',
'test-argo-deploy/src/main/resources/apps/spark-infrastructure/values-dev.yaml']
)
k8s_yaml(yaml)
yaml = helm(
'test-argo-deploy/src/main/resources/apps/spark-operator',
name='spark-operator',
values=['test-argo-deploy/src/main/resources/apps/spark-operator/values.yaml',
'test-argo-deploy/src/main/resources/apps/spark-operator/values-dev.yaml']
)
k8s_yaml(yaml)
k8s_yaml('test-argo-deploy/src/main/resources/apps/spark-worker-image/spark-worker-image.yaml')


yaml = helm(
'test-argo-deploy/src/main/resources/apps/policy-decision-point',
name='policy-decision-point',
values=['test-argo-deploy/src/main/resources/apps/policy-decision-point/values.yaml',
'test-argo-deploy/src/main/resources/apps/policy-decision-point/values-dev.yaml']
)
k8s_yaml(yaml)

yaml = helm(
'test-argo-deploy/src/main/resources/apps/s3-local',
name='s3-local',
values=['test-argo-deploy/src/main/resources/apps/s3-local/values.yaml',
'test-argo-deploy/src/main/resources/apps/s3-local/values-dev.yaml']
)
k8s_yaml(yaml)
yaml = helm(
'test-argo-deploy/src/main/resources/apps/pipeline-invocation-service',
name='pipeline-invocation-service',
values=['test-argo-deploy/src/main/resources/apps/pipeline-invocation-service/values.yaml',
'test-argo-deploy/src/main/resources/apps/pipeline-invocation-service/values-dev.yaml']
)
k8s_yaml(yaml)
27 changes: 27 additions & 0 deletions devops/JenkinsfileBuild.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* NOTE: This file is intended for use with the SDP Jenkins Templating Engine v2.0+
* which supports fetching the job template and configuration from an SCM location.
*
* Originally generated from: templates/devops/jte.JenkinsfileBuild.groovy.vm
*/

def gitId = 'github'
def gitRepo = 'test.url'
def gitBranch = params.get("branch")
gitBranch = gitBranch ? gitBranch : "dev"

withGit url: gitRepo, cred: gitId, branch: gitBranch, {
try {
/* The config block uses the default maven-global-settings settings.xml configuration in the aiops-jenkins docker container */
configFileProvider(
[configFile(fileId: 'maven-global-settings', variable: 'MAVEN_GLOBAL_SETTINGS')]) {
maven.run([profiles: ['ci']], ["clean", "deploy", "-U", "-Dhabushu.force.clean", "-s $MAVEN_GLOBAL_SETTINGS"])
}
slackSend color: "good",
message: "test-argo built successfully"
} catch (err) {
slackSend color: "danger",
message: "test-argo failed to build successfully"
throw err
}
}
84 changes: 84 additions & 0 deletions devops/JenkinsfileDeploy.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
def gitId = 'github'
def gitRepo = 'test.url'
// Set branch in the Jenkins Job or set here if not variable
def gitBranch = 'refs/heads/${branch}'
def projectDirectory = 'test-argo'
def jenkinsSteps
// Set URL of ArgoCD server
def argocdUrl = ''
def argocdAppName = 'test-argo'
def argocdNamespace = 'argocd'
def argocdDestinationServer = 'https://kubernetes.default.svc'
def argocdBranch = '${branch}'
def argocdSyncLabel = 'argocd.argoproj.io/instance=test-argo'

node('master') {
dir(projectDirectory) {
checkout([$class: 'GitSCM', branches: [[name: gitBranch]], userRemoteConfigs: [[credentialsId: gitId, url: gitRepo]]])
jenkinsSteps = load 'devops/jenkinsPipelineSteps.groovy'
}
}

stage("Authenticate") {
node('master') {
withCredentials([string(credentialsId: 'argocdPassword', variable: 'argocdPassword')]) {
try {
dir(projectDirectory) {
slackSend color: "warning",
message: "test-argo authenticating"
jenkinsSteps.argocdAuthenticate(argocdUrl, '${argocdPassword}')
}
} catch (err) {
slackSend color: "danger",
message: "test-argo failed to authenticate properly"
throw err
}
}
}
}

stage("Deploy") {
node('master') {
try {
dir(projectDirectory) {
slackSend color: "warning",
message: "test-argo deploying"
jenkinsSteps.argocdDeploy(argocdAppName, argocdUrl, argocdDestinationServer, gitRepo, argocdBranch,
argocdNamespace, ['values.yaml'])
slackSend color: "good",
message: "test-argo deployed successfully"
}
} catch (err) {
slackSend color: "danger",
message: "test-argo failed to deploy properly"
throw err
}
}
}

stage("Running") {
node('master') {
try {
timeout(environmentUptime) {
input message: 'Ready to kill the environment?', ok: 'Kill Test Server'
}
} catch (err) {}
}
}

stage("Teardown") {
node('master') {
try {
dir(projectDirectory) {
slackSend color: "warning",
message: "test-argo shutting down"
jenkinsSteps.argocdTerminate(argocdAppName)
}
} catch (err) {
slackSend color: "danger",
message: "test-argo failed to shut down properly"
throw err
}
}
}

Loading

0 comments on commit f8e03c3

Please sign in to comment.