gp-pages deploy fails when run from GitHub Action: Author identity unknown

I’m calling gh-pages from a GitHub Action, and at the point when gh-pages is called by the Action, it fails with this error:

> gh-pages -d build

Author identity unknown

*** Please tell me who you are.

Following this recommendation on a similar posted issue, I updated the ‘npm run build’ script in my package.json to pass the -u option with the github-actions-bot userid:

    "deploy": "gh-pages -d build -u 'github-actions-bot <support+actions@github.com>'",

After adding this and re-running, now I have a different error:

> gh-pages -d build -u 'github-actions-bot <support+actions@github.com>'

fatal: could not read Username for 'https://github.com': No such device or address

Apparently to allow the Action to use actions/checkout to access your repo you must use a Personal Token per additional instructions here.

To create a new access token, access your account settings, then Developer Settings:

To add the token value as a secret to your project, add a new secret via settings on the repo that your Action is accessing:

After paying more attention to the Action log, the checkout step was actually working and completing as expected, it was the ‘npm run deploy’ step that was failing with same error as shown in the linked post above. Following the same advice to use the access token to resolve the ‘Could not read username’ error, I updated the ci.yml again to add the reference to the token as part of setting the remote repo url:

- name: Deploy
  env:
    MY_EMAIL: kevin.hooke@gmail.com
    MY_NAME: kevinhooke
  run: |
    git config --global user.email $MY_EMAIL
    git config --global user.name $MY_NAME
    git remote set-url origin https://$MY_NAME:${{ secrets.GH_SECRET }}@github.com/kevinhooke/my-example-project.git
    npm run deploy
  • the git config steps set the git user’s email and name properties within the context of the Github Action
  • the ‘git remote set-url’ specifies the repo url including my userid and the Personal Access Token retrieved from the GitHub Secret.

Problem solved, now the action works as expected and publishes this project’s GitHub pages on every commit!

Running GitLab in a Docker container on a different port

Gitlab by default runs on port 80. GitLab in a Docker container runs the same as a when natively installed, but to change the port you need to change the config, and change the exposed ports on the container.

First, per steps here, start the container with:

docker run --detach \	
--hostname gitlab.example.com \
--publish host-https-port:container-https-port
--publish host-http-port:container-http-port
--publish 22:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

By default host-http-port and container-http-port are 80, and host-https-port container-https-port are 443. Change these to be whatever port you want to run on, but keep each pair the same (e.g. host-http-port and container-http-port = 8090)

When the container is up, start a shell into the running container:

docker exec -it containerid sh

and then edit the config file:

vi /etc/gitlab/gitlab.rb

and add line (at the top is ok):

external_url 'http://localhost:your-new-port-here

setting your-new-port-here to the new port.

Reconfigure the server:

gitlab-ctl reconfigure
gitlab-ctl restart

Done!

GitLab CI Runner artifacts size error: “too large archive”

As part of putting together a GitLab CI pipeline to build a Python deployment for an AWS Lambda, I ran into an issue with the size of the build dir that I’m zipping up ready for deployment:

Uploading artifacts...
./build: found 2543 matching files 
ERROR: Uploading artifacts to coordinator... too large archive id=181 responseStatus=413 Request Entity Too Large status=413 Request Entity Too Large token=rtRUzgtp
FATAL: Too large

Hmm. Ok. A quick search found this post which says there’s a setting to increase the max build artifact size – it’s under /admin/application_settings, in the Continuous Integration setting – looks like the default is 100MB, so let’s bump that up and try again:

Setting up a new shared GitLab runner

Assuming you already have a runner installed (follow steps here).

Navigate to the [your-gitlab]/admin/runners page and scroll down to “How to setup a shared Runner for a new project” section – copy the server url and registration token for the next section.

On the machine where you want to the runner to execute, run

sudo gitlab-runner register

when prompted, enter the url and token.

For info on available executors see here.