pre-commit is failing with "Missing required key: rev" - pre-commit.com

I've been using the pre-commit tool for years! and it's worked great until recently when it started failing with a mysterious error message:
$ pre-commit run flake8 --all-files
An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='https://github.com/pre-commit/pre-commit-hooks')
=====> Missing required key: rev
Check the log at /home/asottile/.cache/pre-commit/pre-commit.log
how do I fix this?

your particular case has been warning since may of 2019:
$ pre-commit run flake8 --all-files
[WARNING] Unexpected key(s) present on https://github.com/pre-commit/pre-commit-hooks: sha
flake8...................................................................Passed
you can fix your case by running pre-commit migrate-config which will update sha to rev:
$ pre-commit migrate-config
Configuration has been migrated.
$ pre-commit run flake8 --all-files
flake8...................................................................Passed
disclaimer: I wrote pre-commit

Related

google cloud build: simple test file not found even though shows up with ls

Trying to run a simple bash script on google cloud build. Trying to run it it says it cannot find it, even though ls shows it is there
I've set up a build trigger on google cloud to run a simple test repository on pushes to main branch
The test repository has just two files: the cloudbuild yaml and a simple testfile.sh bash script
Cloudbuild yaml tells it to run this testfile.sh file, but says it cannot find it even though a simple ls arg shows it
I've tried like every combination of ways to run a bash file:
with/without '-c' argument
with/without '.' argument
with/without file shebang
cloudbuild.yaml:
steps:
- name: 'ubuntu'
entrypoint: 'bash'
args: ['-c', 'testfile.sh']
testfile.sh:
echo "Go suck it, world!"
gcloud builds log <log-id>:
starting build "640c5ba5-5906-4296-a80c-9adc54ee84bb"
FETCHSOURCE
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/test-wtf-2734586432/r/test-files
* branch 1d6fc0b27c09cb3421a242764dfe28bc115bf8f5 -> FETCH_HEAD
HEAD is now at 1d6fc0b Fix typo in entrypoint
BUILD
Pulling image: ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
Digest: sha256:adf73ca014822ad8237623d388cedf4d5346aa72c270c5acc01431cc93e18e2d
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
bash: testfile.sh: command not found
ERROR
ERROR: build step 0 "ubuntu" failed: step exited with non-zero status: 127
I fixed it
Had to get rid of the '-c' from the args list

How to deal with Error 0 in CakePHP Unit Testing?

Whilst trying to access my unit tests through the browser I encountered an error '0'. (See full error below). My cake application is inside a docker container, with another docker container running alongside it to run the database.
I checked the test.php file and the phpunit.phar and phpunit.php files, but cannot uncover any cause for the error. I've also tried to set up a test database, and I'm not sure if that might be causing the error.
0
phar "/var/www/<app_name>/app/Vendor/phpunit.phar" SHA1 signature could not be verified: broken signature
I should be able to see a list of all the core tests that I have available.
Trying replacing your phpunit.phar file with an updated version. It might be corrupted.
➜ wget -O phpunit https://phar.phpunit.de/phpunit-8.phar
➜ chmod +x phpunit
➜ ./phpunit --version

Appveyor build failure

