Skip to content

Commit 3add115

Browse files
Use ros-apt-source package
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
1 parent db439e7 commit 3add115

File tree

4 files changed

+103
-169
lines changed

4 files changed

+103
-169
lines changed

dist/index.js

Lines changed: 52 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6965,13 +6965,23 @@ function addDnfRepo(use_ros2_testing) {
69656965
"--set-enabled",
69666966
extra_repo_name,
69676967
]);
6968-
const testing_repo_suffix = use_ros2_testing ? "-testing" : "";
6968+
// Install key and repo using ros-apt-source:
6969+
// https://docs.ros.org/en/rolling/Installation/RHEL-Install-RPMs.html#enable-required-repositories
6970+
const apt_version = yield utils.getRosAptSourceLatestVersion();
69696971
yield utils.exec("sudo", [
6970-
"curl",
6971-
"--output",
6972-
"/etc/yum.repos.d/ros2.repo",
6973-
`http://packages.ros.org/ros2${testing_repo_suffix}/rhel/ros2${testing_repo_suffix}.repo`,
6972+
"dnf",
6973+
"install",
6974+
`https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros2-release-${apt_version}-1.noarch.rpm`,
69746975
]);
6976+
if (use_ros2_testing) {
6977+
yield utils.exec("sudo", ["dnf", "config-manager", "--disable", "ros2"]);
6978+
yield utils.exec("sudo", [
6979+
"dnf",
6980+
"config-manager",
6981+
"--enable",
6982+
"ros2-testing",
6983+
]);
6984+
}
69756985
yield utils.exec("sudo", ["dnf", "makecache", "--assumeyes"]);
69766986
});
69776987
}
@@ -7059,68 +7069,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
70597069
step((generator = generator.apply(thisArg, _arguments || [])).next());
70607070
});
70617071
};
7062-
var __importDefault = (this && this.__importDefault) || function (mod) {
7063-
return (mod && mod.__esModule) ? mod : { "default": mod };
7064-
};
70657072
Object.defineProperty(exports, "__esModule", ({ value: true }));
70667073
exports.runLinux = runLinux;
70677074
const core = __importStar(__nccwpck_require__(186));
70687075
const io = __importStar(__nccwpck_require__(436));
70697076
const apt = __importStar(__nccwpck_require__(671));
70707077
const pip = __importStar(__nccwpck_require__(744));
70717078
const utils = __importStar(__nccwpck_require__(314));
7072-
const path = __importStar(__nccwpck_require__(17));
7073-
const fs_1 = __importDefault(__nccwpck_require__(147));
7074-
// Open Robotics APT Repository public GPG key, as retrieved at:
7075-
// https://github.com/ros/rosdistro/blob/master/ros.asc
7076-
//
7077-
// Unfortunately, usin apt-key adv is slow, and is failing sometimes, causing
7078-
// spurious pipelines failures. The action is hard-coding the key here to
7079-
// mitigate this issue.
7080-
const openRoboticsAptPublicGpgKey = `
7081-
-----BEGIN PGP PUBLIC KEY BLOCK-----
7082-
Version: GnuPG v1
7083-
7084-
mQINBFzvJpYBEADY8l1YvO7iYW5gUESyzsTGnMvVUmlV3XarBaJz9bGRmgPXh7jc
7085-
VFrQhE0L/HV7LOfoLI9H2GWYyHBqN5ERBlcA8XxG3ZvX7t9nAZPQT2Xxe3GT3tro
7086-
u5oCR+SyHN9xPnUwDuqUSvJ2eqMYb9B/Hph3OmtjG30jSNq9kOF5bBTk1hOTGPH4
7087-
K/AY0jzT6OpHfXU6ytlFsI47ZKsnTUhipGsKucQ1CXlyirndZ3V3k70YaooZ55rG
7088-
aIoAWlx2H0J7sAHmqS29N9jV9mo135d+d+TdLBXI0PXtiHzE9IPaX+ctdSUrPnp+
7089-
TwR99lxglpIG6hLuvOMAaxiqFBB/Jf3XJ8OBakfS6nHrWH2WqQxRbiITl0irkQoz
7090-
pwNEF2Bv0+Jvs1UFEdVGz5a8xexQHst/RmKrtHLct3iOCvBNqoAQRbvWvBhPjO/p
7091-
V5cYeUljZ5wpHyFkaEViClaVWqa6PIsyLqmyjsruPCWlURLsQoQxABcL8bwxX7UT
7092-
hM6CtH6tGlYZ85RIzRifIm2oudzV5l+8oRgFr9yVcwyOFT6JCioqkwldW52P1pk/
7093-
/SnuexC6LYqqDuHUs5NnokzzpfS6QaWfTY5P5tz4KHJfsjDIktly3mKVfY0fSPVV
7094-
okdGpcUzvz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S0dnAACgkQ9C7W+6sX
7110-
xlS/UA//aAgP67DunDdak96+fLemWJkl4PHhj6637lzacJ+SlRzeUbnS/2XLhmk1
7111-
BNYoib3IHp3GBqvLsQqkCUZWaJTvkkAvJ+1W2N7JByt7Z/tnTS7aVfDxF53nYCxY
7112-
eSH921y2AtIZCIl1N3R2ic7pyzNkVVqwKIV1EqWLMa8GQTy4V0pgwaLE6Ce9Bmtv
7113-
04upGyiPXRoPM3Rfc0mTUtPGJLf651img6TYGb1UbKs2aAitiI2ptg8EdiRYYcGo
7114-
nG8Ar3aUnYj+fpfhTyvqwx0MTtAPDiMUx2vELReYIvhwU+SRHWpp20nL0WIK2krK
7115-
qIq5SwIboBSLkQ5j7tjehKkqfxanUrlUxu/XYlEhq0Mh5oCfBrarIFBUBULUX86p
7116-
ZQUqW4+MrIxHcNcrCPGm3U/4dSZ1rTAdyeEUi7a2H96CYYofl7dq1xXGMDFh+b5/
7117-
3Yw3t8US4VCwxmEj+C3ciARJauB1oDOilEieszPvIS3PdVpp6HCZRRHaB689AzMF
7118-
FoD40iowsNS9XmO6O8V7xzVVS0EtNhz9qUGIz8yjWeLLdpR8NqHOFOvrPP66voEV
7119-
Gc0Va/nozc05WWt42bc0hs1faRMqHRlAlJIKSUm4NSqc+YDNPYFlZSnB97tBhHC9
7120-
CEXRgHY3Utq/I3CLJ+KcJCUCH5D16Z7aOoazG9DKbewA+da8Drw=
7121-
=9IZg
7122-
-----END PGP PUBLIC KEY BLOCK-----
7123-
`;
71247079
/**
71257080
* Configure basic OS stuff.
71267081
*/
@@ -7160,43 +7115,36 @@ function configOs() {
71607115
yield apt.runAptGetInstall(["tzdata"]);
71617116
});
71627117
}
7163-
/**
7164-
* Add OSRF APT repository key.
7165-
*
7166-
* This is necessary even when building from source to install colcon, vcs, etc.
7167-
*/
7168-
function addAptRepoKey() {
7169-
return __awaiter(this, void 0, void 0, function* () {
7170-
const workspace = process.env.GITHUB_WORKSPACE;
7171-
const keyFilePath = path.join(workspace, "ros.key");
7172-
fs_1.default.writeFileSync(keyFilePath, openRoboticsAptPublicGpgKey);
7173-
yield utils.exec("sudo", ["apt-key", "add", keyFilePath]);
7174-
});
7175-
}
71767118
// Ubuntu distribution for ROS 1
71777119
const ros1UbuntuVersion = "focal";
71787120
/**
71797121
* Add OSRF APT repository.
71807122
*
71817123
* @param ubuntuCodename the Ubuntu version codename
7124+
* @param use_ros2_testing whether to use the apt testing repository
71827125
*/
71837126
function addAptRepo(ubuntuCodename, use_ros2_testing) {
71847127
return __awaiter(this, void 0, void 0, function* () {
7128+
// Install key and apt repo using ros-apt-source:
7129+
// https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debs.html#enable-required-repositories
7130+
const apt_version = yield utils.getRosAptSourceLatestVersion();
7131+
const deb_file = "/tmp/apt-source.deb";
7132+
let deb_url = "";
71857133
// There is now no Ubuntu version overlap between ROS 1 and ROS 2
71867134
if (ros1UbuntuVersion === ubuntuCodename) {
7187-
yield utils.exec("sudo", [
7188-
"bash",
7189-
"-c",
7190-
`echo "deb http://packages.ros.org/ros/ubuntu ${ubuntuCodename} main" > /etc/apt/sources.list.d/ros-latest.list`,
7191-
]);
7135+
deb_url = `https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros-apt-source_${apt_version}.${ubuntuCodename}_all.deb`;
71927136
}
71937137
else {
7194-
yield utils.exec("sudo", [
7195-
"bash",
7196-
"-c",
7197-
`echo "deb http://packages.ros.org/ros2${use_ros2_testing ? "-testing" : ""}/ubuntu ${ubuntuCodename} main" > /etc/apt/sources.list.d/ros2-latest.list`,
7198-
]);
7138+
const testing = use_ros2_testing ? "-testing" : "";
7139+
deb_url = `https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros2${testing}-apt-source_${apt_version}.${ubuntuCodename}_all.deb`;
71997140
}
7141+
yield utils.exec("sudo", [
7142+
"bash",
7143+
"-c",
7144+
`curl -L -o ${deb_file} "${deb_url}"`,
7145+
]);
7146+
yield utils.exec("sudo", ["bash", "-c", `apt install ${deb_file}`]);
7147+
yield utils.exec("sudo", ["bash", "-c", `rm ${deb_file}`]);
72007148
yield utils.exec("sudo", ["apt-get", "update"]);
72017149
});
72027150
}
@@ -7226,7 +7174,6 @@ function runLinux() {
72267174
const use_ros2_testing = core.getInput("use-ros2-testing") === "true";
72277175
const installConnext = core.getInput("install-connext") === "true";
72287176
yield configOs();
7229-
yield addAptRepoKey();
72307177
const ubuntuCodename = yield utils.determineDistribCodename();
72317178
yield addAptRepo(ubuntuCodename, use_ros2_testing);
72327179
if ("noble" !== ubuntuCodename) {
@@ -7530,13 +7477,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
75307477
});
75317478
};
75327479
Object.defineProperty(exports, "__esModule", ({ value: true }));
7480+
exports.ROS_APT_SOURCE_REPO = void 0;
75337481
exports.exec = exec;
75347482
exports.getRequiredRosDistributions = getRequiredRosDistributions;
75357483
exports.validateDistro = validateDistro;
75367484
exports.determineDistribCodename = determineDistribCodename;
75377485
exports.determineDistrib = determineDistrib;
75387486
exports.determineDistribVer = determineDistribVer;
75397487
exports.getArch = getArch;
7488+
exports.getRosAptSourceLatestVersion = getRosAptSourceLatestVersion;
75407489
const actions_exec = __importStar(__nccwpck_require__(514));
75417490
const core = __importStar(__nccwpck_require__(186));
75427491
/**
@@ -7648,6 +7597,25 @@ function getArch() {
76487597
return getCommandOutput("dpkg --print-architecture");
76497598
});
76507599
}
7600+
exports.ROS_APT_SOURCE_REPO = "ros-infrastructure/ros-apt-source";
7601+
/**
7602+
* Get the latest version of the ros-apt-source package.
7603+
*
7604+
* https://github.com/ros-infrastructure/ros-apt-source/releases
7605+
*
7606+
* @returns the latest version of the ros-apt-source packages
7607+
*/
7608+
function getRosAptSourceLatestVersion() {
7609+
return __awaiter(this, void 0, void 0, function* () {
7610+
// TODO(christophebedard): figure out why doesn't work and switch back
7611+
// return getCommandOutput(
7612+
// `curl -s https://api.github.com/repos/${ROS_APT_SOURCE_REPO}/releases/latest | grep -F "tag_name" | awk -F\\" '{print $4}'`,
7613+
// );
7614+
return new Promise((resolve) => {
7615+
resolve("1.1.0");
7616+
});
7617+
});
7618+
}
76517619

