Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAM implementation #223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions lib/travis/yml/schema/def/lxd_build.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
module LxdBuildDefs
class LxdBuild < Type::Map
register :lxd_build

def define
summary 'Build an LXD image'

description <<~str
Build an LXD image
str

map :dist, to: :lxd_dist, required: true
map :name, to: :lxd_name, required: true
map :description, to: :lxd_description
map :commands, to: :lxd_commands

export
end
end
end
end
end
end
end

require 'travis/yml/schema/def/lxd_build_defs/lxd_dist'
require 'travis/yml/schema/def/lxd_build_defs/lxd_name'
require 'travis/yml/schema/def/lxd_build_defs/lxd_description'
require 'travis/yml/schema/def/lxd_build_defs/lxd_commands'
35 changes: 35 additions & 0 deletions lib/travis/yml/schema/def/lxd_build_defs/lxd_commands.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
module LxdBuildDefs
class LxdCommands < Type::Seq
register :lxd_commands

def define
summary 'LXD image commands'
description 'Run commands during LXD image setup'
normal
type :lxd_command

export
end
end

class LxdCommand < Type::Str
register :lxd_command

def define
summary 'LXD command'
example 'apt-get -y install python3.8'
export
end
end
end
end
end
end
end
22 changes: 22 additions & 0 deletions lib/travis/yml/schema/def/lxd_build_defs/lxd_description.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
module LxdBuildDefs
class LxdDescription < Type::Str
register :lxd_description

def define
summary 'LXD image description'
example 'My custom image description'
export
end
end
end
end
end
end
end
29 changes: 29 additions & 0 deletions lib/travis/yml/schema/def/lxd_build_defs/lxd_dist.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
module LxdBuildDefs
class LxdDist < Type::Str
register :lxd_dist

def define
title 'Distribution'
summary 'LXD image Ubuntu distribution'
see 'Virtualization environments': 'https://docs.travis-ci.com/user/reference/overview/#virtualization-environments'

downcase

value :focal
value :bionic

export
end
end
end
end
end
end
end
22 changes: 22 additions & 0 deletions lib/travis/yml/schema/def/lxd_build_defs/lxd_name.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
module LxdBuildDefs
class LxdName < Type::Str
register :lxd_name

def define
summary 'LXD image name'
example 'my-custom-image'
export
end
end
end
end
end
end
end
19 changes: 19 additions & 0 deletions lib/travis/yml/schema/def/os_custom.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'travis/yml/schema/type'

module Travis
module Yml
module Schema
module Def
class OsCustom < Type::Str
register :os_custom

def define
summary 'Use a custom LXD image'
export
end
end
end
end
end
end
4 changes: 4 additions & 0 deletions lib/travis/yml/schema/def/root.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
require 'travis/yml/schema/def/language'
require 'travis/yml/schema/def/notification'
require 'travis/yml/schema/def/os'
require 'travis/yml/schema/def/os_custom'
require 'travis/yml/schema/def/stack'
require 'travis/yml/schema/def/stages'
require 'travis/yml/schema/def/sudo'
require 'travis/yml/schema/def/version'
require 'travis/yml/schema/def/virt'
require 'travis/yml/schema/def/vm'
require 'travis/yml/schema/def/lxd_build'
require 'travis/yml/schema/type'

module Travis
Expand Down Expand Up @@ -53,6 +55,7 @@ def define

map :language, default: DEFAULT[:language]
matrix :os, default: DEFAULT[:os], to: :oss
map :os_custom
map :dist, default: ENV['TRAVIS_DEFAULT_DIST'] || DEFAULT[:dist]
matrix :arch, to: :archs
map :stack
Expand All @@ -64,6 +67,7 @@ def define
map :stages
map :jobs, alias: :matrix
map :notifications
map :lxd_build

map :version
map :vm, default: DEFAULT[:vm]
Expand Down
86 changes: 86 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
"expand"
]
},
"os_custom": {
"$ref": "#/definitions/type/os_custom"
},
"dist": {
"$ref": "#/definitions/type/dist",
"defaults": [
Expand Down Expand Up @@ -1757,6 +1760,12 @@
"Build Environment Overview": "https://docs.travis-ci.com/user/reference/overview/"
}
},
"os_custom": {
"$id": "os_custom",
"title": "Custom LXD image name",
"type": "string",
"summary": "Use a custom LXD image"
},
"osx_images": {
"$id": "osx_images",
"title": "Osx Images",
Expand Down Expand Up @@ -2175,6 +2184,28 @@
"see": {
"Customizing the Build": "https://docs.travis-ci.com/customizing-the-build/"
}
},
"lxd_build": {
"$id": "lxd_build",
"title": "LXD Build",
"description": "Build an LXD image",
"type": "object",
"properties": {
"dist": {
"$ref": "#/definitions/lxd_build_defs/lxd_dist"
},
"name": {
"$ref": "#/definitions/lxd_build_defs/lxd_name"
},
"description": {
"$ref": "#/definitions/lxd_build_defs/lxd_description"
},
"commands": {
"$ref": "#/definitions/lxd_build_defs/lxd_commands"
}
},
"additionalProperties": false,
"summary": "Build an LXD image"
}
},
"addon": {
Expand Down Expand Up @@ -10064,6 +10095,61 @@
},
"normal": true
}
},
"lxd_build_defs": {
"lxd_command": {
"$id": "lxd_command",
"title": "Lxd Command",
"type": "string",
"summary": "LXD command",
"example": "apt-get -y install python3.8"
},
"lxd_commands": {
"$id": "lxd_commands",
"title": "Lxd Commands",
"description": "Run commands during LXD image setup",
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/lxd_build_defs/lxd_command"
},
"normal": true
},
{
"$ref": "#/definitions/lxd_build_defs/lxd_command"
}
],
"summary": "LXD image commands"
},
"lxd_description": {
"$id": "lxd_description",
"title": "Lxd Description",
"type": "string",
"summary": "LXD image description",
"example": "My custom image description"
},
"lxd_dist": {
"$id": "lxd_dist",
"title": "Distribution",
"type": "string",
"summary": "LXD image Ubuntu distribution",
"see": {
"Virtualization environments": "https://docs.travis-ci.com/user/reference/overview/#virtualization-environments"
},
"downcase": true,
"enum": [
"focal",
"bionic"
]
},
"lxd_name": {
"$id": "lxd_name",
"title": "Lxd Name",
"type": "string",
"summary": "LXD image name",
"example": "my-custom-image"
}
}
},
"expand": [
Expand Down