FleekHQ / IC-Deploy-Action

Github action that wraps dfx commands to deploy canisters to Dfinity on push
43 stars 14 forks source link

No such file or directory (os error 2) #4

Open gespi1 opened 2 years ago

gespi1 commented 2 years ago

dfx version: 0.9.3 laptop: mac M1 (12.3.1)

while using the fleekhq ic-deploy action on my ICP project. I kept encountering the following error No such file or directory (os error 2) as shown in the image below;

Screen Shot 2022-04-26 at 8 01 24 PM

my deploy.yaml looked just like the current README on this project;

on: [push]

jobs:
  test-deploy:
    runs-on: ubuntu-latest
    name: A job to deploy canisters to the IC
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: npm install
      - name: Deploy canisters
        id: deploy
        uses: fleekhq/ic-deploy-action@master
        with:
          identity: ${{ secrets.DFX_IDENTITY }}
          wallets: ${{ secrets.DFX_WALLETS }}
      - name: Show success message
        run: echo success!

Verified my canister source paths were correct, and the dist folder and .dfx folders existed.

So i decided to fork this repo and try replicating the issue locally to find out whats going on.

When trying to replicate it locally, I ran into a different error upon getting to the dfx deploy part, The command '"npm" "run" "build"' failed with exit status 'exit status: 127'..

Screen Shot 2022-04-26 at 8 33 09 PM

It wasn't until i added npm and rsync on the image that i was able to deploy it to IC from my local. Below is the modified Dockerfile I used.

# switched from aarch to amd64 bc mac m1 was giving me issues about that arch type
FROM amd64/ubuntu:focal

ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH="/home/node/.npm-global/bin:$PATH"
ENV DEBIAN_FRONTEND=noninteractive                     # used to have npm install non-interactive

USER node

COPY dfx-install.sh /home/dfx-install.sh
COPY entrypoint.sh /home/node/entrypoint.sh

USER root

RUN apt-get update && apt-get install -y curl \
  build-essential \
  libc6-dev \
  rsync \
  npm

RUN ["chmod", "+x", "/home/dfx-install.sh"]

RUN ["sh", "-m", "/home/dfx-install.sh"]

RUN ["chmod", "+x", "/home/node/entrypoint.sh"]

ENTRYPOINT ["/home/node/entrypoint.sh"]

Then i added my fork as apart of my github action

on: [push]

jobs:
  test-deploy:
    runs-on: ubuntu-latest
    name: A job to deploy canisters to the IC
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: npm install
      - name: Deploy canisters
        id: deploy
        uses: gespi1/ic-deploy-action@master
        with:
          identity: ${{ secrets.DFX_IDENTITY }}
          wallets: ${{ secrets.DFX_WALLETS }}
      - name: Show success message
        run: echo success!

and WAH-LA the error I was getting originally is gone. Seems like having npm and rsync installed as part of the Dockerfile solved my issue.

Not certain of the root cause and if others are having the same issue but if you are here ya go.

gespi1 commented 2 years ago

opened PR https://github.com/FleekHQ/IC-Deploy-Action/pull/5