-
Notifications
You must be signed in to change notification settings - Fork 24
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 #170 from Mbed-TLS/dev/bensze01/framework
Adapt PR and release jobs to enable testing of the Framework repo
- Loading branch information
Showing
10 changed files
with
218 additions
and
156 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,33 +1,46 @@ | ||
package org.mbed.tls.jenkins | ||
|
||
class BranchInfo { | ||
/* Map from component name to chosen platform to run it, or to null | ||
* if no platform has been chosen yet. */ | ||
/** The name of the branch */ | ||
public String branch | ||
|
||
/** Map from component name to chosen platform to run it, or to null | ||
* if no platform has been chosen yet. */ | ||
public Map<String, String> all_all_sh_components | ||
|
||
/* Whether scripts/min_requirements.py is available. Older branches don't | ||
* have it, so they only get what's hard-coded in the docker files on Linux, | ||
* and bare python on other platforms. */ | ||
/** Whether scripts/min_requirements.py is available. Older branches don't | ||
* have it, so they only get what's hard-coded in the docker files on Linux, | ||
* and bare python on other platforms. */ | ||
public boolean has_min_requirements | ||
|
||
/* Ad hoc overrides for scripts/ci.requirements.txt, used to adjust | ||
* requirements on older branches that broke due to updates of the | ||
* required packages. | ||
* Only used if has_min_requirements is true. */ | ||
/** Ad hoc overrides for scripts/ci.requirements.txt, used to adjust | ||
* requirements on older branches that broke due to updates of the | ||
* required packages. | ||
* Only used if {@link #has_min_requirements} is {@code true}. */ | ||
public String python_requirements_override_content | ||
|
||
/* Name of the file containing python_requirements_override_content. | ||
* The string is injected into Unix sh and Windows cmd command lines, | ||
* so it must not contain any shell escapes or directory separators. | ||
* Only used if has_min_requirements is true. | ||
* Set to an empty string for convenience if no override is to be | ||
* done. */ | ||
/** Name of the file containing python_requirements_override_content. | ||
* The string is injected into Unix sh and Windows cmd command lines, | ||
* so it must not contain any shell escapes or directory separators. | ||
* Only used if {@link #has_min_requirements} is {@code true}. | ||
* Set to an empty string for convenience if no override is to be | ||
* done. */ | ||
public String python_requirements_override_file | ||
|
||
/** Keep track of builds that fail */ | ||
final Set<String> failed_builds | ||
final Set<String> outcome_stashes | ||
|
||
/** Record coverage details for reporting */ | ||
String coverage_details | ||
|
||
BranchInfo() { | ||
this.all_all_sh_components = [:] | ||
this.has_min_requirements = false | ||
this.python_requirements_override_content = '' | ||
this.python_requirements_override_file = '' | ||
this.failed_builds = [] | ||
this.outcome_stashes = [] | ||
this.coverage_details = 'Code coverage job did not run' | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -59,12 +59,12 @@ Map<String, String> checkout_report_errors(scm_config) { | |
} | ||
} | ||
|
||
Map<String, String> checkout_repo() { | ||
Map<String, String> checkout_tls_repo(String branch) { | ||
def scm_config | ||
if (env.TARGET_REPO == 'tls' && env.CHECKOUT_METHOD == 'scm') { | ||
scm_config = scm | ||
} else { | ||
scm_config = parametrized_repo(env.MBED_TLS_REPO, env.MBED_TLS_BRANCH) | ||
scm_config = parametrized_repo(env.MBED_TLS_REPO, branch) | ||
} | ||
|
||
// Use bilingual scripts when manipulating the git config | ||
|
@@ -73,6 +73,17 @@ Map<String, String> checkout_repo() { | |
sh_or_bat 'git config --global [email protected]:.insteadOf https://github.com/' | ||
try { | ||
def result = checkout_report_errors(scm_config) | ||
|
||
dir('framework') { | ||
if (env.TARGET_REPO == 'framework' && env.CHECKOUT_METHOD == 'scm') { | ||
checkout_report_errors(scm) | ||
} else if (env.FRAMEWORK_REPO && env.FRAMEWORK_BRANCH) { | ||
checkout_report_errors(parametrized_repo(env.FRAMEWORK_REPO, env.FRAMEWORK_BRANCH)) | ||
} else { | ||
echo 'Using default framework version' | ||
} | ||
} | ||
|
||
// After the clone, replicate it in the local config, so it is effective when running inside docker | ||
sh_or_bat ''' | ||
git config [email protected]:.insteadOf https://github.com/ && \ | ||
|
@@ -85,8 +96,8 @@ git submodule foreach --recursive git config [email protected]:.insteadOf https | |
} | ||
} | ||
|
||
Map<String, String> checkout_repo(BranchInfo info) { | ||
Map<String, String> m = checkout_repo() | ||
Map<String, String> checkout_tls_repo(BranchInfo info) { | ||
Map<String, String> m = checkout_tls_repo(info.branch) | ||
write_overrides(info) | ||
return m | ||
} | ||
|
@@ -117,7 +128,7 @@ Map<String, Object> parametrized_repo(String repo, String branch) { | |
] | ||
} | ||
|
||
def checkout_mbed_os() { | ||
def checkout_mbed_os(BranchInfo info) { | ||
checkout_report_errors([ | ||
scm: [ | ||
$class: 'GitSCM', | ||
|
@@ -130,12 +141,12 @@ def checkout_mbed_os() { | |
], | ||
] | ||
]) | ||
if (env.MBED_TLS_BRANCH) { | ||
if (info != null) { | ||
dir('features/mbedtls/importer') { | ||
dir('TARGET_IGNORE/mbedtls') | ||
{ | ||
deleteDir() | ||
checkout_repo() | ||
checkout_tls_repo(info) | ||
} | ||
sh """\ | ||
ulimit -f 20971520 | ||
|
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 |
---|---|---|
|
@@ -29,21 +29,26 @@ def set_common_environment() { | |
env.VERBOSE_LOGS=1 | ||
} | ||
|
||
def set_tls_pr_environment(is_production) { | ||
void set_pr_environment(String target_repo, boolean is_production) { | ||
set_common_environment() | ||
env.JOB_TYPE = 'PR' | ||
env.TARGET_REPO = 'tls' | ||
env.REPO_TO_CHECKOUT = 'tls' | ||
env.TARGET_REPO = target_repo | ||
if (is_production) { | ||
if (target_repo == 'framework') { | ||
env.MBED_TLS_REPO = '[email protected]:Mbed-TLS/mbedtls.git' | ||
} | ||
set_common_pr_production_environment() | ||
set_tls_pr_production_environment() | ||
} else { | ||
env.CHECKOUT_METHOD = 'parametrized' | ||
} | ||
} | ||
|
||
def set_common_pr_production_environment() { | ||
env.CHECKOUT_METHOD = 'scm' | ||
/* The credentials here are the SSH credentials for accessing the repositories. | ||
They are defined at {JENKINS_URL}/credentials | ||
This is a temporary workaround, this should really be set in the Jenkins job configs */ | ||
env.GIT_CREDENTIALS_ID = common.is_open_ci_env ? "mbedtls-github-ssh" : "742b7080-e1cc-41c6-bf55-efb72013bc28" | ||
if (env.BRANCH_NAME ==~ /PR-\d+-merge/) { | ||
env.RUN_ABI_CHECK = 'true' | ||
} else { | ||
|
@@ -62,15 +67,10 @@ def set_common_pr_production_environment() { | |
} | ||
} | ||
|
||
def set_tls_pr_production_environment() { | ||
env.MBED_TLS_BRANCH = env.CHANGE_BRANCH | ||
} | ||
|
||
def set_tls_release_environment() { | ||
set_common_environment() | ||
env.JOB_TYPE = 'release' | ||
env.TARGET_REPO = 'tls' | ||
env.REPO_TO_CHECKOUT = 'tls' | ||
env.CHECKOUT_METHOD = 'parametrized' | ||
} | ||
|
||
|
Oops, something went wrong.