How to fix "Upload artifacts failure"? laravel/CI - laravel

I encountered this error below, shown from our CI logs. I'm confused about which is causing this since there are two errors shown consecutively. 
My colleague suspected this was caused by the previous build files. I tried to update the expires_in to 1 day, hoping it would clear the previous one, but it seems it doesn't have any effect.
As of now, I'm trying to look for examples of how to delete the previous build before executing the script, but I can't find any references to it. Does anybody have any suggestions on how to fix this one?
// <----------- tests were all passed
Tests:
207 passed
Time:
444.37s
// <----------- first error shown
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in ....
// <----------- and this error shown at the bottom part
Uploading artifacts
WARNING
Path coverage does not exist
WARNING
Path ./report.xml does not exist
FATAL
Error creating artifact: All paths are empty
Job failed with exit code 255
jobs:
- name: PHP Unit Test
stage: test
image: sunasp4/php-workspace:7.4
workspace: shared
before_script:
- php artisan optimize:clear
script:
- php artisan test --coverage-clover ./report.xml --coverage-html=coverage
only:
events:
- pull_request
coverage:
type: clover
path: ./report.xml
artifacts:
paths:
- coverage
expires_in: 2 days

Related

Storing Artifacts From a Failed Build

I am running some screen diffing tests in one of my Cloud Build steps. The tests produce png files that I would like to view after the build, but it appears to upload artifacts on successful builds.
If my test fail, the process exits with a non-zero code, which results in this error:
ERROR: build step 0 "gcr.io/k8s-skaffold/skaffold" failed: step exited with non-zero status: 1
Which further results in another error
ERROR: (gcloud.builds.submit) build a22d1ab5-c996-49fe-a782-a74481ad5c2a completed with status "FAILURE"
And no artifacts get uploaded.
I added || true after my tests, so it exits successfully, and the artifacts get uploaded.
I want to:
A) Confirm that this behavior is expected
B) Know if there is a way to upload artifacts even if a step fails
Edit:
Here is my cloudbuild.yaml
options:
machineType: 'N1_HIGHCPU_32'
timeout: 3000s
steps:
- name: 'gcr.io/k8s-skaffold/skaffold'
env:
- 'CLOUD_BUILD=1'
entrypoint: bash
args:
- -x # print commands as they are being executed
- -c # run the following command...
- build/test/smoke/smoke-test.sh
artifacts:
objects:
location: 'gs://cloudbuild-artifacts/$BUILD_ID'
paths: [
'/workspace/build/test/cypress/screenshots/*.png'
]
Google Cloud Build doesn't allow us to upload artifacts (or run some steps ) if a build step fails. This is the expected behavior.
There is an already feature request created in Public Issue Tracker to allow us to run some steps even though the build has finished or failed. Please feel free to star it to get all the related updates on this issue.
A workaround per now is as you mentioned using || true after the tests or use || exit 0 as mentioned in this Github issue.

GitLab CI Error: Uploading artifacts to coordinator - failed - responseStatus 400 Bad Request

