Skip to content

Commit 84b1dfa

Browse files
cheng-kevinchengke
andauthored
Kevin/remove package var (#34)
* remove package var * commit index.js Co-authored-by: chengke <[email protected]>
1 parent 4d6a047 commit 84b1dfa

File tree

2 files changed

+14
-43
lines changed

2 files changed

+14
-43
lines changed

robomaker-sample-app-ci/dist/index.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ const ROS_DISTRO = core.getInput('ros-distro', { required: true });
730730
let SAMPLE_APP_VERSION = '';
731731
const WORKSPACE_DIRECTORY = core.getInput('workspace-dir');
732732
const GENERATE_SOURCES = core.getInput('generate-sources');
733-
let PACKAGES = "none";
734733
const ROS_ENV_VARIABLES = {};
735734
const COLCON_BUNDLE_RETRIES = Number.parseInt(core.getInput('colcon-bundle-retries'), 10);
736735
const MINIMUM_BACKOFF_TIME_SECONDS = 32; // delay for the first retry in seconds
@@ -797,11 +796,9 @@ function getSampleAppVersion() {
797796
return Promise.resolve(version);
798797
});
799798
}
800-
// If .rosinstall exists, run 'vcs import' and return a list of names of the packages that were added in both workspaces.
799+
// If .rosinstall exists, run 'vcs import'
801800
function fetchRosinstallDependencies() {
802801
return __awaiter(this, void 0, void 0, function* () {
803-
let colconListAfter = { stdout: '', stderr: '' };
804-
let packages = [];
805802
// Download dependencies not in apt if .rosinstall exists
806803
try {
807804
// When generate-sources: true, the expected behavior is to include sources from both workspaces including their dependencies.
@@ -811,40 +808,29 @@ function fetchRosinstallDependencies() {
811808
yield exec.exec("vcs", ["import", "--input", ".rosinstall"], { cwd: workspace });
812809
}
813810
}
814-
// this is outside the loop as we don't want to build both the dependency packages
815-
if (fs.existsSync(path.join(WORKSPACE_DIRECTORY, '.rosinstall'))) {
816-
yield exec.exec("colcon", ["list", "--names-only"], getWorkingDirExecOptions(colconListAfter));
817-
const packagesAfter = colconListAfter.stdout.split("\n");
818-
packagesAfter.forEach(packageName => {
819-
packages.push(packageName.trim());
820-
});
821-
}
822811
}
823812
catch (error) {
824813
core.setFailed(error.message);
825814
}
826-
return Promise.resolve(packages);
827815
});
828816
}
829817
function setup() {
830818
return __awaiter(this, void 0, void 0, function* () {
831819
try {
832-
//this function relies on the fact that there is only 1 package.xml in ./robot_ws
833-
SAMPLE_APP_VERSION = yield getSampleAppVersion();
834-
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
835820
if (!fs.existsSync("/etc/timezone")) {
836821
//default to US Pacific if timezone is not set.
837822
const timezone = "US/Pacific";
838823
yield exec.exec("bash", ["-c", `ln -snf /usr/share/zoneinfo/${timezone} /etc/localtime`]);
839824
yield exec.exec("bash", ["-c", `echo ${timezone} > /etc/timezone`]);
840825
}
841826
yield exec.exec("bash", ["-c", `scripts/setup.sh --install-ros ${ROS_DISTRO}`]);
842-
loadROSEnvVariables();
827+
yield loadROSEnvVariables();
843828
yield exec.exec("apt-get", ["update"]);
844829
//zip required for prepare_sources step.
845830
yield exec.exec("apt-get", ["install", "-y", "zip"]);
846-
let packages = yield fetchRosinstallDependencies();
847-
PACKAGES = packages.join(" ");
831+
SAMPLE_APP_VERSION = yield getSampleAppVersion();
832+
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
833+
yield fetchRosinstallDependencies();
848834
}
849835
catch (error) {
850836
core.setFailed(error.message);

robomaker-sample-app-ci/src/aws-robomaker-sample-application-ci.ts

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const ROS_DISTRO = core.getInput('ros-distro', {required: true});
99
let SAMPLE_APP_VERSION = '';
1010
const WORKSPACE_DIRECTORY = core.getInput('workspace-dir');
1111
const GENERATE_SOURCES = core.getInput('generate-sources');
12-
let PACKAGES = "none"
1312
const ROS_ENV_VARIABLES: any = {};
1413
const COLCON_BUNDLE_RETRIES = Number.parseInt(core.getInput('colcon-bundle-retries'), 10);
1514
const MINIMUM_BACKOFF_TIME_SECONDS = 32; // delay for the first retry in seconds
@@ -78,10 +77,8 @@ async function getSampleAppVersion() : Promise<string> {
7877
return Promise.resolve(version);
7978
}
8079

81-
// If .rosinstall exists, run 'vcs import' and return a list of names of the packages that were added in both workspaces.
82-
async function fetchRosinstallDependencies(): Promise<string[]> {
83-
let colconListAfter = {stdout: '', stderr: ''};
84-
let packages: string[] = [];
80+
// If .rosinstall exists, run 'vcs import'
81+
async function fetchRosinstallDependencies() {
8582
// Download dependencies not in apt if .rosinstall exists
8683
try {
8784
// When generate-sources: true, the expected behavior is to include sources from both workspaces including their dependencies.
@@ -91,40 +88,28 @@ async function fetchRosinstallDependencies(): Promise<string[]> {
9188
await exec.exec("vcs", ["import", "--input", ".rosinstall"], {cwd: workspace});
9289
}
9390
}
94-
// this is outside the loop as we don't want to build both the dependency packages
95-
if (fs.existsSync(path.join(WORKSPACE_DIRECTORY, '.rosinstall'))) {
96-
await exec.exec("colcon", ["list", "--names-only"], getWorkingDirExecOptions(colconListAfter));
97-
const packagesAfter = colconListAfter.stdout.split("\n");
98-
packagesAfter.forEach(packageName => {
99-
packages.push(packageName.trim());
100-
});
101-
}
91+
10292
} catch(error) {
10393
core.setFailed(error.message);
104-
}
105-
return Promise.resolve(packages);
94+
}
10695
}
10796
async function setup() {
10897
try{
109-
110-
//this function relies on the fact that there is only 1 package.xml in ./robot_ws
111-
SAMPLE_APP_VERSION = await getSampleAppVersion();
112-
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
113-
11498
if (!fs.existsSync("/etc/timezone")) {
11599
//default to US Pacific if timezone is not set.
116100
const timezone = "US/Pacific";
117101
await exec.exec("bash", ["-c", `ln -snf /usr/share/zoneinfo/${timezone} /etc/localtime`]);
118102
await exec.exec("bash" , ["-c", `echo ${timezone} > /etc/timezone`]);
119103
}
120104
await exec.exec("bash", ["-c", `scripts/setup.sh --install-ros ${ROS_DISTRO}`]);
121-
loadROSEnvVariables();
105+
await loadROSEnvVariables();
122106
await exec.exec("apt-get", ["update"]);
123107
//zip required for prepare_sources step.
124108
await exec.exec("apt-get", ["install", "-y", "zip"]);
125-
126-
let packages = await fetchRosinstallDependencies();
127-
PACKAGES = packages.join(" ");
109+
110+
SAMPLE_APP_VERSION = await getSampleAppVersion();
111+
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
112+
await fetchRosinstallDependencies();
128113
} catch (error) {
129114
core.setFailed(error.message);
130115
}

0 commit comments

Comments
 (0)