gcloud functions deploy fails with .cloudignore file - google-cloud-platform

When deploying a simple hello_world app to Google Cloud Functions using gcloud, I get the following error message:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Build error details not available
It took me quite a while to figure out that this is due to my .cloudignore file:
.cloudignore
# Ignore everything
*
# Except these files:
!main.py
!requirements.txt
What seems to be the problem with this file? And what is a better way achieve what I want, i.e. ignore all files except main.py and requirements.txt?
Any hints are greatly appreciated!

The .gcloudignore file follows the same pattern as the .gitignore. Considering that, using only the *, could ended up being a recursively method that would ended up messing the other files that would be excepted.
Considering that, I would recommend you to give a try using the below configuration for your .gcloudignore file - this way, the slash should eliminate this undesired behavior:
# Ignore everything
/*
# Except these files:
!main.py
!requirements.txt
A reminder is that the file needs to be in the same directory that the main.py and requirements.txt file are, so the path works correctly. Otherwise, you will need to set the whole path in the .gcloudignore.
In these below posts from the Community - on specific regarding GCP and other on .gitignore - that might help you, since the syntax for both of them are the same and there are some other options and ideas on how to achieve it.
How to ignore files when running gcloud app deploy?
Make .gitignore ignore everything except a few files
Let me know if the information helped you!

It seems that there's a bug with gcloud functions handling of .gitignore; gcloud app and gcloud meta list-files-for-upload don't suffer from the same problem, handling the ! rules correctly.
A workaround proposed in this answer to a similar question works for me, explicitly include the . directory e.g. add a rule like this.
!.

Related

Django:Run pylint on all the apps in one go

I want to run pylint recursively on all my project apps from the root of the app. If i use : pylint . on the root of the project base, it gives me the error that there is no init.
How can I run the pylint from my project root without having to specify all the apps one by one.
EDIT
Thank you heartily for the downvotes. But since I am a novice at that and still couldnt find a solution to my issue, can the downvoters please explain or the give the oh-so-obvious solution? If this is how pylint is designed to be called recursively on each app, then can you point me to the documentation?
So by default the pylint is requires the module name or the file name to be linted to be provided to it as args and it does not automatically recursively search from the pwd. It would however lint every python file in a module if a module name is provided.
In order to run the pylint without the hassle of having to maintain the apps, I am using :
PyCQA/prospector

Dart2JS Pub Build Fails to Traverse Project Folders Correctly

I'm working on a long-term project for some time now. After moving some folders around, correctly refactoring different parts of the code, Webstorm's Dart analyser is showing NO errors, but running either pub serve or pub build fails.
Pub or Dart2JS doesn't seems to be traversing folders correctly.
This is the first error I get:
[Error from Dart2JS on CS_Game_Engine|web/main.dart]:
web/UIElements/NodeSettingsItems/TextVariableEditor.dart:4:1:
Can't read 'file:///Data/ownCloud/cybersecgame/CS%20Game%20Engine/web/UIElements/Data/Variables/Variable.dart' (Could not find asset CS_Game_Engine|web/UIElements/Data/Variables/Variable.dart.).
import '../../Data/Variables/Variable.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is interesting, because the file TextVariableEditor.dart, as you see in the error, is located in the web/UIElements/NodeSettingsItems/ directory.
The file I am trying to access (Variables.dart) is located in web/Data/Variables/Variable.dart.
The import statement moves 2 folders up with the ../../, but Pub or Dart2JS is not going 2 folders up, its only going 1 folder up. See the error again:
Can't read 'file:///Data/ownCloud/cybersecgame/CS%20Game%20Engine/web/UIElements/Data/Variables/Variable.dart'
It's looking for the file in the wrong place. I'm not sure what to do to fix this, and I've looked around and can't really find anything. Again, Webstorm's Dart Analyzer shows no issues, but the pub build or pub serve both fail, unable to find the file.
I've used the ../../ many times before in my code, but this is the first time it is causing issues. There are other errors similar to this, but having the same issue of not reading the ../../ correctly.
Update 1:
I've done more testing, and adding an additional ../ to the path's beginning fixes the error during the pub build. However, now Webstorm and it's Dart Analyzer is showing lots of errors since the path is obviously wrong (1 too many ../). This is a workaround, but not a fix. Does anybody know why pub or the Dart2JS is reading the path incorrectly? Somehow skipping one of the ../?
Code within the web directory should only access files in two places:
Things in the web directory, via relative paths
Things in packages via package: imports
#2 is interesting. This can include files within your own project, you just need to put those files in the lib directory and access them via a package:my_proj URI.
See https://github.com/dart-lang/sample-pop_pop_win/ as an example
See also https://www.dartlang.org/tools/pub/package-layout

ls: reading directory ./: Input/output error via S3FS

I have a bucket with more than ten thousand files. I am getting the following error while doing 'ls -l' folder but working fine for less than 1000 files in the folder. Any suggestions?
ls: reading directory ./: Input/output error
I notice that each listing of a file in folder makes an http call to S3, any chance this # can be increased?
Thanks!
I would like to recommend to take a look at the new project RioFS (Userspace S3 filesystem): https://github.com/skoobe/riofs.
This project is “s3fs” alternative, the main advantages comparing to “s3fs” are: simplicity, the speed of operations and bugs-free code. Currently the project is in the “testing” state, but it's been running on several high-loaded fileservers for quite some time.
We are seeking for more people to join our project and help with the testing. From our side we offer quick bugs fix and will listen to your requests to add new features.
RioFS should work fine with such great number of files per directory, but please try to increase the directory caching timeout in the configuration file (see dir_cache_max_time description in riofs.conf.xml)
Hope it helps you and we are looking forward to seeing you joined our community !

TeamCity Artifacts; Exclude Individual Files

I have a TeamCity Build Configuration that includes the following to publish artifacts:
Source\Builder\bin\Release\*.dll=>release
This works fine, however I am wanting to exclude one dll (there are quite a few) and have read that you can use + & - operators to do this. Something along the lines of:
+: Source\Builder\bin\Release\*.dll=>release
-: Source\Builder\bin\Release\Builder.*
As soon as I add these in, no artifacts are published and I get the following error in the build log (looks like it is counting the + as part of the path):
[Publishing artifacts] Collecting files to publish [+:Source\Builder\bin\Release\*.dll=>release]
[Publishing artifacts] Artifacts path +:Source/Builder/bin/Release/*.dll not found
I am using version 7.1.1, anyone any ideas (I am not sure whether these operators are even valid). I have seen a solution with MSBuild but am surprised this functionality is not available.
Thanks in advance.
I don't believe you can.
However, if you are using the artifacts in another build configuration as an artifact dependency, you can exclude a particular file there.
When you set up the dependencies, you can specify a negative operator like this:
+:release/**=>Dependencies/SomeProject
-:release/SomeBinary.dll
It is a horrible hack, but one way you could get it to work would be to set up a new build configuration which gets the dependencies as an artifact dependency, excluding the one binary, and then publishes its own artifacts.
As in, create a new build configuration and publish:
Dependencies/SomeProject=>release
Then reference the artifacts from this build configuration instead of the other one.
A little bit late for the party, but there is still no fix...
I ended up adding a last build step to the project. It is command line > custom script. Then I used this commands to remove the files that I didn't want in the artifacts. This runs just before artifacts collection.
del /S /Q "src\apps\*.xml"
del /S /Q "src\apps\*.pdb"
Explanation for del command
/S Delete from all Subfolders (DELTREE)
/Q Quiet mode, do not give a Yes/No Prompt before deleting
* Match any characters
Our current options are to vote for this feature request at
http://youtrack.jetbrains.com/issue/TW-5244 and fail back to workarounds.
TeamCity artifact paths combine folders question hints that the same target folder can be reused for multiple path patterns.
TeamCity docs also state that
TeamCity will create directories starting from the first occurrence of
the wildcard in the pattern.
So in many cases it's possible to inverse exclusion problem to multiple inclusions.
For example, instead of lurking how to exclude -:**/.svn from my templates I was able just to filter them by extension:
templates/**/*.vm => templates
templates/**/*.xsl => templates

How to have Jenkins ignore certain files when checking for change?

In the "Excluded Regions" of the CVS configuration, I have added the following:
.*/.*/.*\.d
.*/.*/.*\.o
.*/.*/.*\.so
.*/.*/.*\.a
.*/.*/.*\.exe
.*/.*/.*\.obj
.*/.*/.*\.dll
.*/.*/.*\.lib
.*/.*/.*\.txt
.*/.*/.*\.tar
.*/.*/.*\.tar\.gz
All files with the above extensions should be ignored. However, Jenkins still runs builds based on the fact that a file "build.txt" in some folder ABC has changed, or the one of the tar.gz files has changed. How to get Jenkins to ignore these files? Is something wrong with my regex?
Glad that worked for you! Reposting as requested:
My guess is it has to do with the .*/ parts. Have you tried it with just .*\.txt?
Just as an experiment, you might also try /.*/.*/.*\.txt (note the extra / at the beginning). I have a feeling the problem was related to using relative vs. absolute file paths.