I'm working with GitLab (free edition) pipelines and started receiving the error below on a pipeline that was working.
This is a minimal example from my .gitlab-ci.yml that reproduce the error (Although I don't think it is related to my code):
default:
image: node:10-alpine
stages:
- build
build:
stage: build
script:
- npm install
artifacts:
paths:
- node_modules/
only:
- Staging
.
.
.
Error's log:
64 packages are looking for funding
run `npm fund` for details
Running after_script
Saving cache
Uploading artifacts for successful job
Uploading artifacts...
node_modules/: found 62788 matching files
WARNING: Uploading artifacts to coordinator... failed id=512111 responseStatus=400 Bad Request status=400 Bad Request token=4Dwaaa
WARNING: Retrying... context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=512111 responseStatus=400 Bad Request status=400 Bad Request token=4Dwaaa
WARNING: Retrying... context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=512111 responseStatus=400 Bad Request status=400 Bad Request token=4Dwaaa
FATAL: invalid argument
ERROR: Job failed: exit code 1
Found this thread in Stackoverfow but it is related to different status error.
There are multiple threads (1 , 2 , 3 ) on this issue on Gitlab forum but it is hard to understand the cause of the problem and how to resolve it.
Any help will be highly appriciated.

How to pass an exit code from custom testing framework to CircleCI in order to fail the step if necessary

I created the automated testing plugin for Godot named WAT. It has a command line interface that outputs 0 (success) or 1 (failure) on the last line when run.
I'm looking for a way to pass that number onto CircleCI so that the step fails if it was 1.
I'm working in a bash environment with the following config.yml
version: 2
jobs:
build:
docker:
- image: barichello/godot-ci:3.1.1
steps:
- checkout
- run:
name: Run Tests
command: godot -s addons/WAT/CLI.gd -run_all
You can set OS.exit_code to a non-zero number and the step should fail.
If that is not acceptable, you can parse your output and fail manually from Bash with exit 1.

CircleCI API behaving differently from github commit trigger?

I'm running the cypress-example-kitchen sink app on CircleCI.
This is my yaml config script:
version: 2.1
orbs:
cypress: cypress-io/cypress#1.0.1
workflows:
build:
jobs:
- cypress/install:
build: 'npm run build'
- cypress/run:
requires:
- cypress/install
start: 'npm start'
This kicks off and passes just fine when I make a commit to my fork of the repo above.
However, when I try to execute a CircleCI build programmatically, using
curl -X POST https://circleci.com/api/v1.1/project/github/Atticus29/cypress-example-kitchensink?circle-token=myApiToken, the build fails and the jobs dashboard on CircleCI tells me that something is wrong with my config file:
6 schema violations found required key [jobs] not found workflows:
5 schema violations found
workflows: minimum size: [2], found: 1
workflows: build: jobs: 4 schema violations found
workflows: build: jobs: 0: 0 subschemas matched instead of one
workflows: build: jobs: 0: expected type: String, found: Mapping
workflows: build: jobs: 0: install: extraneous key [build] is not permitted
workflows: build: jobs: 1: 0 subschemas matched instead of one
workflows: build: jobs: 1: expected type: String, found: Mapping
workflows: build: jobs: 1: run: extraneous key [start] is not permitted
And that something went wrong with my build:
Build-agent version 0.1.1216-48f80d08 (2018-12-07T16:01:40+0000)
Configuration errors: 2 errors occurred:
Configuration version 2.1 requires the "Enable Build Processing" project setting. Enable Build Processing under Project Settings ->
Advanced Settings. In order to retrigger build processing, you must
push a new commit.
Cannot find a job named build to run in the jobs: section of your configuration file. If you expected a workflow to run, check your
config contains a top-level key called 'workflows:'
I can confirm that Enable Build Processing is on.
None of these were problems when I ran the build in the usual way. Any advice?
Circle CI for some reason keeps on assuming that the projects are not set up for v2.0 despite config.yml being called the right thing and living in the right place in the repo. After a few commits, this issue seems to go away?
I ended up running a build programmatically with the following script:
#!/bin/bash
PERSONAL_TOKEN=myPersonalTokenHere
MOST_RECENT_BUILD=`curl -s "https://circleci.com/api/v1.1/recent-builds?circle-token=$PERSONAL_TOKEN&limit=1"| grep 'build_num'|grep -o '\d.'|sed 's/,//g'|sort -r -n|head -n1`
curl -X POST "https://circleci.com/api/v1.1/project/github/holmbergius/wildMeCypress/$MOST_RECENT_BUILD/retry?circle-token=$PERSONAL_TOKEN"

.gitlab-ci.yml Syntax Error

I'm working with the following .gitlab-ci.yml config:
image: node:latest
stages:
- build
- test
build:
stage: build
script:
- npm install
test:
stage: test
script:
- ./testing/test.js
When pushing to GitLab, i get a 'Your pipeline as failed' error and when i look at what failed, its a yaml error:
Status: syntax is incorrect
Error: (<unknown>): did not find expected key while parsing a block mapping
at line 1 column 1
As far as i can see, the image: node:latest is correct. Any help with this would be great.
The problem is the indentation of you test job. That problem is making your whole yml to break therefore raising the error on line 1. Just remove the excessive whitespaces like the code below and it will be fine.
image: node:latest
stages:
- build
- test
build:
stage: build
script:
- npm install
test:
stage: test
script:
- ./testing/test.js
Note that in YAML the indentation is used to denote the structure. So it is important to pay attention to it.

Resources