How to build with travis-ci, with no actual code build? (deploy static code to s3) - amazon-s3

I'm using the directions provided here to try and deploy static code from a github push to an s3 bucket. The problem is on a build I get the following errors:
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/travis/.rvm/gems/ruby-2.4.1#global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
The command "rake" exited with 1.
It seems since I don't have a language set that I am defaulting to ruby and it is trying to build with a makefile. Thing is: I don't have any code to build. I don't need to do anything in any language. Just upload the code to S3. So is there a way to not run an actual build and have this work?
My .travis.yml looks like:
deploy:
provider: s3
access_key_id: myaccesskey
secret_access_key:
secure: myverylongsecurysecretkey
bucket: searchlist.org
acl: public_read
on:
repo: myuser/myrepo

For historical reasons, Travis CI assumes your build is a Ruby app/lib. If your repo requires something else, you need to override these defaults.
Either
language: generic # no-frills build
⋮
or
# Ruby, but override default steps
install: skip
script: skip
⋮

Related

CodeDeploy not properly copying code from GitHub

I have CodeDeploy pull code from my GitHub repo. In the deployment Commit ID (for GitHub) I have specified the Commit ID that I want to deploy. My repo has the following structure:
my-service/
README.md
.gitignore
scripts/
deploy.sh
src/
<lots of code here>
pm2.dev.json
appspec.yml
My appspec.yml file looks like:
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
hooks:
BeforeInstall:
- location: scripts/deploy.sh
timeout: 300
runas: root
My scripts/deploy.sh looks like:
sudo npm install pm2 -g
pwd
pm2 start /home/ubuntu/my-service/pm2.dev.json
When I run the CodeDeployment deployment for this, it fails with the following error:
Script at specified location: scripts/deploy.sh run as user root failed with exit code 1
When I look at the logs I see:
LifecycleEvent - BeforeInstall
Script - scripts/deploy.sh
[stderr]npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
[stdout]changed 182 packages, and audited 183 packages in 8s
[stdout]
[stdout]12 packages are looking for funding
[stdout] run `npm fund` for details
[stdout]
[stdout]found 0 vulnerabilities
[stdout]/opt/codedeploy-agent
[stderr][PM2][ERROR] File /home/ubuntu/my-service/pm2.dev.json not found
Sure enough when I look in /home/ubuntu/my-service, I do not see a pm2.dev.json file, because this server had been manually configured several weeks ago before a pm2.dev.json file was added to the project. I would have expected CodeDeploy to have written whats in the repo to the server under /home/ubuntu.
Can anyone spot anything wrong with my appspec.yml or other configuration? Could it be a bad GitHub setup?
Had to change BeforeInstall to Install.
BeforeInstall runs before it copies over the source code (specified under files/source). But Install run just after that copy occurs, hence files will be available on the file system.

Travis pr failed, push passed

The branch was previously functional, then merged to master and the builds on master failed. Master was reverted, then master was merged into this branch and some fixes were made. When attempting to merge back to master, the build failed again with the following error. The push passed, the pr failed.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.squareup.leakcanary:leakcanary-android:1.5.4.
The travis.yml file:
sudo: false
language: android
android:
components:
- build-tools-27.0.2
- android-27
- sys-img-armeabi-v7a-android-27
jdk:
- oraclejdk8
before_install:
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew
#First app is built then unit tests are run
jobs:
include:
- stage: build
async: true
script: ./gradlew assemble
- stage: test
async: true
script: ./gradlew -w runUnitTests
notifications:
email:
recipients:
- email#me.com
on_success: always # default: change
on_failure: always # default: always
I felt maven repo outage today and faced the same issue. Hours later, I found that the failed Travis Job is working fine now. Do check it at your side.
Also, For any given scenario when classpath dependencies are missing one should check the build.gradle file rather than the .travis.yml file.
The failure message says that the app:debugCompileClasspath task is failing when looking for the com.squareup.leakcanary:leakcanary-android:1.5.4 (jar or AAR). Gradle allows you to define the repositories at the the root level
allProjects{
repositories {
maven() //Gradle has definition the points to https://jcenter.bintray.com/
}
}
So it will look into the following places for the class files or jar file.
Name: $ANDROID_HOME/extras/m2repository; url: file:/$ANDROID_HOME/extras/m2repository/
Name: $ANDROID_HOME/extras/google/m2repository; url: $ANDROID_HOME/extras/google/m2repository/
Name: $ANDROID_HOME/extras/android/m2repository; url: file:$ANDROID_HOME/extras/android/m2repository/
Name: BintrayJCenter; url: https://jcenter.bintray.com/
If not found the dependency resolution will fail giving the error mentioned above.

