Jenkins scheduled build Triggers with environment variable

Jenkinsのbuild periodically(cronもどき)ごとに異なる環境変数渡したい場合、jobを2つ作ると意図通りに出来た。

先行のjobは、cronと Post build action – Trigger parameterized build on other が仕事。Parameterized Trigger Plugin をつかう。後続のjobは渡された環境変数を使うだけ。同時build数や同時起動数の制御もしておけば同時起動不可なbuild複数でも順番にやってくれる。

という説明をtachikoma用に書いた。

https://github.com/sanemat/tachikoma/wiki/Manage-multiple-projects-with-jenkins

kick-tachikoma

This job has only 2 roles, Build periodically (perhaps daily) and Post build action – Trigger parameterized build on other projects. UsingParameterized Trigger Plugin, then kick following tachikoma(s).

tachikoma

Given TOKEN and BUILD_FOR, then tachikoma(s) works!

see: http://stackoverflow.com/questions/18086508/jenkins-scheduled-build-triggers-with-environment-variable

広告

Initialize Android Project with Test Project

Goal: Development Android Project with Test Project

– Init with Eclipse
– Development with Eclipse
– TDD
– Under Version Control
– CI

Directory Structure

EDITED(2011-07-05 23:26)More recommended: When you create new project from existing source, test directory also imported. And it does not act as a test project.

-ECLIPSE_WORKSPACE
    -SpinnerActivity
    -SpinnerActivityTest
-SCM_WORKSPACE
    -spinner
        -SpinnerActivity
        -SpinnerActivityTest

EDITED(2011-07-05 7:03) recommended structure: Testing Fundamentals | Android Developers

  MyProject/
      AndroidManifest.xml
      res/
          ... (resources for main application)
      src/
          ... (source code for main application) ...
      tests/
          AndroidManifest.xml
          res/
              ... (resources for tests)
          src/
              ... (source code for tests)

Create scm workspace and init

I’m eclipse newbie. So I don’t understand how to use EGit. So I use cli git command.
mkdir -p SCM_WORKSPACE/spinner
cd SCM_WORKSPACE/spinner
git init
touch .gitkeep
git add .
git commit -v

Create New Project from existing source

/usr/local/Cellar/android-sdk/r11/samples/android-12/Spinner/

File -> New -> Project -> Android -> Android Project
– Create project from existing source
In my Indigo version(mac os x 10.6.8) does not work next and create test. So I do separate.
ECLIPSE_WORKSPACE/SpinnerActivity completed.

Copy to scm dir and commit

cd SCM_WORKSPACE/spinner
EDITED(2011-07-06 7:10) cp -r option drops dot files.
cp -r ECLIPSE_WORKSPACE/SpinnerActivity .
cp -a ECLIPSE_WORKSPACE/SpinnerActivity .
curl -L https://raw.github.com/github/gitignore/master/Android.gitignore -o SpinnerActivity/.gitignore
git add SpinnerActivity/
git commit -v

Create New Test Project SpinnerActivityTest

File -> New -> Project -> Android -> Android Test Project
Test Target
An Existing Android Project: SpinnerActivity

If then error occurs, you will fix it. You can run SpinnerActivity and SpinnerActivityTest.

Copy to scm dir and commit

cd SCM_WORKSPACE/spinner
EDITED(2011-07-06 7:10) cp -r option drops dot files.
cp -r ECLIPSE_WORKSPACE/SpinnerActivityTest .
cp -a ECLIPSE_WORKSPACE/SpinnerActivityTest .
curl -L https://raw.github.com/github/gitignore/master/Android.gitignore -o SpinnerActivityTest/.gitignore
git add SpinnerActivityTest/
git commit -v

CLI building SpinnerActivity

CI use CLI build, ant. You need “build.xml”. Managing Projects from the Command Line | Android Developers
cd SCM_WORKSPACE/spinner/SpinnerActivity
android update project --name SpinnerActivity --target 5 --path .
git add .
git commit -v
cd ..
ant -f SpinnerActivity/build.xml debug

CLI building SpinnerActivityTest

Test project needs cli building too.
cd SCM_WORKSPACE/spinner/SpinnerActivityTest
android update test-project -p . -m ../SpinnerActivity
git add .
git commit -v
cd ..
ant -f SpinnerActivityTest/build.xml run-tests

This is half way. It’s crazy bad know-how.

Cleanup ECLIPSE_WORKSPACE

Select SpinnerActivity project and Delete. You must check-off “delete project content on disk”. if you check this, then you delete “android-sdk/r11/samples/android-12/Spinner/”.
Select SpinnerActivityTest project and Delete. You must check-on “delete project content on disk”.

Move and Clone, it is just other developer’s setting way

cd SCM_WORKSPACE
mv spinner spinner_origin
git clone spinner_origin/.git spinner

Create New Project from existing source again

SCM_WORKSPACE/spinner/SpinnerActivity

File -> New -> Project -> Android -> Android Project
– Create project from existing source
In my Indigo version(mac os x 10.6.8) does not work next and create test. So I do separate.
ECLIPSE_WORKSPACE/SpinnerActivity completed.

Import Test Project

Eclipse does not have a way to create test project from existing source. So I use import.
File -> Import -> General -> Existing Project into Workspace
SCM_WORKSPACE/spinner/SpinnerActivityTest

EDITED(2011-07-05 6:32):
You *must* check-off copy project into workspace.

Then you must Clean Up and Reflesh.

Finally, you can work TDD and CI. Happy Android Development!

CI Server for Android

The current application development, CI required. Also Android.
My CI experience stands for maybe lamp, centos5.x, 64bit. Android and iOS is against another environment. iOS requires mac. mac? This is another story. Android’s android.test can assert on simulator. Android simulator requires 32bit libraries. 32bit libs into 64bit is possible, but it is not right way. And simulator also requires glibc greater than v2.7. So totally, ubuntu 32bit or fedora 32bit machine requires.

The Other way:
I consider Ecosystem Hosting, but first I choice my own vps. I worry ssh access, switch user jenkins, access to scm repos, commit hook, and source control.

I choice fedora 32bit, because I familiar with redhat os. Below is my history.
fedora13 minimal -> fedora14 32bit jenkins env — Gist

Minimal install confuse me! Below is highlight.
99 man iptables
101 sudo yum list *man*
102 sudo yum install man-pages
110 sudo yum install man-db

Finally, I created 32bit jenkins environment. Jenkins, nginx and postfix.
http://jenkins32.sane.jp/