Skip to content
Open
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
22 changes: 11 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pipeline {
}
stage('publish images') {
when {
branch "develop"
branch "develop"
}
steps {
script {
Expand All @@ -104,25 +104,25 @@ pipeline {
}
stage('upgrade helm') {
when {
branch "develop"
branch "develop"
}
steps {
steps {
dir('charts/specular') {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "builder",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "builder",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
script {
sh '''
sh '''
aws eks update-kubeconfig --region us-east-2 --name specular-staging-eks
kubectl config use-context arn:aws:eks:us-east-2:792926601177:cluster/specular-staging-eks
helm upgrade specular . -n specular --set image.tag=$GIT_COMMIT'''
}
discordSend description: "Jenkins Pipeline Build", footer: "Current release is $GIT_COMMIT", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: "https://discord.com/api/webhooks/1219404082184196147/C70F8jtuyODjExk-Xk7hWOaxY-IBQefDumqbTJYlKdOMt2uzmA4ehS3uaO28SwuGgzwi"

}
}
}
}
}
Expand Down
130 changes: 130 additions & 0 deletions Jenkinsfile-build-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
pipeline {
agent any
environment{
registry = "792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform"
}

stages {
stage('prepare workspace') {
steps {
// checkout git
checkout scmGit(
userRemoteConfigs: [
[ credentialsId: 'jenkins-specular', url: 'github.com:SpecularL2/specular-build-test.git']
],
branches: [[name: '*/PR-*'], [name: '*/develop']],
)
// submodules
sh "git submodule update --init --recursive"
// make our workspace dir
sh "rm -rf workspace && mkdir workspace"
// env files
sh 'cp -a config/local_docker/. workspace/'
sh 'chmod -R 777 workspace'
}
}
stage('create build image for pr') {
when {
not {
branch 'develop'
}
}
steps{
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
docker.build(
registry + ":e2e-pr-$GIT_COMMIT",
"-f docker/e2e.Dockerfile ."
)
}

}
}
}
stage('create build image for devnet') {
when {
branch 'develop'
}
steps{
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
def e2eContainer = docker.build(
registry + ":e2e-$GIT_COMMIT",
"-f docker/e2e.Dockerfile ."
)
e2eContainer.push()
e2eContainer.push("e2e-latest")
}

}
}
}
stage('e2e-test') {
when {
not {
branch 'develop'
}
}
parallel {
stage('transactions') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh transactions"
}
}
stage('deposit') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh deposit"
}
}
stage('erc20') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh erc20"
}
}
stage('withdraw') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh withdraw"
}
}
}
}
stage('publish images') {
when {
branch "develop"
}
steps {
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
def spcContainer = docker.build(registry + ":$GIT_COMMIT", "-f docker/specular.Dockerfile .")
spcContainer.push()
spcContainer.push("specular-latest")
}
}
}
}
stage('upgrade helm') {
when {
branch "develop"
}
steps {
dir('charts/specular') {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "builder",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
script {
sh '''
aws eks update-kubeconfig --region us-east-2 --name specular-staging-eks
kubectl config use-context arn:aws:eks:us-east-2:792926601177:cluster/specular-staging-eks
helm upgrade specular . -n specular --set image.tag=$GIT_COMMIT'''
}
discordSend description: "Jenkins Pipeline Build *IGNORE*", footer: "Current release is $GIT_COMMIT", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: "https://discord.com/api/webhooks/1219404082184196147/C70F8jtuyODjExk-Xk7hWOaxY-IBQefDumqbTJYlKdOMt2uzmA4ehS3uaO28SwuGgzwi"

}
}
}
}
}
}
4 changes: 0 additions & 4 deletions charts/specular/templates/debug-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ spec:
mountPath: /tmp/workspace/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: /tmp/workspace/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
workingDir: /tmp/workspace
restartPolicy: OnFailure
volumes:
Expand All @@ -40,10 +38,8 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
{{- if not .Values.generator.deploy }}
- name: secret-volume
secret:
secretName: l2-secrets
{{- end }}
status: {}
{{- end -}}
8 changes: 4 additions & 4 deletions charts/specular/templates/generator-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ spec:
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
lifecycle:
preStop:
exec:
command: ["sh", "-c", "rm -f /specular/workspace/.*.lock"]
restartPolicy: Never
volumes:
- name: {{ .Values.volume.efs.name }}
Expand All @@ -37,9 +39,7 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
{{- if not .Values.generator.deploy }}
- name: secret-volume
secret:
secretName: l2-secrets
{{- end }}
status: {}
5 changes: 3 additions & 2 deletions charts/specular/templates/l1-geth-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ spec:
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
workingDir: {{ .Values.volume.efs.mountPath }}
restartPolicy: Always
volumes:
Expand All @@ -61,5 +59,8 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
- name: secret-volume
secret:
secretName: l2-secrets
status: {}
{{- end -}}
4 changes: 0 additions & 4 deletions charts/specular/templates/sidecar-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ spec:
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
workingDir: {{ .Values.volume.efs.mountPath }}
terminationGracePeriodSeconds: 60
restartPolicy: OnFailure
Expand All @@ -46,9 +44,7 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
{{- if not .Values.generator.deploy }}
- name: secret-volume
secret:
secretName: l2-secrets
{{- end }}
status: {}
4 changes: 0 additions & 4 deletions charts/specular/templates/sp-geth-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ spec:
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
workingDir: {{ .Values.volume.efs.mountPath }}
terminationGracePeriodSeconds: 15
restartPolicy: OnFailure
Expand All @@ -74,9 +72,7 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
{{- if not .Values.generator.deploy }}
- name: secret-volume
secret:
secretName: l2-secrets
{{- end }}
status: {}
4 changes: 0 additions & 4 deletions charts/specular/templates/sp-magi-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ spec:
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value }}
subPath: {{ $value }}
{{- end }}
{{- if not .Values.generator.deploy }}
{{- range $i, $value := .Values.volume.secrets }}
- name: secret-volume
mountPath: {{ $.Values.volume.efs.mountPath }}/{{ $value.file }}
subPath: {{ $value.file }}
readOnly: true
{{- end }}
{{- end }}
workingDir: {{ .Values.volume.efs.mountPath }}
terminationGracePeriodSeconds: 60
restartPolicy: OnFailure
Expand All @@ -56,9 +54,7 @@ spec:
- name: {{ .Values.volume.configVolumeMounts.name }}
configMap:
name: {{ .Values.volume.configVolumeMounts.name }}
{{- if not .Values.generator.deploy }}
- name: secret-volume
secret:
secretName: l2-secrets
{{- end }}
status: {}
10 changes: 6 additions & 4 deletions charts/specular/values-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ enabled:
infura: true
debug: true

generator:
command: "../sbin/entrypoint.sh deploy"
deploy: false

volume:
efs:
mountPath: /specular/workspace
Expand Down Expand Up @@ -40,6 +36,10 @@ volume:
- name: VALIDATOR_PRIV_KEY
file: validator_pk.txt

generator:
command: "../sbin/entrypoint.sh deploy"
deploy: false

configMaps:
.sp_geth.env:
- name: NETWORK_ID
Expand Down Expand Up @@ -116,6 +116,8 @@ configMaps:
value: "ws://l1.sepolia.specular.network:8546"
- name: L1_PERIOD
value: "12"
- name: REDEPLOY
value: "true"

.paths.env:
- name: BIN_DIR
Expand Down
2 changes: 2 additions & 0 deletions charts/specular/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ configMaps:
value: "ws://$L1_GETH_SERVICE_HOST:$L1_GETH_SERVICE_PORT_8546"
- name: L1_PERIOD
value: "12"
- name: REDEPLOY
value: "true"

.paths.env:
- name: BIN_DIR
Expand Down
13 changes: 11 additions & 2 deletions sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ case "$1" in
deploy)
# Run the main container command.
echo "Running deploy for genesis and JWT"
/specular/sbin/generate_jwt_secret.sh
/specular/sbin/deploy_l1_contracts.sh -y


if [[ "$REDEPLOY" = true ]]; then
rm -f .deployed
/specular/sbin/clean.sh
/specular/sbin/generate_jwt_secret.sh
/specular/sbin/deploy_l1_contracts.sh -y

fi

touch .generate_secrets.sh.lock
;;
start)
shift
Expand Down