def snaps(dry_run): """Syncs the snap branches, keeps snap builds in sync, and makes sure the latest snaps are published into snap store""" dryrun(dry_run) snaps_to_process = [ SnapKubeApiServerRepoModel(), SnapKubeControllerManagerRepoModel(), SnapKubeProxyRepoModel(), SnapKubeSchedulerRepoModel(), SnapKubectlRepoModel(), SnapKubeadmRepoModel(), SnapKubeletRepoModel(), SnapKubernetesTestRepoModel(), ] kubernetes_repo = InternalKubernetesRepoModel() # Sync all snap branches for _snap in snaps_to_process: snap_service_obj = SnapService(_snap, kubernetes_repo) snap_service_obj.sync_from_upstream() snap_service_obj.sync_all_track_snaps() snap_service_obj.sync_stable_track_snaps() # Handle cdk-addons sync separetely cdk_addons = SnapCdkAddonsRepoModel() cdk_addons_service_obj = SnapService(cdk_addons, kubernetes_repo) cdk_addons_service_obj.sync_stable_track_snaps()
def sync_internal_tags(dry_run): """Syncs upstream to downstream internal k8s tags""" dryrun(dry_run) # List of tuples containing upstream, downstream models and a starting semver repos_map = [ ( UpstreamKubernetesRepoModel(), InternalKubernetesRepoModel(), enums.K8S_STARTING_SEMVER, ), ( CriToolsUpstreamRepoModel(), InternalCriToolsRepoModel(), enums.K8S_CRI_TOOLS_SEMVER, ), ( CNIPluginsUpstreamRepoModel(), InternalCNIPluginsRepoModel(), enums.K8S_CNI_SEMVER, ), ] for repo in repos_map: upstream, downstream, starting_semver = repo tags_to_sync = upstream.tags_subset_semver_point( downstream, starting_semver) if not tags_to_sync: click.echo(f"All synced up: {upstream} == {downstream}") continue upstream.clone() upstream.remote_add("downstream", downstream.repo, cwd=upstream.name) for tag in tags_to_sync: click.echo( f"Syncing repo {upstream} => {downstream}, tag => {tag}") upstream.push("downstream", tag, cwd=upstream.name)
def debs(sign_key, dry_run, force): """Syncs debs""" dryrun(dry_run) client = lp.Client() client.login() ppas = client.ppas("k8s-maintainers") debs_to_process = [ DebKubeadmRepoModel(), DebKubectlRepoModel(), DebKubeletRepoModel(), ] kubernetes_repo = InternalKubernetesRepoModel() # Sync all deb branches for _deb in debs_to_process: deb_service_obj = DebService(_deb, kubernetes_repo, ppas, sign_key) deb_service_obj.sync_from_upstream() deb_service_obj.sync_debs(force) cri_tools = DebCriToolsRepoModel() cri_tools_service_obj = DebCriToolsService(cri_tools, InternalCriToolsRepoModel(), ppas, sign_key) cri_tools_service_obj.sync_from_upstream() cri_tools_service_obj.sync_debs(force) kubernetes_cni = DebKubernetesCniRepoModel() kubernetes_cni_service_obj = DebCNIService(kubernetes_cni, InternalCNIPluginsRepoModel(), ppas, sign_key) kubernetes_cni_service_obj.sync_from_upstream() kubernetes_cni_service_obj.sync_debs(force)
def ppas(dry_run): """Sync ppas""" dryrun(dry_run) client = lp.Client() client.login() ppa_service_obj = PPAService(client.owner("k8s-maintainers")) ppa_service_obj.sync()
def forks(dry_run): """Syncs all upstream forks""" # Try auto-merge; if conflict: update_readme.py && git add README.md && git # commit. If that fails, too, then it was a JSON conflict that will have to # be handled manually. dryrun(dry_run) repos_to_process = [ CharmService(repo) for repo in CharmRepoModel.load_repos(enums.CHARM_LAYERS_MAP + enums.CHARM_MAP) ] for repo in repos_to_process: repo.sync()
def snap_from_branch(branch, dry_run): """Syncs the snap branches, keeps snap builds in sync, and makes sure the latest snaps are published into snap store""" dryrun(dry_run) snaps_to_process = [ SnapKubeApiServerRepoModel(), SnapKubeControllerManagerRepoModel(), SnapKubeProxyRepoModel(), SnapKubeSchedulerRepoModel(), SnapKubectlRepoModel(), SnapKubeadmRepoModel(), SnapKubeletRepoModel(), SnapKubernetesTestRepoModel(), ] kubernetes_repo = InternalKubernetesRepoModel() # Sync all snap branches for _snap in snaps_to_process: snap_service_obj = SnapService(_snap, kubernetes_repo) snap_service_obj.build_snap_from_branch(branch)