タダです。
日課
Python文法
- 標準入力は
input()
でやる - 条件分岐は、if、elif、else
- 繰り返しでcontinueを使うと、continue以降の処理はスキップされる
100本ノック
- 「パトカー」+「タクシー」=「パタトクカシーー」 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ.
x = "パトカー" y = "タクシー" x = list(x) y = list(y) print(x[0] + y[0] + x[1] + y[1] + x[2] + y[2] + x[3] + y[3]) → パタトクカシーー
Jenkins
Jenkinsのパイプラインは、一連の処理をまとめられるがパイプラインには2種類ある
- declarative pipeline:シンプルな設定ができ、Scripted Pipelineの構文を使うこともできる。以下のような
pipeline
で囲われた定義。
pipeline { agent label:'has-docker', dockerfile: true environment { GIT_COMMITTER_NAME = "jenkins" GIT_COMMITTER_EMAIL = "jenkins@jenkins.io" } stages { stage("Build") { steps { sh 'mvn clean install -Dmaven.test.failure.ignore=true' } } stage("Archive"){ steps { archive "*/target/**/*" junit '*/target/surefire-reports/*.xml' } } } post { always { deleteDir() } success { mail to:"me@example.com", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Yay, we passed." } failure { mail to:"me@example.com", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Boo, we failed." } } }
- scripted pipeline : DSL形式で定義する。以下のような
node
で囲われた定義。
withEnv(["GIT_COMMITTER_NAME = jenkins","GIT_COMMITTER_EMAIL = jenkins@jenkins.io"]) { node('has-docker') { try { checkout scm // checks out Dockerfile and source code def myImage = docker.build 'my-environment:snapshot' myImage.inside { stage('Build') { sh 'mvn clean install -Dmaven.test.failure.ignore=true' } stage('Archive') { archive "*/target/**/*" junit '*/target/surefire-reports/*.xml' } } if (currentBuild.result == null || currentBuild.result == 'SUCCESS') { mail to:"me@example.com", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Yay, we passed." } } catch (exc) { mail to:"me@example.com", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Boo, we failed." } finally { deleteDir() } } }
Jenkinsfileあれこれ
パラメータ付きビルドの設定を使うことで、似たようなジョブを複数作る必要がなくなる パラメータ化したもので処理を分けるなどを行うことができる
また明日