/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

ext {

    // Target registry to be used to publish docker images needed for deployment
    targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'

    // The tag used to tag the docker images push to the target registry
    targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'

}

task buildBootstrapImage(type: Exec) {
    commandLine '/usr/bin/docker', 'build', '-t', 'cord-maas-bootstrap', './bootstrap'
}

task tagBootstrapImage(type: Exec) {
   dependsOn buildBootstrapImage
   commandLine '/usr/bin/docker', 'tag', 'cord-maas-bootstrap', "$targetReg/cord-maas-bootstrap:$targetTag"
}

task publishBootstrapImage(type: Exec) {
    dependsOn tagBootstrapImage
    commandLine '/usr/bin/docker', 'push', "$targetReg/cord-maas-bootstrap:$targetTag"
}

task buildAutomationImage(type: Exec) {
    commandLine '/usr/bin/docker', 'build', '-t', "cord-maas-automation", "./automation"
}

task tagAutomationImage(type: Exec) {
    dependsOn buildAutomationImage
    commandLine '/usr/bin/docker', 'tag', 'cord-maas-automation', "$targetReg/cord-maas-automation:$targetTag"
}

task publishAutomationImage(type: Exec) {
    dependsOn tagAutomationImage
    commandLine '/usr/bin/docker', 'push', "$targetReg/cord-maas-automation:$targetTag"
}

task buildHarvesterImage(type: Exec) {
    commandLine '/usr/bin/docker', 'build', '-t', "cord-maas-dhcp-harvester", "./harvester"
}

task tagHarvesterImage(type: Exec) {
    dependsOn buildHarvesterImage
    commandLine '/usr/bin/docker', 'tag', 'cord-maas-dhcp-harvester', "$targetReg/cord-maas-dhcp-harvester:$targetTag"
}

task publishHarvesterImage(type: Exec) {
    dependsOn tagHarvesterImage
    commandLine '/usr/bin/docker', 'push', "$targetReg/cord-maas-dhcp-harvester:$targetTag"
}

// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~

// To be used to fetch upstream binaries, clone repos, etc.
task fetch(type: Exec) {
    // this is where we fetch upstream artifacts that we do not need internet for the build phase"
    // Placeholdr example:
    commandLine "/usr/bin/docker", "pull", "golang:alpine"
    commandLine "/usr/bin/docker", "pull", "python:2.7-alpine"
}

// To be used to generate all needed binaries that need to be present on the target
// as docker images in the local docker runner.
task buildImages {
    dependsOn buildBootstrapImage
    dependsOn buildHarvesterImage
    dependsOn buildAutomationImage
}

task tagImages {
    dependsOn tagBootstrapImage
    dependsOn tagHarvesterImage
    dependsOn tagAutomationImage
}

task publish {
    dependsOn publishBootstrapImage
    dependsOn publishHarvesterImage
    dependsOn publishAutomationImage
}

// ~~~~~~~~~~~~~~~~~~~ Deployment / Test Tasks  ~~~~~~~~~~~~~~~~~~~~~~~

// This task will invoke the ansible configuration on the vagrant head node. The ansible deployment is
// executed remotely to the head node as this is a more realistic scenario for a production deployment.
// The assumption is that this task is executed from the maasdev virtual machine as it access the head 
// node virtual box over a private network.
//
// TODO: Currently the deployment of the head node does not use the locally built docker containers, it
//       should be modified to do so. This likely means that we need to configure docker on the head node
//       to access the docker registry on the maasdev virtual box.
task deployMaas(type: Exec) {
  commandLine '/usr/bin/ansible-playbook', '-i', '10.100.198.202,', '--skip-tags=switch_support,interface_config', 'dev-head-node.yml', '--extra-vars=external_iface=eth0 fabric_ip=10.1.1.1/24' 
}

