Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support: self-hosted runner publishes directory with weird prefix #740

Open
dhimmel opened this issue Apr 29, 2022 · 9 comments
Open

support: self-hosted runner publishes directory with weird prefix #740

dhimmel opened this issue Apr 29, 2022 · 9 comments
Assignees
Labels
support User support

Comments

@dhimmel
Copy link
Contributor

dhimmel commented Apr 29, 2022

I recently switched a workflow that includes peaceiris/actions-gh-pages to use a self-hosted runner.

When using peaceiris/actions-gh-pages@v3 and when the output branch doesn't already exist, the deploy step succeeded but placed the published data under a prefix, i.e. the output was written to undefined/actions_github_pages_1651252139745/test.json instead of just test.json. Here are links for the workflow, the job log, and output branch. Some key lines of output:

INFO:nxontology_data.utils:Wrote ontology to /actions-runner/_work/nxontology-data/nxontology-data/output/test/test.json
...

/usr/bin/git clone --depth=1 --single-branch --branch output/test ***github.com/related-sciences/nxontology-data.git undefined/actions_github_pages_1651252139745
  Cloning into 'undefined/actions_github_pages_1651252139745'...
  warning: Could not find remote branch output/test to clone.
  fatal: Remote branch output/test not found in upstream origin
  [INFO] first deployment, create new branch output/test
  [INFO] The process '/usr/bin/git' failed with exit code 128
  [INFO] chdir undefined/actions_github_pages_16512521397[45](https://github.com/related-sciences/nxontology-data/runs/6232229406?check_suite_focus=true#step:6:45)
  /usr/bin/git init
  Initialized empty Git repository in /actions-runner/_work/nxontology-data/nxontology-data/undefined/actions_github_pages_1651252139745/.git/
  /usr/bin/git checkout --orphan output/test
  Switched to a new branch 'output/test'
  [INFO] prepare publishing assets
  [INFO] create undefined/actions_github_pages_1651252139745
  [INFO] copy /actions-runner/_work/nxontology-data/nxontology-data/output/test to undefined/actions_github_pages_1651252139745
  cp: no such file or directory: /actions-runner/_work/nxontology-data/nxontology-data/output/test/.*

When using peaceiris/actions-gh-pages@main, I got a failure:

Error: File not found: '/actions-runner/_work/_actions/peaceiris/actions-gh-pages/main/lib/index.js'

When using peaceiris/actions-gh-pages@v3 but when the output branch already exists, I get:

  /usr/bin/git push origin output/test
  To https://github.com/related-sciences/nxontology-data.git
   ! [rejected]        output/test -> output/test (fetch first)
  error: failed to push some refs to '***github.com/related-sciences/nxontology-data.git'
  hint: Updates were rejected because the remote contains work that you do
  hint: not have locally. This is usually caused by another repository pushing
  hint: to the same ref. You may want to first integrate the remote changes
  hint: (e.g., 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  Error: Action failed with "The process '/usr/bin/git' failed with exit code 1"

So not sure exactly how to proceed.

Relevant links

Public repository: https://github.com/related-sciences/nxontology-data
YAML config: https://github.com/related-sciences/nxontology-data/blob/6b43ce4927641f43baebc3e077e0c56a32fdf53f/.github/workflows/create.yaml

@dhimmel
Copy link
Contributor Author

dhimmel commented May 7, 2022

@peaceiris any insights here? Happy to help diagnose.

@pavlovp
Copy link

pavlovp commented May 27, 2022

started getting that with ForceOrphan: true

@dhimmel
Copy link
Contributor Author

dhimmel commented May 27, 2022

started getting that with ForceOrphan: true

Thanks @pavlovp for commenting. Specifically which part since there are several potential issues / symptoms here?

@pavlovp
Copy link

pavlovp commented May 30, 2022

My github actions pipeline:

  - name: build-docs
    run: npm run build:docs
  - name: Deploy-docs
    uses: peaceiris/[email protected]
    with:
      github_token: ${{ secrets.GITHUB_TOKEN }}
      publish_dir: ./docs
      destination_dir: docs
      force_orphan: true

Logs (actions tab):

Run peaceiris/[email protected]
[INFO] Usage https://github.com/peaceiris/actions-gh-pages#readme
Dump inputs
[INFO] GithubToken: true
[INFO] PublishBranch: gh-pages
[INFO] PublishDir: ./docs
[INFO] DestinationDir: docs
[INFO] ExternalRepository:
[INFO] AllowEmptyCommit: false
[INFO] KeepFiles: false
[INFO] ForceOrphan: true
[INFO] UserName:
[INFO] UserEmail:
[INFO] CommitMessage:
[INFO] FullCommitMessage:
[INFO] TagName:
[INFO] TagMessage:
[INFO] EnableJekyll (DisableNoJekyll): false
[INFO] CNAME:
[INFO] ExcludeAssets .github

Setup auth token
[INFO] setup GITHUB_TOKEN
Prepare publishing assets
[INFO] ForceOrphan: true
[INFO] chdir undefined/actions_github_pages_1653910528380
/usr/local/git/bin/git init
Initialized empty Git repository in /var/actions/_work/project-name/project-name/undefined/actions_github_pages_1653910528380/.git/
/usr/local/git/bin/git checkout --orphan gh-pages
Switched to a new branch 'gh-pages'
[INFO] prepare publishing assets
[INFO] create undefined/actions_github_pages_1653910528380/docs
[INFO] copy /var/actions/_work/project-name/project-name/docs to undefined/actions_github_pages_1653910528380/docs
[INFO] delete excluded assets
cp: no such file or directory: /var/actions/_work/project-name/project-name/docs/.*
rm: no paths given
[INFO] Created undefined/actions_github_pages_1653910528380/.nojekyll

image

I'm wondering what cause this weird undefined/actions_github_pages_xxx folder to be created - when I navigate in the browser using this suffix I'm able to access the web app that is hosted in my github pages env.

@dhimmel
Copy link
Contributor Author

dhimmel commented Oct 20, 2022

@peaceiris hoping to catch your eye here, especially since this would be great to get fixed in the next major release. The issue is that content is deployed to a directory like undefined/actions_github_pages_1651252139745 rather than being placed in the root of the branch.

I'm having this issue using a self-hosted runner and @pavlovp experienced this issue when setting force_orphan: true.

@dhimmel
Copy link
Contributor Author

dhimmel commented Jan 9, 2023

@peaceiris any updates on this issue? I haven't tested with v3.9.1 yet, so let me know if any chance this is already fixed and I will reevaluate.

@12ain
Copy link

12ain commented Jun 7, 2023

I seem to have the same problem, everything seems to work fine when running actions runner with nohup, when I use supervisor to manage run.sh, I have a similar problem, I don't know if this is the reason for it. Here is my supervisor configuration.

[program:actions-runner]
directory=/home/ubuntu/actions-runner
command=/home/ubuntu/actions-runner/run.sh
autostart=true
autorestart=true
startretries=3
user=ubuntu
redirect_stderr=true
stdout_logfile=/home/ubuntu/actions-runner/logs/out.log
stderr_logfile=/home/ubuntu/actions-runner/logs/err.log

actions:

      - name: Push K8S Yaml
        uses: peaceiris/actions-gh-pages@v3
        if: ${{ inputs.config_stage == 'beta' }}
        with:
          personal_token: ${{ secrets.PERSONAL_TOKEN }}
          publish_dir: ./artifact/cdk8s/test
          keep_files: true
          publish_branch: ${{ github.repository }}
          external_repository: ${{ github.repository }}
          destination_dir: beta

Guessing it could be because of some missing environment variable? I read the source code and didn't find out what the problem was.

Thank you for your prompt response.

@Hansanghyeon
Copy link

@dhimmel, I've identified what the issue is. If you have configured the GitHub Actions self-hosted runner with the root user, you will encounter the error mentioned above.

@dywanik
Copy link

dywanik commented Feb 29, 2024

Got the same issues when running on self-hosted runner as root. My workaround was to use containers. I noticed that this has something to do with removing the repository: when root does it, it cleans up using git commands. However, when using containers, it gets fully removed and cloned again. Maybe it'll help somebody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support User support
Projects
None yet
Development

No branches or pull requests

6 participants