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

mediawiki: prevent mwdeploy from upgrading extensions configured to checkout a specific commit #3876

Closed
wants to merge 10 commits into from
10 changes: 10 additions & 0 deletions modules/mediawiki/files/bin/mwdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ def _get_staging_path(repo: str, version: str = '') -> str:
return f'/srv/mediawiki-staging/{repos[repo]}/'


def _get_local_path(extension: str) -> str:
return f'/var/local/mwdeploy/{extension}'


def _get_deployed_path(repo: str) -> str:
return f'/srv/mediawiki/{repos[repo]}/'

Expand Down Expand Up @@ -439,6 +443,9 @@ def run_process(args: argparse.Namespace, version: str = '') -> list[int]: # pr
if not os.path.exists(_get_staging_path(f'extensions/{extension}', version)):
print(f'{extension} does not exist for {version}. Skipping...')
continue
if os.path.exists(_get_local_path(extension)):
print(f'Skipping upgrade of {extension} because it is configured in mediawiki-repos to checkout a specific commit')
continue
process = os.popen(_construct_git_pull(f'extensions/{extension}', submodules=True, quiet=False, version=version))
output = process.read().strip()
status = process.close()
Expand Down Expand Up @@ -488,6 +495,9 @@ def run_process(args: argparse.Namespace, version: str = '') -> list[int]: # pr
if not os.path.exists(_get_staging_path(f'skins/{skin}', version)):
print(f'{skin} does not exist for {version}. Skipping...')
continue
if os.path.exists(_get_local_path(skin)):
print(f'Skipping upgrade of {skin} because it is configured in mediawiki-repos to checkout a specific commit')
continue
process = os.popen(_construct_git_pull(f'skins/{skin}', quiet=False, version=version))
output = process.read().strip()
status = process.close()
Expand Down
21 changes: 21 additions & 0 deletions modules/mediawiki/manifests/extensionsetup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
require => Exec["OAuth-${branch} composer"],
}

file { '/var/local/mwdeploy':
ensure => directory,
owner => 'www-data',
group => 'www-data',
mode => '0644',
}

$repos = loadyaml('/etc/puppetlabs/puppet/mediawiki-repos/mediawiki-repos.yaml')

$repos.each |$name, $params| {
Expand Down Expand Up @@ -70,6 +77,20 @@
}
# lint:endignore

if $params['commit'] {
file { "/var/local/mwdeploy/${name}":
ensure => 'present',
owner => 'www-data',
group => 'www-data',
mode => '0644',
content => 'This extension is configured to checkout a specific commit in mediawiki-repos',
}
} else {
file { "/var/local/mwdeploy/${name}":
ensure => 'absent',
}
}

if $should_install {
if $params['composer'] {
exec { "${name}-${branch} composer":
Expand Down