76527620

76537621
/***/ }),

src/setup-ros-rhel.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@ async function addDnfRepo(use_ros2_testing: boolean): Promise<void> {
7272
extra_repo_name,
7373
]);
7474

75-
const testing_repo_suffix = use_ros2_testing ? "-testing" : "";
75+
// Install key and repo using ros-apt-source:
76+
// https://docs.ros.org/en/rolling/Installation/RHEL-Install-RPMs.html#enable-required-repositories
77+
const apt_version = await utils.getRosAptSourceLatestVersion();
7678
await utils.exec("sudo", [
77-
"curl",
78-
"--output",
79-
"/etc/yum.repos.d/ros2.repo",
80-
`http://packages.ros.org/ros2${testing_repo_suffix}/rhel/ros2${testing_repo_suffix}.repo`,
79+
"dnf",
80+
"install",
81+
`https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros2-release-${apt_version}-1.noarch.rpm`,
8182
]);
83+
if (use_ros2_testing) {
84+
await utils.exec("sudo", ["dnf", "config-manager", "--disable", "ros2"]);
85+
await utils.exec("sudo", [
86+
"dnf",
87+
"config-manager",
88+
"--enable",
89+
"ros2-testing",
90+
]);
91+
}
8292

8393
await utils.exec("sudo", ["dnf", "makecache", "--assumeyes"]);
8494
}

