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

Confusing error when trying to deploy Rust docs #303

Open
rikhuijzer opened this issue Jan 23, 2024 · 7 comments
Open

Confusing error when trying to deploy Rust docs #303

rikhuijzer opened this issue Jan 23, 2024 · 7 comments

Comments

@rikhuijzer
Copy link

I'm quite sure that the

Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.

is also triggered when there is no index.html file.

@yoannchaudet
Copy link
Collaborator

Can you point us at a workflow run maybe where you see this error?

@rikhuijzer
Copy link
Author

rikhuijzer commented Jan 29, 2024

Yes. Thanks for reaching out, @yoannchaudet, and my apologies for not providing anything to work with. To make it up to you all, I put in some extra effort and made a minimal reproducible example at https://github.com/rikhuijzer/deploy-pages-mwe.

The repository contains a minimal Rust project and attempts to deploy the docs via actions/upload-pages-artifact@v3 and actions/deploy-pages@v4.

This is the full workflow, which should work for any simple Rust project:

name: docs

on:
  push:
    branches:
      - main
  pull_request:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Stable Rust
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: 'stable'

      - name: Build docs and manually add an index.html file
        run: |
          cargo doc --all --no-deps
          echo '<meta http-equiv="refresh" content="0; url=mwe">' > target/doc/index.html

      - uses: actions/upload-pages-artifact@v3
        if: ${{ github.event_name != 'pull_request' }}
        with:
          path: './target/doc'
          retention-days: '1'

  deploy:
    # Separate step to keep the permissions separated.
    needs: build
    if: ${{ github.event_name != 'pull_request' }}
    permissions:
      contents: read
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4

This is the error:

> Run actions/deploy-pages@v4
Fetching artifact metadata for "github-pages" in this workflow run
Found 1 artifact(s)
Creating Pages deployment with payload:
{
	"artifact_id": 1188542064,
	"pages_build_version": "6fed36452144f63332d81e8929a89f5f5a3a425d",
	"oidc_token": "***"
}
Created deployment for 6fed36452144f63332d81e8929a89f5f5a3a425d, ID: 6fed36452144f63332d81e8929a89f5f5a3a425d
Getting Pages deployment status...
Error: Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.

In another repository, I could easily fix the error by switching to deploying the pages via a gh-pages branch instead of actions/deploy-pages (For more details about that see https://github.com/poweranalyses-org/rmathlib/commits/main/ and scroll down a bit to see the failing CI runs near commit 2212240227088ce15d283851e4007aa3c14efb75).

@rikhuijzer rikhuijzer changed the title Confusing error when no index.html exists Confusing error when trying to deploy Rust docs Jan 29, 2024
@rikhuijzer
Copy link
Author

rikhuijzer commented Jan 29, 2024

And this is the file tree for the generated artifact:

$ tree artifact/
artifact/
├── crates.js
├── help.html
├── index.html
├── mwe
│   ├── all.html
│   ├── fn.plus_one.html
│   ├── index.html
│   └── sidebar-items.js
├── search-index.js
├── settings.html
├── src
│   └── mwe
│       └── lib.rs.html
├── src-files.js
└── static.files
    ├── COPYRIGHT-23e9bde6c69aea69.txt
    ├── FiraSans-LICENSE-db4b642586e02d97.txt
    ├── FiraSans-Medium-8f9a781e4970d388.woff2
    ├── FiraSans-Regular-018c141bf0843ffd.woff2
    ├── LICENSE-APACHE-b91fa81cba47b86a.txt
    ├── LICENSE-MIT-65090b722b3f6c56.txt
    ├── NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2
    ├── NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt
    ├── SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2
    ├── SourceCodePro-LICENSE-d180d465a756484a.txt
    ├── SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2
    ├── SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2
    ├── SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2
    ├── SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2
    ├── SourceSerif4-LICENSE-3bb119e13b1258b7.md
    ├── SourceSerif4-Regular-46f98efaafac5295.ttf.woff2
    ├── clipboard-7571035ce49a181d.svg
    ├── favicon-16x16-8b506e7a72182f1c.png
    ├── favicon-2c020d218678b618.svg
    ├── favicon-32x32-422f7d1d52889060.png
    ├── main-9dd44ab47b99a0fb.js
    ├── normalize-76eba96aa4d2e634.css
    ├── noscript-5d8b3c7633ad77ba.css
    ├── rust-logo-151179464ae7ed46.svg
    ├── rustdoc-9ee3a5e31a2afa3e.css
    ├── scrape-examples-ef1e698c1d417c0c.js
    ├── search-8fbf244ebcf71464.js
    ├── settings-74424d7eec62a23e.js
    ├── src-script-3280b574d94e47b4.js
    ├── storage-fec3eaa3851e447d.js
    └── wheel-7b819b6101059cd0.svg

5 directories, 42 files

I also manually confirmed via ls -ahlv that none of these files seems to be a hard link or a symlink. Also, the file size is only about 1 MB which is well below 10 GB that the error talks about.

@yoannchaudet
Copy link
Collaborator

yoannchaudet commented Jan 29, 2024

@rikhuijzer Thanks for spending the time to get some details!

We do a bit more validation than the error message implies (will look into fixing that so it's clear what's going on).

Here is what's tripping your deployment:

Tarball contains file without 'read other' permission ./.lock

We talk about permissions and provide some ways to fix that in:

https://github.com/actions/upload-pages-artifact?tab=readme-ov-file#file-permissions

@dhardy
Copy link

dhardy commented Feb 18, 2024

I hit this too; luckily I found this issue since the error message is not helpful.

The simplest fix appears to be just to delete the .lock file:

rm target/doc/.lock

@TheDevelolper
Copy link

TheDevelolper commented May 12, 2024

@rikhuijzer Thanks for spending the time to get some details!

We do a bit more validation than the error message implies (will look into fixing that so it's clear what's going on).

Here is what's tripping your deployment:

Tarball contains file without 'read other' permission ./.lock

We talk about permissions and provide some ways to fix that in:

actions/upload-pages-artifact#file-permissions

I'm facing the same issue. How were you able to see this error? It could help me work out what's wrong with my deployment.

all I see is:

Run actions/deploy-pages@v4
Fetching artifact metadata for "github-pages" in this workflow run
Found 1 artifact(s)
Creating Pages deployment with payload:
{
	"artifact_id": 14[9](https://github.com/TheDevelolper/notedrop/actions/runs/9050589086/job/24866183439#step:2:10)4693185,
	"pages_build_version": "945bbcc148d4bc792a32188277b80d150320aaee",
	"oidc_token": "***"
}
Created deployment for 945bbcc148d4bc792a32188277b80d150320aaee, ID: 945bbcc148d4bc792a32188277b80d150320aaee
Getting Pages deployment status...
Error: Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than [10](https://github.com/TheDevelolper/notedrop/actions/runs/9050589086/job/24866183439#step:2:11)GB.

I'm not sure if it's because I've not specified a token?

I'm trying to deploy an Astro site.

@blaylockbk
Copy link

We talk about permissions and provide some ways to fix that in:

https://github.com/actions/upload-pages-artifact?tab=readme-ov-file#file-permissions

Link is actually https://github.com/actions/upload-pages-artifact/tree/v1.0.10?tab=readme-ov-file#file-permissions. Setting the file permissions for my upload folder with chmod -R a+rX ./site worked for me. Thanks!

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

No branches or pull requests

5 participants