deploy-pages icon indicating copy to clipboard operation
deploy-pages copied to clipboard

Confusing error when trying to deploy Rust docs

Open rikhuijzer opened this issue 1 year ago • 9 comments

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.

rikhuijzer avatar Jan 23 '24 12:01 rikhuijzer

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

yoannchaudet avatar Jan 29 '24 18:01 yoannchaudet

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 avatar Jan 29 '24 19:01 rikhuijzer

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.

rikhuijzer avatar Jan 29 '24 20:01 rikhuijzer

@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

yoannchaudet avatar Jan 29 '24 21:01 yoannchaudet

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

dhardy avatar Feb 18 '24 11:02 dhardy

@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.

TheDevelolper avatar May 12 '24 10:05 TheDevelolper

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!

blaylockbk avatar Jul 02 '24 23:07 blaylockbk

re:, https://github.com/actions/deploy-pages/issues/303#issuecomment-1915616098, @yoannchaudet: if I made a PR to add a mention about ensuring that all files/directories are world readable, would it be accepted? (It doesn't make sense to link to https://github.com/actions/upload-pages-artifact/tree/v1.0.10?tab=readme-ov-file#file-permissions because there's no guarantee that people are using that action....)

jsoref avatar Jan 02 '25 15:01 jsoref

I'm new to GitHub, and I'm getting a similar error, could anyone help please? Here's my gh-pages.yml file, could anyone point out the error? I'm getting: Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.

name: Build and Deploy to GitHub Pages

on: push: branches: - master

permissions: contents: read pages: write id-token: write

jobs: build-page: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 with: submodules: true fetch-depth: 0

  - name: Setup Hugo
    uses: peaceiris/actions-hugo@v2
    with:
      hugo-version: "0.123.0"
      extended: true

  - name: Build Hugo Site
    run: hugo --minify

  - name: Debug Hugo Build Output
    run: ls -la public

  - name: Remove .lock files  # ✅ New step to fix deployment issue
    run: find public/ -name ".lock" -type f -delete

  - name: Upload Artifact
    uses: actions/upload-artifact@v4
    with:
      name: github-pages
      path: public/

deploy: runs-on: ubuntu-latest needs: build-page environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Download Artifact uses: actions/download-artifact@v4 with: name: github-pages path: public/

  - name: Debug Downloaded Artifact
    run: ls -la public/

  - name: Deploy to GitHub Pages
    id: deployment
    uses: actions/deploy-pages@v4

maltreanungkur avatar Feb 26 '25 10:02 maltreanungkur