-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #872 from aionnetwork/0.3.4-final
0.3.4 final
- Loading branch information
Showing
602 changed files
with
13,081 additions
and
13,910 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
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,18 @@ | ||
# dist stage: image for end-user distribution | ||
FROM ubuntu:18.04 AS dist | ||
WORKDIR / | ||
RUN apt-get update && apt-get --no-install-recommends --yes install \ | ||
wget \ | ||
unzip \ | ||
lsb-release \ | ||
locales | ||
ADD aion.tar.bz2 / | ||
WORKDIR /aion | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
CMD ["/aion/aion.sh"] | ||
|
||
# k8s stage: produce image for Kubernetes CI test cluster | ||
FROM dist AS k8s | ||
COPY k8s/custom custom | ||
CMD ["/aion/aion.sh", "-n", "custom"] |
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,65 @@ | ||
properties([[$class: 'jenkins.model.BuildDiscarderProperty', strategy: | ||
[$class: 'LogRotator', numToKeepStr: '10', artifactNumToKeepStr: '10'] | ||
]]) | ||
|
||
node { | ||
def appName = 'aion' | ||
def deployName | ||
def endPoint | ||
|
||
// docker tags | ||
def k8sTag = "k8s-${env.BUILD_NUMBER}" | ||
def k8sImageName = "aionkuberacr.azurecr.io/aion:${k8sTag}" | ||
def k8sImageNameLatest = "aionkuberacr.azurecr.io/aion:latest" | ||
def distImageName = "aionnetwork/aion-staging:ci-${env.BUILD_NUMBER}" | ||
|
||
stage('Clone repository') { | ||
checkout scm | ||
sh "git submodule update --init --recursive" | ||
} | ||
|
||
stage('Create dist and k8s Docker images from source') { | ||
sh "./gradlew packDocker packK8sDocker " + | ||
"-Pdist_image_tag=${distImageName} " + | ||
"-Pk8s_image_tag=${k8sImageName} " | ||
} | ||
|
||
stage('Push k8s image to Azure private registry') { | ||
docker.withRegistry('https://aionkuberacr.azurecr.io', 'acr') { | ||
sh("docker push ${k8sImageName}") | ||
sh("docker push ${k8sImageNameLatest}") | ||
} | ||
} | ||
|
||
stage("Deploy Image to Kubernetes") { | ||
// Refresh kubectl (Python can have some issues refreshing) | ||
sh('kubectl get nodes') | ||
|
||
withPythonEnv('python3') { | ||
sh 'pip install -r DockerAutomation/k8s/requirements.txt' | ||
deployName = sh(script: "python DockerAutomation/k8s/deploy.py ${k8sTag}", | ||
returnStdout: true) | ||
} | ||
} | ||
|
||
stage("Fetch Deployment Endpoint") { | ||
withPythonEnv('python3') { | ||
endPoint = sh(script: "python DockerAutomation/k8s/find_endpoint.py ${deployName}", | ||
returnStdout: true) | ||
} | ||
} | ||
|
||
stage("Run 'Test'") { | ||
// TODO perform actual verification | ||
sh("echo " + endPoint) | ||
} | ||
|
||
// The rest of this pipeline should only execute when the tests in CI pass | ||
// However, we don't have testing against it right now, so it always "passes" | ||
|
||
stage("Push dist image to DockerHub aion-staging") { | ||
docker.withRegistry('', 'DockerHub') { | ||
sh("docker push ${distImageName}") | ||
} | ||
} | ||
} |
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,74 @@ | ||
import os | ||
import xml.etree.ElementTree | ||
import subprocess | ||
from xml.dom import minidom | ||
import sys | ||
|
||
indentation = '\t' | ||
|
||
# borrowed from https://stackoverflow.com/questions/33573807/faithfully-preserve-comments-in-parsed-xml-python-2-7 | ||
class CommentedTreeBuilder ( xml.etree.ElementTree.XMLTreeBuilder ): | ||
def __init__ ( self, html = 0, target = None ): | ||
xml.etree.ElementTree.XMLTreeBuilder.__init__( self, html, target ) | ||
self._parser.CommentHandler = self.handle_comment | ||
|
||
def handle_comment ( self, data ): | ||
self._target.start( xml.etree.ElementTree.Comment, {} ) | ||
self._target.data( data ) | ||
self._target.end( xml.etree.ElementTree.Comment ) | ||
|
||
|
||
def override_attrib(element, attrib, name, value): | ||
if name != None and value != None: | ||
print('Overriding kernel property ' + element.tag + '/' + attrib + ' from ' + name + ' to ' + value) | ||
element.attrib[attrib] = value | ||
|
||
# pretty printing does not work with ElementTree | ||
# use this function after inserting new elements in the xml file | ||
def indent(elem, level=0): | ||
i = "\n" + level*indentation | ||
if len(elem): | ||
if not elem.text or not elem.text.strip(): | ||
elem.text = i + indentation | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = i | ||
for elem in elem: | ||
indent(elem, level+1) | ||
if not elem.tail or not elem.tail.strip(): | ||
elem.tail = i | ||
else: | ||
if level and (not elem.tail or not elem.tail.strip()): | ||
elem.tail = i | ||
|
||
|
||
def go(config_file): | ||
parser = xml.etree.ElementTree.XMLParser(target=CommentedTreeBuilder()) | ||
et = xml.etree.ElementTree.parse(config_file, CommentedTreeBuilder()) | ||
root = et.getroot() | ||
|
||
print(config_file + ':') | ||
|
||
api = root.find('api') | ||
new_rpc = api.find('rpc') | ||
override_attrib(new_rpc, 'active', 'false', 'true') | ||
override_attrib(new_rpc, 'ip', '127.0.0.1', '0.0.0.0') | ||
|
||
new_java = api.find('java') | ||
override_attrib(new_java, 'active', 'false', 'true') | ||
override_attrib(new_java, 'ip', '127.0.0.1', '0.0.0.0') | ||
|
||
indent(root) | ||
et.write(config_file, encoding='utf-8', xml_declaration=True) | ||
|
||
|
||
if len(sys.argv) != 2: | ||
print "usage: enable-api-servers.py AION-CONFIG-ROOT" | ||
exit(1) | ||
else: | ||
root = sys.argv[1] | ||
|
||
go(root + '/mainnet/config.xml') | ||
go(root + '/mastery/config.xml') | ||
go(root + '/custom/config.xml') | ||
go(root + '/conquest/config.xml') | ||
go(root + '/avmtestnet/config.xml') |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.