Running into issues installing gitlab-shell

I am trying to install Gitlab CE from source and following this installation guide.
When I attempt to install the gitlab-shell using the command provided.
sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true
I received the following stack trace error.
WARNING: This version of GitLab depends on gitlab-shell 4.1.1, but you're running Unknown. Please update gitlab-shell.
rake aborted!
Gitlab::TaskFailedError: Gitlab::TaskFailedError
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:87:in `run_command!'
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:164:in `clone_repo'
/home/git/gitlab/lib/tasks/gitlab/task_helpers.rb:157:in `checkout_or_clone_tag'
/home/git/gitlab/lib/tasks/gitlab/shell.rake:16:in `block (3 levels) in <top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => gitlab:shell:install
What config file should I be modifying to fix my issue? Do I need to modify the Redis URL even though I am using the default configuration? By the way, this install is on an Ubuntu 16.04 server.
This might be caused by using a version of git that is too old.
To debug: append the --trace option to bundle exec to get more info on where this error is coming from and inspect the source.

Trying to precompile assets on AWS Elastic Beanstalk

2013-11-03 20:30:48,342 [INFO] (30173 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: /usr/bin/ruby1.9 /usr/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Command failed with status (): [/usr/bin/ruby1.9 /usr/bin/rake assets:prec...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Rake task failed to run, skipping asset compilation.
How do I precompile assets on AWS Elastic Beanstalk ?
I am getting following error
Precompilation of assets can be done at deployment time, and to do it, go to the root of your Rails project and create a .ebextensions directory with a .config file in it. You can specify precompilation there. I'm running a Rails app with Elastic Beanstalk and had problems with fonts not being shown. Here's my .ebextensions/ruby.config file:
packages:
yum:
git: []
container_commands:
01_assets:
command: RAILS_ENV=production bundle exec rake assets:precompile
leader_only: true
You can customise the system by running scripts before or after your application deployment.
Basically, you need to create a .ebextensions directory in your source code and insert your commands and customisation steps in a YAML syntax.
The documentation explains the details.
Beware that these commands are run as 'root' with no environment variable setup. If you need variables like PATH or other, it is up to you to position them.
Here is a sample I wrote for an application which required a NodeJS module installation from the source.
packages:
yum:
gcc: []
gcc-c++: []
container_commands:
10_pre_install_sqlite3:
command: "/opt/elasticbeanstalk/node-install/node-v0.10.21-linux-x64/bin/npm install sqlite3#2.1.16 --build-from-source"
cwd: "/tmp/deployment/application"
env:
HOME: "/root"
PATH: "/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin"

rake assets:precompile undefined method directory? for nil:NilClass

While trying to do an assets:precompile for a production website I've encountered this error for the first time.
rake assets:precompile undefined method directory? for nil:NilClass
I have successfully updated the website and done a assets:precompile many times before.
The full example:
# RAILS_ENV=production rake assets:precompile --trace
/usr/local/rvm/gems/ruby-1.9.2-p290#pm/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/gems/ruby-1.9.2-p290#pm/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
rake aborted!
undefined method `directory?' for nil:NilClass
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
I'm looking forward to someone's insight in this one, I've been racking my brain and Googling answers for hours.
This is what happens when the file system can't find one of the assets it thinks its supposed to precompile. This happened to me when my VM could not find one of the files in my shared folder (Weird VMware issue where it appeared in the directory listing but the file did not actually exist)
I had created a symbolic link to a non-existent file by mistake in the assets/javascript directory. Removing the link fixed the problem. Note that I do have other links in the assets directory so links in general are not a problem.
In my case, I had this issue when deploying an application in Heroku.
And one of my files was symlinked to somewhere outside the GIT repository, so the file was not present int 'master'.
I then had to remove the symbolic link (rm .../file) then copy the original file (cp file1 .../file) and finally add it to the repository (git -a -m "Added a forgotten file")