OSDN Git Service

adds the `fly_prune_workers_main` script. concourse-ci-0.2.7
authorwhitestar <whitestar@users.osdn.me>
Wed, 2 May 2018 06:37:17 +0000 (15:37 +0900)
committerwhitestar <whitestar@users.osdn.me>
Wed, 2 May 2018 06:37:17 +0000 (15:37 +0900)
cookbooks/concourse-ci/CHANGELOG.md
cookbooks/concourse-ci/concourse.yml
cookbooks/concourse-ci/recipes/docker-compose.rb
cookbooks/concourse-ci/templates/default/opt/docker-compose/app/concourse/bin/fly_prune_workers_main [new file with mode: 0644]
cookbooks/concourse-ci/templates/default/usr/local/bin/fly_prune_workers
cookbooks/concourse-ci/version

index 06cca1b..a01c7ce 100644 (file)
@@ -1,6 +1,10 @@
 concourse-ci CHANGELOG
 ======================
 
+0.2.7
+-----
+- adds the `fly_prune_workers_main` script.
+
 0.2.6
 -----
 - fixes format version detection of a local `docker-compose.yml`.
index 91d6537..77387a6 100644 (file)
@@ -1,5 +1,5 @@
 ---
-# $ fly -t target sp -p concourse-ci-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
+# $ fly -t $CC_TARGET sp -p concourse-ci-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
 resources:
 - name: src-git
   type: git
@@ -21,7 +21,7 @@ resources:
     ca_certs:
     - domain: ((registry-mirror-domain))  # e.g. registry.docker.example.com:5000
       cert: ((docker-reg-ca-cert))
-  check_every: 12h  # default: 1m
+  check_every: 6h  # default: 1m
 
 jobs:
 - name: test-cookbook
index a4960cf..9a9a3ac 100644 (file)
@@ -202,7 +202,8 @@ unless oauth_client_secret_vault_item.empty?
 end
 
 external_url = web_envs_org['CONCOURSE_EXTERNAL_URL']
-web_envs['CONCOURSE_EXTERNAL_URL'] = "http://#{node['ipaddress']}:8080" if external_url.nil?
+external_url = "http://#{node['ipaddress']}:8080" if external_url.nil?
+web_envs['CONCOURSE_EXTERNAL_URL'] = external_url
 
 data_source = web_envs_org['CONCOURSE_POSTGRES_DATA_SOURCE']
 # for backward compatibility.
@@ -302,6 +303,17 @@ template config_file do
   mode '0600'
 end
 
+template "#{bin_dir}/fly_prune_workers_main" do
+  source 'opt/docker-compose/app/concourse/bin/fly_prune_workers_main'
+  owner 'root'
+  group 'root'
+  mode '0755'
+  action :create
+  variables(
+    external_url: external_url
+  )
+end
+
 log <<-"EOM"
 Note: You must execute the following command manually.
   See #{doc_url}
diff --git a/cookbooks/concourse-ci/templates/default/opt/docker-compose/app/concourse/bin/fly_prune_workers_main b/cookbooks/concourse-ci/templates/default/opt/docker-compose/app/concourse/bin/fly_prune_workers_main
new file mode 100644 (file)
index 0000000..c498436
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0`
+
+if [ `whoami` != 'root' ]; then
+  echo 'ERROR: This script requires the root privilege.'
+  exit 1
+fi
+
+. <%= node['concourse-ci']['docker-compose']['app_dir'] %>/.env
+
+fly login -t main -u concourse -p $CONCOURSE_BASIC_AUTH_PASSWORD -c <%= @external_url %>
+fly_prune_workers -t main
index f7e849f..53aec1b 100644 (file)
@@ -5,7 +5,7 @@ PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0`
 target=''
 
 usage() {
-  echo 'Usage: prune_workers -t target'
+  echo 'Usage: prune_workers -t $CC_TARGET'
   echo
   echo "Options:"
   echo "  -h: this help."