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

add ability to define composer update channel #571

Merged
merged 1 commit into from
Apr 19, 2020
Merged
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
3 changes: 3 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ Install composer package manager
[*path*]
Holds path to the Composer executable

[*channel*]
Holds the Update channel (stable|preview|snapshot|1|2)

[*proxy_type*]
proxy server type (none|http|https|ftp)

Expand Down
5 changes: 5 additions & 0 deletions manifests/composer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# [*path*]
# Holds path to the Composer executable
#
# [*channel*]
# Holds the Update channel (stable|preview|snapshot|1|2)
#
# [*proxy_type*]
# proxy server type (none|http|https|ftp)
#
Expand All @@ -28,6 +31,7 @@
Stdlib::Absolutepath $path = $php::params::composer_path,
$proxy_type = undef,
$proxy_server = undef,
Php::ComposerChannel $channel = 'stable',
Boolean $auto_update = true,
Integer $max_age = $php::params::composer_max_age,
Variant[Integer, String] $root_group = $php::params::root_group,
Expand All @@ -52,6 +56,7 @@
max_age => $max_age,
source => $source,
path => $path,
channel => $channel,
proxy_type => $proxy_type,
proxy_server => $proxy_server,
}
Expand Down
10 changes: 7 additions & 3 deletions manifests/composer/auto_update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# [*path*]
# Holds path to the Composer executable
#
# [*channel*]
# Holds the Update channel (stable|preview|snapshot|1|2)
#
# [*proxy_type*]
# proxy server type (none|http|https|ftp)
#
Expand All @@ -29,8 +32,9 @@
$max_age,
$source,
$path,
$proxy_type = undef,
$proxy_server = undef,
Php::ComposerChannel $channel = 'stable',
$proxy_type = undef,
$proxy_server = undef,
) {

assert_private()
Expand All @@ -44,7 +48,7 @@

exec { 'update composer':
# touch binary when an update is attempted to update its mtime for idempotency when no update is available
command => "${path} --no-interaction --quiet self-update; touch ${path}",
command => "${path} --no-interaction --quiet self-update --${channel}; touch ${path}",
environment => $env,
onlyif => "test `find '${path}' -mtime +${max_age}`",
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ],
Expand Down
7 changes: 7 additions & 0 deletions types/composerchannel.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Php::ComposerChannel = Enum[
'stable',
'preview',
'snapshot',
'1',
'2' # lint:ignore:trailing_comma
]