I'm trying to use Gitlab Pages to automatically deploy my Hakyll blog, but I keep having problems with file encoding.
When building the pages, I get the following error:
[ERROR] /builds/jmite/hakyll/.stack/snapshots/x86_64-linux/lts-8.14/8.0.2/share/x86_64-linux-ghc-8.0.2/pandoc-citeproc-0.10.4.1/locales/locales-C-.xml: openBinaryFile: does not exist (No such file or directory)
My .gitlab-ci.yaml looks like this:
image: fpco/stack-build:lts-8.14
before_script:
- LC_ALL=en_CA.UTF-8
- LANG=en_CA.UTF-8
- apt-get update && apt-get install xz-utils make
- export STACK_ROOT=`pwd`/.stack
- stack setup
- stack install --only-dependencies
- stack build
build:
cache:
paths:
- _cache
- .stack
script:
- stack exec site build
except:
- master
pages:
cache:
paths:
- _cache
- .stack
script:
- stack exec site build
artifacts:
paths:
- public
only:
- master
I've tried adding locale information to my config:
- LC_ALL=en_CA.UTF-8
- LANG=en_CA.UTF-8
But then I get the following error:
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_CA.UTF-8)
[ERROR] ./templates/default.html: hGetContents: invalid argument (invalid byte sequence)
How can I fix this? Is there a way to (1) change the encoding on mo local machine, and push to GitLab, so that the files will match whatever Pandoc is expecting, or (2) to configure the GitLab CI to work with them how they're encoded now?
When I open the files in vscode it says they are UTF-8. Are there ways to get more information about the encoding that might be causing problems?
Related
I want to include a Mkdoc into my gitlab repository. I followed the instruction on Mkdoc, but the website is not showing up. The error message ist displayed on the screenshot below.
I included the .gitlab-ci.yml file in the root file. This is the content:
image: python:latest
pages:
stage: deploy
only:
- master
script:
- pip install mkdocs-material
- mkdocs build --site-dir public
artifacts:
paths:
- public
I also included the mkdocs.yml and the docs folder on root. Is there anything else I must do?
Due to certain suggestions received from different articles, we have decided to use the "npm ci" to install the node dependencies from package-lock.json file to avoid breaking changes instead of using the "npm install" script.
But after making this change in .gitlab-ci.yml file, the builds are taking much more time to get install the dependencies. It has been increased from 7 minutes to around 23 minutes.
As per the attached screenshot, it looks like taking more time in removing the existing node_modules folder before installation -
Below are some details from the script file -
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
stages:
- test and build
# - documentation-server
- deploy
variables:
GIT_STRATEGY: clone
# ELECTRON_SKIP_BINARY_DOWNLOAD: 1
build:library:
image: trion/ng-cli-karma
stage: test and build
only:
- master
- /^.*/#library_name
script:
- echo _auth=${NPM_TOKEN} >> .npmrc
- mkdir -p dist/core
- cd dist/core
- npm init -y
- cd ../..
- ls -al /hugo
- npm ci
Any help or suggestions would be really helpful to fix this issue.
I'm having a problem with Pylint on gitlab. For some reason, it crashes on the middle of the process of analysing the code..
But doesn't say nothing to me, only crashes..
Here are some log:
core/db/sql/pgsql/__init__.py:162:8: E1101: Instance of 'Session' has no 'close' member (no-member)
/core/db/sql/pgsql/__init__.py:165:4: C0116: Missing function or method docstring (missing-function-docstring)
/core/db/sql/pgsql/__init__.py:166:8: E1101: Instance of 'Session' has no 'commit' member (no-member)
/core/db/sql/pgsql/__init__.py:168:4: C0116: Missing function or method docstring (missing-function-docstring)
/core/db/sql/pgsql/__init__.py:169:8: E1101: Instance of 'Session' has no 'rollback' member (no-member)
/core/db/sql/pgsql/__init__.py:171:4: C0116: Missing function or method docstring (missing-function-docstring)
/core/db/sql/pgsql/__init__.py:174:4: C0116: Missing function or method docstring (missing-function-docstring)/bin/bash: line 98: 43 Segmentation fault (core dumped) pylint /
44 Done | tee ./pylint/pylint.log
The following messages were raised:
- fatal message issued
- error message issued
- refactor message issued
Fatal messages detected. Failing...
Running after_script
00:02
196
Uploading artifacts for failed job
00:02
198 ERROR: Job failed: exit code 1
Here are the .gitlab-cy.yml configuration file:
image: "python:3.8.5"
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
stages:
- Static Analysis
- Test
flake8:
stage: Static Analysis
script:
- flake8 project/
pylint:
stage: Static Analysis
script:
- mkdir ./pylint
- pylint project/ | tee ./pylint/pylint.log || pylint-exit $?
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
- anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
- echo "Pylint score is $PYLINT_SCORE"
artifacts:
paths:
- ./pylint/
coverage:
stage: Test
script:
- coverage erase
- $(coverage run -m unittest discover -s tests | tee cov.log || exit 0)
- coverage report -m
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
artifacts:
paths:
- ./pylint/
when: always
With this erros codes, I didn't find nothing on web..
And I have others projects on gitlab with the same configuration, and they run without any problem.
Does anyone already seen this?
Thanks!!
I do not see how are you executing the pylint. Please provide your gitlab-ci.yml file. But I had the very similar problem and I solved it by adding pylint-exit library:
pylint --disable=W0611,C0411,C0301 tests > ./pylint/tests.log || pylint-exit $?
I'm trying to restore from Azure Artefacts in CircleCI. I've been trying to piece together bits and pieces from artifacts-credprovider, including the Docker image example. My circle CI config looks like this:
version: 2.1
jobs:
build:
docker:
- image: mcr.microsoft.com/dotnet/core/sdk:3.1
working_directory: ~/repo
steps:
- checkout
- run:
name: Install Artifacts Credprov
command: |
wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
- run:
name: Restore Packages
command: dotnet restore
- run:
name: Build
command: dotnet build
workflows:
main:
jobs:
- build
In the CircleCI Project I've also set the following env vars:
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED-true
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS={"endpointCredentials": [{"endpoint":"https://pkgs.dev.azure.com/paulgrenyer0243/_packaging/paulgrenyer0243/nuget/v3/index.json", "username":"...", "password":"..."}]}
and when restoring this is the error I get:
#!/bin/bash -eo pipefail
dotnet restore
/usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/paulgrenyer0243/_packaging/paulgrenyer0243/nuget/v3/index.json. [/root/repo/NugetClient.csproj]
/usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Response status code does not indicate success: 401 (Unauthorized). [/root/repo/NugetClient.csproj]
Exited with code exit status 1
I'm assuming that either the env vars aren't being picked up, the env vars have the wrong values or I'm trying the wrong approach.
Does anyone have this working or can see what I'm doing wrong?
Restoring from Azure Artefacts in CircleCI
I agree with you. The dotnet restore task did not get the env vars from the CircleCI Project.
You could try to set the environment variable in a container, like:
version: 2.1
jobs:
build:
docker:
- image: mcr.microsoft.com/dotnet/core/sdk:3.1
environment:
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: {"endpointCredentials": [{"endpoint":"https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json", "username":"...", "password":"..."}]}
Then specify source during restoring package:
- run:
name: Restore Packages
command: dotnet restore -s "https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json"
You could check this document and this thread for some more details.
Hope this helps.
I use gitlab-ci to test, compile and deploy a small golang application but the problem is that the stages take longer than necessary because they have to fetch all of the dependencies every time.
How can I keep the golang dependencies between two stages (test and build)?
This is part of my current gitlab-ci config:
test:
stage: test
script:
# get dependencies
- go get github.com/foobar/...
- go get github.com/foobar2/...
# ...
- go tool vet -composites=false -shadow=true *.go
- go test -race $(go list ./... | grep -v /vendor/)
compile:
stage: build
script:
# getting the same dependencies again
- go get github.com/foobar/...
- go get github.com/foobar2/...
# ...
- go build -race -ldflags "-extldflags '-static'" -o foobar
artifacts:
paths:
- foobar
As mentioned by Yan Foto, you can only use paths that are within the project workspace. But you can move the $GOPATH to be inside your project, as suggested by extrawurst blog.
test:
image: golang:1.11
cache:
paths:
- .cache
script:
- mkdir -p .cache
- export GOPATH="$CI_PROJECT_DIR/.cache"
- make test
This is a pretty tricky task, as GitLab does not allow caching outside the project directory. A quick and dirty task would be to copy the contents of $GOPATH under some directory inside the project (say _GO), cache it and copy it upon each stage start back to $GOPATH:
after_script:
- cp -R $GOPATH ./_GO || :
before_script:
- cp -R _GO $GOPATH
cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
- _GO/
WARNING: This is just a (rather ugly) workaround and I haven't tested it myself. It should only exhibit a possible solution.