src/setup-ros-ubuntu.ts

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,6 @@ import * as apt from "./package_manager/apt";
55
import * as pip from "./package_manager/pip";
66
import * as utils from "./utils";
77

8-
import * as path from "path";
9-
import fs from "fs";
10-
11-
// Open Robotics APT Repository public GPG key, as retrieved at:
12-
// https://github.com/ros/rosdistro/blob/master/ros.asc
13-
//
14-
// Unfortunately, usin apt-key adv is slow, and is failing sometimes, causing
15-
// spurious pipelines failures. The action is hard-coding the key here to
16-
// mitigate this issue.
17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APDiMUx2vELReYIvhwU+SRHWpp20nL0WIK2krK
52-
qIq5SwIboBSLkQ5j7tjehKkqfxanUrlUxu/XYlEhq0Mh5oCfBrarIFBUBULUX86p
53-
ZQUqW4+MrIxHcNcrCPGm3U/4dSZ1rTAdyeEUi7a2H96CYYofl7dq1xXGMDFh+b5/
54-
3Yw3t8US4VCwxmEj+C3ciARJauB1oDOilEieszPvIS3PdVpp6HCZRRHaB689AzMF
55-
FoD40iowsNS9XmO6O8V7xzVVS0EtNhz9qUGIz8yjWeLLdpR8NqHOFOvrPP66voEV
56-
Gc0Va/nozc05WWt42bc0hs1faRMqHRlAlJIKSUm4NSqc+YDNPYFlZSnB97tBhHC9
57-
CEXRgHY3Utq/I3CLJ+KcJCUCH5D16Z7aOoazG9DKbewA+da8Drw=
58-
=9IZg
59-
-----END PGP PUBLIC KEY BLOCK-----
60-
`;
61-
628
/**
639
* Configure basic OS stuff.
6410
*/
@@ -100,47 +46,40 @@ async function configOs(): Promise<void> {
10046
await apt.runAptGetInstall(["tzdata"]);
10147
}
10248

103-
/**
104-
* Add OSRF APT repository key.
105-
*
106-
* This is necessary even when building from source to install colcon, vcs, etc.
107-
*/
108-
async function addAptRepoKey(): Promise<void> {
109-
const workspace = process.env.GITHUB_WORKSPACE as string;
110-
const keyFilePath = path.join(workspace, "ros.key");
111-
fs.writeFileSync(keyFilePath, openRoboticsAptPublicGpgKey);
112-
await utils.exec("sudo", ["apt-key", "add", keyFilePath]);
113-
}
114-
11549
// Ubuntu distribution for ROS 1
11650
const ros1UbuntuVersion = "focal";
11751

11852
/**
11953
* Add OSRF APT repository.
12054
*
12155
* @param ubuntuCodename the Ubuntu version codename
56+
* @param use_ros2_testing whether to use the apt testing repository
12257
*/
12358
async function addAptRepo(
12459
ubuntuCodename: string,
12560
use_ros2_testing: boolean,
12661
): Promise<void> {
62+
// Install key and apt repo using ros-apt-source:
63+
// https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debs.html#enable-required-repositories
64+
const apt_version = await utils.getRosAptSourceLatestVersion();
65+
const deb_file = "/tmp/apt-source.deb";
66+
67+
let deb_url = "";
12768
// There is now no Ubuntu version overlap between ROS 1 and ROS 2
12869
if (ros1UbuntuVersion === ubuntuCodename) {
129-
await utils.exec("sudo", [
130-
"bash",
131-
"-c",
132-
`echo "deb http://packages.ros.org/ros/ubuntu ${ubuntuCodename} main" > /etc/apt/sources.list.d/ros-latest.list`,
133-
]);
70+
deb_url = `https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros-apt-source_${apt_version}.${ubuntuCodename}_all.deb`;
13471
} else {
135-
await utils.exec("sudo", [
136-
"bash",
137-
"-c",
138-
`echo "deb http://packages.ros.org/ros2${
139-
use_ros2_testing ? "-testing" : ""
140-
}/ubuntu ${ubuntuCodename} main" > /etc/apt/sources.list.d/ros2-latest.list`,
141-
]);
72+
const testing = use_ros2_testing ? "-testing" : "";
73+
deb_url = `https://github.com/${utils.ROS_APT_SOURCE_REPO}/releases/download/${apt_version}/ros2${testing}-apt-source_${apt_version}.${ubuntuCodename}_all.deb`;
14274
}
14375

