Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ typings/
build-harness

# Mac DS_Store files
.DS_Store
.DS_Store

# Claude Code artifacts
.claude/
.claude-code/
.claude-flow/
.hive-mind/
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48977,9 +48977,14 @@ const installAtmosVersion = async (info, auth, arch, installWrapper) => {
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
const downloadPath = await tool_cache.downloadTool(info.downloadUrl, undefined, auth);
const toolPath = external_path_.join(atmosInstallPath, atmosBinName);
core.info("Renaming downloaded file...");
await io.mv(downloadPath, toolPath);
core.info(`Successfully renamed atmos from ${downloadPath} to ${toolPath}`);
core.info("Installing downloaded file...");
// Ensure the destination directory exists
await io.mkdirP(atmosInstallPath);
// Use copy + delete instead of mv/rename to handle cross-device installations
// This fixes EXDEV errors in Docker-in-Docker and other containerized environments
await io.cp(downloadPath, toolPath);
await io.rmRF(downloadPath);
core.info(`Successfully installed atmos from ${downloadPath} to ${toolPath}`);
external_fs_default().chmodSync(toolPath, 0o775);
if (installWrapper) {
await installWrapperBin(atmosInstallPath);
Expand Down
18 changes: 12 additions & 6 deletions src/__tests__/setup-atmos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe("Setup Atmos", () => {
jest.spyOn(tc, "cacheDir").mockResolvedValueOnce("atmos");
jest.spyOn(io, "mkdirP").mockResolvedValueOnce();
jest.spyOn(io, "cp").mockResolvedValueOnce();
jest.spyOn(io, "rmRF").mockResolvedValueOnce();

jest
.spyOn(tc, "downloadTool")
Expand Down Expand Up @@ -93,28 +94,33 @@ describe("Setup Atmos", () => {
it("installs atmos without wrapper", async () => {
setupSpies("latest", "1.15.0", false);

const wrapperInstallMock = jest.spyOn(io, "cp");

await run();
nockDoneCb();

expect(wrapperInstallMock).not.toHaveBeenCalled();
// With the fix, io.cp is called once for the binary (replacing io.mv)
expect(io.cp).toHaveBeenCalledWith(
"atmos_1.15.0_linux_amd64",
[path.resolve(__dirname, "..", "..", ".."), "atmos", "atmos"].join(path.sep)
);
// io.rmRF should be called to clean up the temp file
expect(io.rmRF).toHaveBeenCalledWith("atmos_1.15.0_linux_amd64");
});

it("installs atmos with wrapper", async () => {
setupSpies("latest", "1.15.0", true);

const wrapperInstallMock = jest.spyOn(io, "mv");

await run();
nockDoneCb();

expect(wrapperInstallMock).toHaveBeenCalledWith(
// With wrapper, io.cp is called for the binary (to atmos-bin)
expect(io.cp).toHaveBeenCalledWith(
"atmos_1.15.0_linux_amd64",
[path.resolve(__dirname, "..", "..", ".."), "atmos", "atmos-bin"].join(
path.sep
)
);
// io.rmRF should be called to clean up the temp file
expect(io.rmRF).toHaveBeenCalledWith("atmos_1.15.0_linux_amd64");
});
});

11 changes: 8 additions & 3 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ export const installAtmosVersion = async (
const downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
const toolPath = path.join(atmosInstallPath, atmosBinName);

core.info("Renaming downloaded file...");
await io.mv(downloadPath, toolPath);
core.info(`Successfully renamed atmos from ${downloadPath} to ${toolPath}`);
core.info("Installing downloaded file...");
// Ensure the destination directory exists
await io.mkdirP(atmosInstallPath);
// Use copy + delete instead of mv/rename to handle cross-device installations
// This fixes EXDEV errors in Docker-in-Docker and other containerized environments
await io.cp(downloadPath, toolPath);
await io.rmRF(downloadPath);
core.info(`Successfully installed atmos from ${downloadPath} to ${toolPath}`);

fs.chmodSync(toolPath, 0o775);

Expand Down