Skip to content

Commit

Permalink
ci: simplify jenkins scripts
Browse files Browse the repository at this point in the history
~ move most of the code logic to the backend

Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
  • Loading branch information
Vitor Bandeira committed Jul 3, 2024
1 parent 06469a8 commit 77e8501
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 118 deletions.
61 changes: 11 additions & 50 deletions jenkins/public_tests_all.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,68 +1,29 @@
@Library('utils@main') _
@Library('utils@orfs-v2.0.1') _

node {
node('ubuntu22') {

properties([
copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME),
]);
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]);

stage('Checkout') {
checkout scm;
}

def commitHash = "none";
def DOCKER_IMAGE_TAG = "latest";
def DOCKER_IMAGE;
stage('Build and Push Docker Image') {
if (isDependencyInstallerChanged(env.BRANCH_NAME)) {
commitHash = sh(script: 'git rev-parse HEAD', returnStdout: true);
commitHash = commitHash.replaceAll(/[^a-zA-Z0-9-]/, '');
DOCKER_IMAGE_TAG = pushCIImage(env.BRANCH_NAME, commitHash);
}
DOCKER_IMAGE = dockerPush('ubuntu22.04', 'orfs');
echo "Docker image is $DOCKER_IMAGE";
}
def DOCKER_IMAGE = "openroad/flow-ubuntu22.04-dev:${DOCKER_IMAGE_TAG}";

docker.image("${DOCKER_IMAGE}").inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Build ORFS and Stash bins') {
sh "git config --system --add safe.directory '*'";
localBuild();
}
stage('Build ORFS and Stash bins') {
buildBins(DOCKER_IMAGE);
}

stage('Run Tests') {
Map tasks = [failFast: false];
def test_slugs = getTestSlugs("all");
for (test in test_slugs) {
def currentSlug = test; // copy needed to correctly pass args to runTests
tasks["${test}"] = {
node {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
docker.image("${DOCKER_IMAGE}").inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
sh "git config --system --add safe.directory '*'";
checkout scm;
runTests(currentSlug);
}
}
}
}
}
parallel(tasks);
runTests(DOCKER_IMAGE, 'pr');
}

docker.image("${DOCKER_IMAGE}").inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
sh "git config --system --add safe.directory '*'";
stage('Report Summary') {
generateReportShortSummary();
}
stage("Report HTML Table") {
generateReportHtmlTable();
}
stage('Upload Metadata') {
uploadMetadata(env.BRANCH_NAME, commitHash);
}
stage('Send Report') {
def COMMIT_AUTHOR_EMAIL = sh(script: "git --no-pager show -s --format='%ae'", returnStdout: true).trim();
sendEmail(env.BRANCH_NAME, COMMIT_AUTHOR_EMAIL);
}
stage ('Cleanup and Reporting') {
finalReport(DOCKER_IMAGE);
}

}
68 changes: 0 additions & 68 deletions jenkins/public_tests_small.Jenkinsfile

This file was deleted.

0 comments on commit 77e8501

Please sign in to comment.