Automated Hugo deployments anywhere using Wercker

Hmm. It seems that even though I have version: 0.15 set in my wercker.yml, it’s trying to build with 0.16, which is breaking some stuff for us (that is, I see issues with the built site but I don’t see them locally where I haven’t updated hugo yet).

I looked at the logs, and it doesn’t seem like wercker is even looking at the version:

export WERCKER_STEP_ID="hugo-build-6d4ec50a-f111-4441-8359-594252fd3c1b"
export WERCKER_STEP_OWNER="arjen"
export WERCKER_STEP_NAME="hugo-build"
export WERCKER_REPORT_NUMBERS_FILE="/report/hugo-build-6d4ec50a-f111-4441-8359-594252fd3c1b/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/hugo-build-6d4ec50a-f111-4441-8359-594252fd3c1b/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/hugo-build-6d4ec50a-f111-4441-8359-594252fd3c1b/artifacts"
export WERCKER_HUGO_BUILD_THEME="devopsdays-responsive"
export WERCKER_HUGO_BUILD_CONFIG=""
export WERCKER_HUGO_BUILD_FLAGS="--buildDrafts=false"
export WERCKER_HUGO_BUILD_DEV_FLAGS=""
export WERCKER_HUGO_BUILD_PROD_BRANCHES=""
export WERCKER_HUGO_BUILD_FORCE_INSTALL="false"
export WERCKER_HUGO_BUILD_VERSION=""
export WERCKER_HUGO_BUILD_DEV_BRANCHES=""
export WERCKER_HUGO_BUILD_DISABLE_PYGMENTS="false"```

OK. So apparently the version needs to be in quotes. That seems to have fixed my issue :slight_smile:

OK, I am setting up a new site/build with Wercker (which now forces you into this “workflow” thingy.

Anyway, so here’s what I get with the build as output now:

Started building site
=============================================================
Your rendered home page is blank: /index.html is zero-length
 * Did you specify a theme on the command-line or in your
   "config.toml" file?  (Current theme: "grid-side")
 * For more debugging information, run "hugo -v"
=============================================================
0 draft content
0 future content
2641 pages created
1417 non-page files copied
0 paginator pages created
29 categories created
222 tags created
in 1420 ms

This is what my wercker.yml looks like:

build:
  steps:
    - arjen/hugo-build:
        theme: grid-side
        flags: --buildDrafts=false

deploy:
  steps:
    - script:
        name: Install packages
        code: |
          apt-get update
    - arjen/s3sync:
        key-id: $KEY
        key-secret: $SECRET
        bucket-url: s3://www-mattstratton-com
        source-dir: public

This all works fine locally - if I run hugo -v locally, it generates index.html, etc, properly.

Here’s a link to the entire output:

Aha. The problem is that the theme I was using was trying to be a submodule; I removed that reference and it seems to be building fine now.

I haven’t cloned in other themes before; they were always custom things I wrote, hence why this never happened to me before :slight_smile:

@mattstratton I’m glad to hear you worked out the issue :slight_smile:

Its my first post so i hope i dont ask it the wrong way ;=)
My Wercker is somehow working… but also not working. And i have no clue now why this is happening.

github.com/snapo/test.jans.li/blob/master/wercker.yml

is my wercker file… everything goes well and it deploy’s what i want to my gh-pages… The problem i have is if i add a new site it does not create the static pages in the public folder.

Do i have to execute (after the hugo build) a shell command in wercker or should this automatically be done in the hugo build?
I mean on wercker i dont wanna start a server (dont even know if thats allowed) so im asking the pro’s here how i tell hugo with wercker to generate all sites.

Thanks for a answer

*** EDIT ***
Did found the error… everything was correct, problem was that if a *.md article has twice the same content it does not get rendered by hugo. Was everything correct no error.

@ArjenSchwarz (or anyone else). For whatever reason, using the same Wercker file I always used before, I’m getting the following error in my S3 sync step:

ERROR: S3 error: 403 (InvalidAccessKeyId): The AWS Access Key Id you provided does not exist in our records.

Odd, since I have no issue updating directly from the command line…thoughts?

@rdwatters it sounds a lot like its an issue with the S3 credentials. Are you using the same access key from your local machine as you are from Wercker?

That was my first though, but I pulled the key and secret key directly from ~/.aws/credentials, deleted the old $AWS_KEY and $AWS_SECRET_KEY and recreated those variables under the environment tab in Wercker, and still no lucky, oddly.

The odd thing is that in my pipeline I have a build and deploy and even an after-steps for Slack. They all say the build is passing, and I get zero notifications for this error. However, under the deploy step for S3 Sync, I still get the following error starting at around line 40ish:

/pipeline/s3sync-88ff0694-9724-46a2-98fe-5e1b3f1adccb/s3cmd sync --add-header=Cache-Control:max-age=100 --delete-removed --verbose ./ s3://digital.cap.org
INFO: Compiling list of local files...
INFO: Running stat() and reading/calculating MD5 values on 242 files, this may take some time...
INFO: Retrieving list of remote files for s3://digital.cap.org/ ...
INFO: Forwarding request to us-east-1
ERROR: S3 error: 403 (InvalidAccessKeyId): The AWS Access Key Id you provided does not exist in our records.

finished s3 synchronisation

The public key that writes to the console in Wercker, btw, is accurate. Hmmmm…

@rdwatters that’s strange. Both that it still marks it as successful and that it fails on this in the first place.

Maybe it’s something in your wercker.yml file? I assume you haven’t made any changes to it, but we have to start somewhere. One of my sites where I use s3sync has the following configuration for it.

- arjen/s3sync:
    key_id: $AWS_ACCESS_KEY_ID
    key_secret: $AWS_SECRET_ACCESS_KEY
    bucket_url: $AWS_BUCKET_URL
    source_dir: public/
    opts: --cf-invalidate

You’re obviously using different values with $AWS_KEY and $AWS_SECRET_KEY, but they are still assigned correctly to key_id and key_secret?
The other difference here might be that I use my own version of s3sync, instead of the Wercker default one. This is because the Wercker one didn’t fail on errors, and my fork fixed that by using a newer version of the underlying command. I believe Wercker have since updated their version, so that shouldn’t be an issue anymore, but I kept using my fork because it worked so there was no point in changing it. You could try using my version, just in case that solves the not failing part.

Yes, it’s really odd that this error is only being thrown in the S3 Sync and that I don’t have any issues pushing the site to the bucket from the command line. Here is my wercker.yml:

box: golang
build:
  steps:
  - script:
    name: echo "Recursively moving all images to static images directory"
    code: |
      curdir=$(pwd)
      find ${curdir}/content \( -iname '*.jpg' -o -iname '*.png' -o -iname '*.gif' \) -type f -exec mv -v -- {} ${curdir}/source-images \;
  - arjen/hugo-build:
    version: "0.16"
    config: config.toml
    disable_pygments: false
  - script:
    name: echo "Moving json/index.html to assets/site-index.json"
    code: |
      currentdir=$(pwd)
      cp ${currentdir}/public/singles/index.html ${currentdir}/static/assets/site-index.json
deploy:
  steps:
  - arjen/s3sync:
    key-id: $AWS_KEY
    key-secret: $AWS_SECRET_KEY
    bucket-url: $AWS_BUCKET
    source_dir: public/
    delete-removed: true
    opts: --add-header=Cache-Control:max-age=100
  after-steps:
  - slack-notifier:
    url: $SLACK_URL
    channel: digital-cap-org
    username: werckerbot
    branch: master

I have $AWS_KEY assigned to aws_access_key_id in my /.aws/credentials and $AWS_SECRET_KEY assigned to aws_secret_access_key. Although slightly different than your config, $AWS_BUCKET is correctly assigned to AWS_BUCKET in my Wercker environment. Thanks for the feedback, @ArjenSchwarz!

##AS AN ASIDE…

I’m wondering if anyone has experience leveraging Wercker for image resizing using Gulp. I have this as part of my local build, but I’m not sure if I can add node and golang in a pipeline…

Ok, I have to think about what could be the problem here @rdwatters as nothing comes to mind right now. Although, I remember in the past that you had some issues with IP-based credentials. Is it possible that it’s related to that? It doesn’t match the error message, but that could be a bug in the error.

As for your aside, while I haven’t done it myself I can tell you that it’s possible. There are a couple of things that make this easier, both changes in Wercker and changes in the hugo-build step.

First, the hugo-build step now already includes the binaries for the latest 3 releases of Hugo, meaning that it can run from any container so you’re not limited to for example the golang one. It will always be only the latest 3, due to size limitations in the step, but that shouldn’t be a major issue.

Secondly, Wercker has made their environment more fluid. Meaning you can for example have multiple build pipelines that each use a different container and the contents (or rather, the contents of the $WERCKER_OUTPUT_DIR/$WERCKER_SOURCE_DIR) get passed along to the next pipeline just like it is between your build and deploy steps. So, in theory you can have a prepare-images pipeline using a node container, and then a build-hugo pipeline using a golang container. Their documentation about this can be found here.

Hi, I have problem with wercker that i cant seem to solve, I have build that utilizes gulp and I want to build my assets than use hugo to build the site which works fine but i cant seem to get my head around why does build task starts when deploy gets finished.

box: node

build:
  steps:
    - npm-install
    - hgen/gulp@0.1.3:
        tasks: build:prod
    - arjen/hugo-build:
        config: config.production.yaml
    - samueldebruyn/minify:
        css: false
        js: false
    - script:
        name: "gitignore"
        code: |-
          cp .deploy.gitignore .gitignore
deploy:
  steps:
    - install-packages:
        packages: git ssh-client
    - lukevivier/gh-pages@0.2.1:
        token: $GIT_TOKEN
        basedir: public

It does finish note that i don’t want build files in my gh-pages branch so i made inline script that changes .gitignore to the new one, and build does pass but when it finishes it automatically calls build on new branch how do i stop that ?

Here are the images they may help.

And best of all it does exactly what i need it to do but it fails it is really annoying any help would be much appreciated.

Here is the link to the gh-pages branch as you all can see no build files are carried over from master branch.

I just don’t want any builds running outside master branch and i cant seem to find out just how to do that.

Hi, I have a problem with wercker. My app failed at the step “hugo-build”, which displayed message like this

export WERCKER_STEP_ROOT="/pipeline/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4"
export WERCKER_STEP_ID="hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4"
export WERCKER_STEP_OWNER="arjen"
export WERCKER_STEP_NAME="hugo-build"
export WERCKER_REPORT_NUMBERS_FILE="/report/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/artifacts"
export WERCKER_HUGO_BUILD_THEME="academic"
export WERCKER_HUGO_BUILD_CONFIG=""
export WERCKER_HUGO_BUILD_DEV_FLAGS=""
export WERCKER_HUGO_BUILD_DEV_BRANCHES=""
export WERCKER_HUGO_BUILD_PROD_BRANCHES=""
export WERCKER_HUGO_BUILD_FORCE_INSTALL="false"
export WERCKER_HUGO_BUILD_INSTALL_PYGMENTS="false"
export WERCKER_HUGO_BUILD_VERSION="0.54"
export WERCKER_HUGO_BUILD_CLEAN_BEFORE="true"
export WERCKER_HUGO_BUILD_BASEDIR=""
export WERCKER_HUGO_BUILD_FLAGS="--buildDrafts=true"
source "/pipeline/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/run.sh" < /dev/null
Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:1 http://security-cdn.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
Get:6 http://security-cdn.debian.org/debian-security stretch/updates/main amd64 Packages [481 kB]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [7084 kB]
Fetched 7881 kB in 1s (4442 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  ca-certificates krb5-locales libcurl3 libffi6 libgmp10 libgnutls30
  libgssapi-krb5-2 libhogweed4 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3
  libkrb5support0 libldap-2.4-2 libldap-common libnghttp2-14 libp11-kit0
  libpsl5 librtmp1 libsasl2-2 libsasl2-modules libsasl2-modules-db libssh2-1
  libssl1.0.2 libssl1.1 libtasn1-6 libunistring0 openssl publicsuffix
Suggested packages:
  gnutls-bin krb5-doc krb5-user libsasl2-modules-gssapi-mit
  | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
  libsasl2-modules-sql
The following NEW packages will be installed:
  ca-certificates curl krb5-locales libcurl3 libffi6 libgmp10 libgnutls30
  libgssapi-krb5-2 libhogweed4 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3
  libkrb5support0 libldap-2.4-2 libldap-common libnghttp2-14 libp11-kit0
  libpsl5 librtmp1 libsasl2-2 libsasl2-modules libsasl2-modules-db libssh2-1
  libssl1.0.2 libssl1.1 libtasn1-6 libunistring0 openssl publicsuffix
0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded.
Need to get 7666 kB of archives.
After this operation, 19.8 MB of additional disk space will be used.
Get:1 http://security-cdn.debian.org/debian-security stretch/updates/main amd64 libssl1.0.2 amd64 1.0.2r-1~deb9u1 [1302 kB]
Get:2 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libssl1.1 amd64 1.1.0j-1~deb9u1 [1354 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 krb5-locales all 1.15-1+deb9u1 [93.8 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libgmp10 amd64 2:6.1.2+dfsg-1 [253 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libhogweed4 amd64 3.3-1+b2 [136 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libffi6 amd64 3.2.1-6 [20.4 kB]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libp11-kit0 amd64 0.23.3-2 [111 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libtasn1-6 amd64 4.10-1.1+deb9u1 [50.6 kB]
Get:9 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libgnutls30 amd64 3.5.8-5+deb9u4 [896 kB]
Get:10 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libkeyutils1 amd64 1.5.9-9 [12.4 kB]
Get:11 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libkrb5support0 amd64 1.15-1+deb9u1 [61.9 kB]
Get:12 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libk5crypto3 amd64 1.15-1+deb9u1 [119 kB]
Get:13 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libkrb5-3 amd64 1.15-1+deb9u1 [311 kB]
Get:14 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libgssapi-krb5-2 amd64 1.15-1+deb9u1 [155 kB]
Get:15 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libsasl2-modules-db amd64 2.1.27~101-g0780600+dfsg-3 [68.2 kB]
Get:16 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libsasl2-2 amd64 2.1.27~101-g0780600+dfsg-3 [105 kB]
Get:17 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libldap-common all 2.4.44+dfsg-5+deb9u2 [85.5 kB]
Get:18 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libldap-2.4-2 amd64 2.4.44+dfsg-5+deb9u2 [219 kB]
Get:19 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 openssl amd64 1.1.0j-1~deb9u1 [746 kB]
Get:20 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 ca-certificates all 20161130+nmu1+deb9u1 [182 kB]
Get:21 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libunistring0 amd64 0.9.6+really0.9.3-0.1 [279 kB]
Get:22 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libidn2-0 amd64 0.16-1+deb9u1 [60.7 kB]
Get:23 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libnghttp2-14 amd64 1.18.1-1 [79.1 kB]
Get:24 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libpsl5 amd64 0.17.0-3 [41.8 kB]
Get:25 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 librtmp1 amd64 2.4+20151223.gitfa8646d.1-1+b1 [60.4 kB]
Get:26 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libssh2-1 amd64 1.7.0-1 [138 kB]
Get:27 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libcurl3 amd64 7.52.1-5+deb9u9 [292 kB]
Get:28 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 curl amd64 7.52.1-5+deb9u9 [227 kB]
Get:29 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 libsasl2-modules amd64 2.1.27~101-g0780600+dfsg-3 [102 kB]
Get:30 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 publicsuffix all 20181003.1334-0+deb9u1 [104 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 7666 kB in 0s (11.1 MB/s)
Selecting previously unselected package libssl1.0.2:amd64.
(Reading database ... 6499 files and directories currently installed.)
Preparing to unpack .../00-libssl1.0.2_1.0.2r-1~deb9u1_amd64.deb ...
Unpacking libssl1.0.2:amd64 (1.0.2r-1~deb9u1) ...
Selecting previously unselected package libssl1.1:amd64.
Preparing to unpack .../01-libssl1.1_1.1.0j-1~deb9u1_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.0j-1~deb9u1) ...
Selecting previously unselected package krb5-locales.
Preparing to unpack .../02-krb5-locales_1.15-1+deb9u1_all.deb ...
Unpacking krb5-locales (1.15-1+deb9u1) ...
Selecting previously unselected package libgmp10:amd64.
Preparing to unpack .../03-libgmp10_2%3a6.1.2+dfsg-1_amd64.deb ...
Unpacking libgmp10:amd64 (2:6.1.2+dfsg-1) ...
Selecting previously unselected package libhogweed4:amd64.
Preparing to unpack .../04-libhogweed4_3.3-1+b2_amd64.deb ...
Unpacking libhogweed4:amd64 (3.3-1+b2) ...
Selecting previously unselected package libffi6:amd64.
Preparing to unpack .../05-libffi6_3.2.1-6_amd64.deb ...
Unpacking libffi6:amd64 (3.2.1-6) ...
Selecting previously unselected package libp11-kit0:amd64.
Preparing to unpack .../06-libp11-kit0_0.23.3-2_amd64.deb ...
Unpacking libp11-kit0:amd64 (0.23.3-2) ...
Selecting previously unselected package libtasn1-6:amd64.
Preparing to unpack .../07-libtasn1-6_4.10-1.1+deb9u1_amd64.deb ...
Unpacking libtasn1-6:amd64 (4.10-1.1+deb9u1) ...
Selecting previously unselected package libgnutls30:amd64.
Preparing to unpack .../08-libgnutls30_3.5.8-5+deb9u4_amd64.deb ...
Unpacking libgnutls30:amd64 (3.5.8-5+deb9u4) ...
Selecting previously unselected package libkeyutils1:amd64.
Preparing to unpack .../09-libkeyutils1_1.5.9-9_amd64.deb ...
Unpacking libkeyutils1:amd64 (1.5.9-9) ...
Selecting previously unselected package libkrb5support0:amd64.
Preparing to unpack .../10-libkrb5support0_1.15-1+deb9u1_amd64.deb ...
Unpacking libkrb5support0:amd64 (1.15-1+deb9u1) ...
Selecting previously unselected package libk5crypto3:amd64.
Preparing to unpack .../11-libk5crypto3_1.15-1+deb9u1_amd64.deb ...
Unpacking libk5crypto3:amd64 (1.15-1+deb9u1) ...
Selecting previously unselected package libkrb5-3:amd64.
Preparing to unpack .../12-libkrb5-3_1.15-1+deb9u1_amd64.deb ...
Unpacking libkrb5-3:amd64 (1.15-1+deb9u1) ...
Selecting previously unselected package libgssapi-krb5-2:amd64.
Preparing to unpack .../13-libgssapi-krb5-2_1.15-1+deb9u1_amd64.deb ...
Unpacking libgssapi-krb5-2:amd64 (1.15-1+deb9u1) ...
Selecting previously unselected package libsasl2-modules-db:amd64.
Preparing to unpack .../14-libsasl2-modules-db_2.1.27~101-g0780600+dfsg-3_amd64.deb ...
Unpacking libsasl2-modules-db:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package libsasl2-2:amd64.
Preparing to unpack .../15-libsasl2-2_2.1.27~101-g0780600+dfsg-3_amd64.deb ...
Unpacking libsasl2-2:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package libldap-common.
Preparing to unpack .../16-libldap-common_2.4.44+dfsg-5+deb9u2_all.deb ...
Unpacking libldap-common (2.4.44+dfsg-5+deb9u2) ...
Selecting previously unselected package libldap-2.4-2:amd64.
Preparing to unpack .../17-libldap-2.4-2_2.4.44+dfsg-5+deb9u2_amd64.deb ...
Unpacking libldap-2.4-2:amd64 (2.4.44+dfsg-5+deb9u2) ...
Selecting previously unselected package openssl.
Preparing to unpack .../18-openssl_1.1.0j-1~deb9u1_amd64.deb ...
Unpacking openssl (1.1.0j-1~deb9u1) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../19-ca-certificates_20161130+nmu1+deb9u1_all.deb ...
Unpacking ca-certificates (20161130+nmu1+deb9u1) ...
Selecting previously unselected package libunistring0:amd64.
Preparing to unpack .../20-libunistring0_0.9.6+really0.9.3-0.1_amd64.deb ...
Unpacking libunistring0:amd64 (0.9.6+really0.9.3-0.1) ...
Selecting previously unselected package libidn2-0:amd64.
Preparing to unpack .../21-libidn2-0_0.16-1+deb9u1_amd64.deb ...
Unpacking libidn2-0:amd64 (0.16-1+deb9u1) ...
Selecting previously unselected package libnghttp2-14:amd64.
Preparing to unpack .../22-libnghttp2-14_1.18.1-1_amd64.deb ...
Unpacking libnghttp2-14:amd64 (1.18.1-1) ...
Selecting previously unselected package libpsl5:amd64.
Preparing to unpack .../23-libpsl5_0.17.0-3_amd64.deb ...
Unpacking libpsl5:amd64 (0.17.0-3) ...
Selecting previously unselected package librtmp1:amd64.
Preparing to unpack .../24-librtmp1_2.4+20151223.gitfa8646d.1-1+b1_amd64.deb ...
Unpacking librtmp1:amd64 (2.4+20151223.gitfa8646d.1-1+b1) ...
Selecting previously unselected package libssh2-1:amd64.
Preparing to unpack .../25-libssh2-1_1.7.0-1_amd64.deb ...
Unpacking libssh2-1:amd64 (1.7.0-1) ...
Selecting previously unselected package libcurl3:amd64.
Preparing to unpack .../26-libcurl3_7.52.1-5+deb9u9_amd64.deb ...
Unpacking libcurl3:amd64 (7.52.1-5+deb9u9) ...
Selecting previously unselected package curl.
Preparing to unpack .../27-curl_7.52.1-5+deb9u9_amd64.deb ...
Unpacking curl (7.52.1-5+deb9u9) ...
Selecting previously unselected package libsasl2-modules:amd64.
Preparing to unpack .../28-libsasl2-modules_2.1.27~101-g0780600+dfsg-3_amd64.deb ...
Unpacking libsasl2-modules:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../29-publicsuffix_20181003.1334-0+deb9u1_all.deb ...
Unpacking publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libnghttp2-14:amd64 (1.18.1-1) ...
Setting up libldap-common (2.4.44+dfsg-5+deb9u2) ...
Setting up libsasl2-modules-db:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Setting up libsasl2-2:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Setting up libtasn1-6:amd64 (4.10-1.1+deb9u1) ...
Setting up libssl1.0.2:amd64 (1.0.2r-1~deb9u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libgmp10:amd64 (2:6.1.2+dfsg-1) ...
Setting up libssh2-1:amd64 (1.7.0-1) ...
Setting up krb5-locales (1.15-1+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up publicsuffix (20181003.1334-0+deb9u1) ...
Setting up libunistring0:amd64 (0.9.6+really0.9.3-0.1) ...
Setting up libssl1.1:amd64 (1.1.0j-1~deb9u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up openssl (1.1.0j-1~deb9u1) ...
Setting up libffi6:amd64 (3.2.1-6) ...
Setting up libkeyutils1:amd64 (1.5.9-9) ...
Setting up libsasl2-modules:amd64 (2.1.27~101-g0780600+dfsg-3) ...
Setting up ca-certificates (20161130+nmu1+deb9u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Updating certificates in /etc/ssl/certs...
151 added, 0 removed; done.
Setting up libidn2-0:amd64 (0.16-1+deb9u1) ...
Setting up libpsl5:amd64 (0.17.0-3) ...
Setting up libkrb5support0:amd64 (1.15-1+deb9u1) ...
Setting up libhogweed4:amd64 (3.3-1+b2) ...
Setting up libp11-kit0:amd64 (0.23.3-2) ...
Setting up libk5crypto3:amd64 (1.15-1+deb9u1) ...
Setting up libgnutls30:amd64 (3.5.8-5+deb9u4) ...
Setting up librtmp1:amd64 (2.4+20151223.gitfa8646d.1-1+b1) ...
Setting up libldap-2.4-2:amd64 (2.4.44+dfsg-5+deb9u2) ...
Setting up libkrb5-3:amd64 (1.15-1+deb9u1) ...
Setting up libgssapi-krb5-2:amd64 (1.15-1+deb9u1) ...
Setting up libcurl3:amd64 (7.52.1-5+deb9u9) ...
Setting up curl (7.52.1-5+deb9u9) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for ca-certificates (20161130+nmu1+deb9u1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Cleaning the public directory
Running the Hugo command
/pipeline/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/hugo --source=/pipeline/source/ --buildDrafts=true --theme=academic
/pipeline/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/run.sh: line 40: /pipeline/hugo-build-29762473-3fe8-4038-8d56-8d7e6f04edc4/hugo: No such file or directory

Here is my wercker.yml

box: debian
build:
  steps:
    - arjen/hugo-build:
        version: "0.54"
        theme: academic
        flags: --buildDrafts=true

Thanks for any help!

A quick look seems to indicate the problem is with the code in the Wercker step. It’s probably trying to download a wrong URL (the naming scheme for the files has changed a number of times over the years so it might be using an old one). Thanks for letting me know, and I’ll have a look soon (today/tomorrow) to get it fixed. I’ve created an issue in the GitHub repo about it at https://github.com/ArjenSchwarz/wercker-step-hugo-build/issues/49

@zhang-wenjun ah, actually I just realised what the problem is. With the latest release Hugo changed the release numbering style to always include the patch version as well. So you need to use version: "0.54.0" in your config (notice the extra .0 at the end there).

Thank you! The problem is solved! But when I add the deployment part, a new problem emerged, showing this.

export WERCKER_STEP_ROOT="/pipeline/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8"
export WERCKER_STEP_ID="gh-pages-92f91b52-f980-4468-99d7-e810aad479c8"
export WERCKER_STEP_OWNER="lukevivier"
export WERCKER_STEP_NAME="gh-pages"
export WERCKER_REPORT_NUMBERS_FILE="/report/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8/artifacts"
export WERCKER_GH_PAGES_DOMAIN="zhang-wenjun.github.io"
export WERCKER_GH_PAGES_BASEDIR="public"
export WERCKER_GH_PAGES_TOKEN="a5fe87c6200e308c6d803afa6bf212435666620e"
source "/pipeline/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8/run.sh" < /dev/null
using github repo "zhang-wenjun/homepage-academic-kickstart"
Initialized empty Git repository in /pipeline/source/public/.git/
[master (root-commit) 318ec89] deploy from zhang-wenjun
 42 files changed, 11236 insertions(+)
 create mode 100644 404.html
 create mode 100644 CNAME
 create mode 100644 author/admin/avatar.jpg
 create mode 100644 author/admin/avatar_hu52a603635ecebd45650b162dadabb4e5_12861_250x250_fill_q90_lanczos_center.jpg
 create mode 100644 author/admin/index.html
 create mode 100644 author/admin/index.xml
 create mode 100644 author/index.html
 create mode 100644 author/index.xml
 create mode 100644 authors/admin/index.html
 create mode 100644 authors/admin/index.xml
 create mode 100644 authors/index.html
 create mode 100644 authors/index.xml
 create mode 100644 authors/page/1/index.html
 create mode 100644 categories/index.html
 create mode 100644 categories/index.xml
 create mode 100644 categories/page/1/index.html
 create mode 100644 img/.gitkeep
 create mode 100644 img/icon-192.png
 create mode 100644 img/icon.png
 create mode 100644 index.html
 create mode 100644 index.json
 create mode 100644 index.xml
 create mode 100644 js/academic.min.d7381f2d79e6271d4da28f474f49096c.js
 create mode 100644 js/vendor/reveal.js/plugin/notes/notes.html
 create mode 100644 js/vendor/reveal.js/plugin/notes/notes.js
 create mode 100644 post/index.html
 create mode 100644 post/index.xml
 create mode 100644 post/page/1/index.html
 create mode 100644 publication/index.html
 create mode 100644 publication/index.xml
 create mode 100644 publication_types/index.html
 create mode 100644 publication_types/index.xml
 create mode 100644 publication_types/page/1/index.html
 create mode 100644 robots.txt
 create mode 100644 site.webmanifest
 create mode 100644 sitemap.xml
 create mode 100644 styles.css
 create mode 100644 tags/index.html
 create mode 100644 tags/index.xml
 create mode 100644 tags/page/1/index.html
 create mode 100644 talk/index.html
 create mode 100644 talk/index.xml
fatal: could not read Password for 'https://a5fe87c6200e308c6d803afa6bf212435666620e@github.com': No such device or address
/pipeline/gh-pages-92f91b52-f980-4468-99d7-e810aad479c8/run.sh: line 60: warning: command not found
failed: failed pushing to github pages

my new wercker.yml is here

box: debian
build:
  steps:
    - arjen/hugo-build:
        version: "0.54.0"
        theme: academic
        flags: --buildDrafts=true
deploy:
  steps:
    - install-packages:
        packages: git ssh-client
    - lukevivier/gh-pages@0.2.1:
        token: (my git token)
        domain: zhang-wenjun.github.io
        basedir: public 

this screenshot might help

Could you help me with this? Thank you so much!

I remember having trouble with that version of gh-pages. I don’t know if it was the same issue or something else, but I don’t think it supports the modern Wercker infrastructure.

    - pahnev/gh-pages@0.3.1:
        token: $GIT_TOKEN
        domain: zhang-wenjun.github.io
        basedir: public

Can you try the above instead? Also, for your own security I would recommend using a secret in Wercker instead of putting your actual git token in the config file. It’s pretty easy to do so in the UI, and then you can just use a variable like in my example to call it.

Thank you! I’ve successfully deploy the page to a ‘gh-page’ branch of this repository. But now I want to deploy it to the master branch of ‘zhang-wenjun.github.io’. When I was trying, it failed again.

export WERCKER_STEP_ROOT="/pipeline/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd"
export WERCKER_STEP_ID="gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd"
export WERCKER_STEP_OWNER="pahnev"
export WERCKER_STEP_NAME="gh-pages"
export WERCKER_REPORT_NUMBERS_FILE="/report/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd/artifacts"
export WERCKER_GH_PAGES_BASEDIR="public"
export WERCKER_GH_PAGES_BRANCH=""
export WERCKER_GH_PAGES_DOMAIN="zhang-wenjun.github.io"
export WERCKER_GH_PAGES_REPO="zhang-wenjun/zhang-wenjun.github.io"
export WERCKER_GH_PAGES_TOKEN="$GIT_TOKEN"
source "/pipeline/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd/run.sh" < /dev/null
Using 'zhang-wenjun/zhang-wenjun.github.io'
Using branch ''
Using 'public' as root dir instead of git root
Generating CNAME for 'zhang-wenjun.github.io'
Initialized empty Git repository in /pipeline/source/public/.git/
From https://github.com/zhang-wenjun/zhang-wenjun.github.io
 * [new branch]      master     -> origin/master
Branch master set up to track remote branch master from origin.
[master ce52880] Deploy from zhang-wenjun
 32 files changed, 1203 insertions(+), 275 deletions(-)
 create mode 100644 post/first/index.html
fatal: remote part of refspec is not a valid name in master:
/pipeline/gh-pages-40b3aeb9-7810-42a2-a45b-15083cb60dfd/run.sh: line 56: warning: command not found
failed: Failed deploying to Github Pages

my wercker.yml

box: debian
build:
  steps:
    - arjen/hugo-build:
        version: "0.54.0"
        theme: academic
        flags: --buildDrafts=true
deploy:
  steps:
    - install-packages:
        packages: git ssh-client
    - pahnev/gh-pages@0.3.1:
        token: $GIT_TOKEN
        repo: zhang-wenjun/zhang-wenjun.github.io
        domain: zhang-wenjun.github.io
        basedir: public

I’m so sorry for disturbing you so frequently, but could you help me with this again? I know nothing about this before. Thank you!

I’ve figured out this problem! I add one line “branch: master” and it works! Many thanks!! @ArjenSchwarz