I am creating a build with Appveyor on Github use devtool https://github.com/atom/atom-keymap. Although Travis builds success, Appveyor builds still appear error!
I do not know real root cause, but I think I can help with a way to troubleshoot this. Basically you can connect to AppVeyor VM via RDP and debug it. Here are the steps:
Insert - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) before - npm run ci in your appveyor.yml file.
In RDP run the following:
cd c:\projects\atom-keymap
npm run compile
npm run lint
This will bring you to the state to get a repro and debug (because npm run ci is npm run compile && npm run lint && npm run test).
To get a repro npm run test.
To debug the problem, do something like this:
devtool --console node_modules/mocha/bin/_mocha --colors spec/helpers/setup.js spec/* --break
(this will let you debug step-by-step)
or
devtool --console node_modules/mocha/bin/_mocha --colors spec/helpers/setup.js spec/* --watch
(this will let you see a lot of error details)
This is the same what npm run test does, but without switch to quit on error and with debug options.
I went this route myself till this point but my limited knowledge of this npm module did not let me to dig till the root cause.

Docker automated build results in Unexpected failure

I am trying to create an automated build with docker. What I have done is linked my bit-bucket repo in the docker hub and trying to build. The status of build is unexpected failure. Also, I see the below failure message:
{"error": "Image depends on an unauthorized parent"}
And interestingly, the logs says build successful.
Failure message
[Failure instance: Traceback: <type 'exceptions.RuntimeError'>: HTTP code 400 while uploading metadata: {"error": "Image depends on an unauthorized parent"}
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:382:callback
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:490:_startRunCallbacks
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:577:_runCallbacks
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:1155:gotResult
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:1097:_inlineCallbacks
/usr/local/lib/python2.7/dist- packages/twisted/python/failure.py:389:throwExceptionIntoGenerator
/app/builder.py:160:execute_job
/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py:577:_runCallbacks
/app/shared/tx/docker.py:295:on_done
]
Dockerfile
FROM ubuntu
# make sure the package repository is up to date
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get install -y x11vnc xvfb firefox
RUN mkdir /.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
EXPOSE 5900
CMD ["x11vnc", "-forever", "-usepw", "-create"]
Logs
Step 0 : FROM ubuntu
Pulling image (quantal) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/ e314931015bd
....
....
Removing intermediate container c8e48d27a271
Step 8 : CMD ["x11vnc", "-forever", "-usepw", "-create"]
---> Running in d9319762cb0f
---> bd7eb37a7f78
Removing intermediate container d9319762cb0f
Successfully built bd7eb37a7f78
Update: The issue was fixed.
I just got an answer from the Docker support team. It's an issue on their side, which they are already investigating.
Unfortunately there isn't much you can do besides waiting.

WSO2 Endpoint look-up sample

I am trying to set up the WSO2 Endpoint look-up sample. I have made the changes according to the documentation, but when I try to build the app using "mvn clean install" I am receiving the following error:
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/eclipse/vali
dateutility/0.95/validateutility-0.95.pom
[WARNING] Checksum validation failed, expected 53f8bac71524372a3d51a6ecf11365042
96f37af but is 8edc83998e0bf2a8867395883f3853eb901be267 for http://maven.wso2.or
g/nexus/content/groups/wso2-public/eclipse/validateutility/0.95/validateutility-
0.95.pom
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/eclipse/
osgi/org.eclipse.osgi.services/3.2.0.v20090520-1800/org.eclipse.osgi.services-3.
2.0.v20090520-1800.pom
[WARNING] Checksum validation failed, expected <!DOCTYPE but is 8edc83998e0bf2a8
867395883f3853eb901be267 for http://maven.wso2.org/nexus/content/groups/wso2-pub
lic/org/eclipse/osgi/org.eclipse.osgi.services/3.2.0.v20090520-1800/org.eclipse.
osgi.services-3.2.0.v20090520-1800.pom
The checksums are failing. Does someone need to update the files in the repository?
I managed to get the handler sample to build by:
1) Checkout the Greg 4.5.3 Source Code:
svn co https://svn.wso2.org/repos/wso2/carbon/platform/tags/4.0.5/products/greg/4.5.3/ wso2_greg_453
2) Build the source:
cd wso2_greg_453
mvn clean install -Dmaven.test.skip=true
I had a build failure due to maven issues cleaning up surefire reports, which I ignored.
3) Build the handler sample in the directory I unzipped the binary version of GREG to:
cd %CARBON_HOME%
wso2greg-4.5.3\samples\handler\src
mvn clean install
This time the handler sample built ok.
The approach above is a bit long winded, but it works!