76+
await utils.exec("sudo", [
77+
"bash",
78+
"-c",
79+
`curl -L -o ${deb_file} "${deb_url}"`,
80+
]);
81+
await utils.exec("sudo", ["bash", "-c", `apt install ${deb_file}`]);
82+
await utils.exec("sudo", ["bash", "-c", `rm ${deb_file}`]);
14483
await utils.exec("sudo", ["apt-get", "update"]);
14584
}
14685

@@ -170,8 +109,6 @@ export async function runLinux(): Promise<void> {
170109

171110
await configOs();
172111

173-
await addAptRepoKey();
174-
175112
const ubuntuCodename = await utils.determineDistribCodename();
176113
await addAptRepo(ubuntuCodename, use_ros2_testing);
177114

src/utils.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,22 @@ export async function determineDistribVer(): Promise<string> {
121121
export async function getArch(): Promise<string> {
122122
return getCommandOutput("dpkg --print-architecture");
123123
}
124+
125+
export const ROS_APT_SOURCE_REPO = "ros-infrastructure/ros-apt-source";
126+
127+
/**
128+
* Get the latest version of the ros-apt-source package.
129+
*
130+
* https://github.com/ros-infrastructure/ros-apt-source/releases
131+
*
132+
* @returns the latest version of the ros-apt-source packages
133+
*/
134+
export async function getRosAptSourceLatestVersion(): Promise<string> {
135+
// TODO(christophebedard): figure out why doesn't work and switch back
136+
// return getCommandOutput(
137+
// `curl -s https://api.github.com/repos/${ROS_APT_SOURCE_REPO}/releases/latest | grep -F "tag_name" | awk -F\\" '{print $4}'`,
138+
// );
139+
return new Promise((resolve) => {
140+
resolve("1.1.0");
141+
});
142+
}

0 commit comments

Comments
 (0)