if track == "latest": click.echo("Skipping latest track") continue click.echo("Looking at track {}".format(track)) upstream = upstream_release(track) if upstream: click.echo( "There is already an upstream stable release. We do not release pre-releases." ) continue # Make sure the track is clear from stable releases. track_has_stable_release = False for channel in ["edge", "beta", "candidate", "stable"]: snap = Microk8sSnap(track, channel) if snap.released and not snap.is_prerelease: track_has_stable_release = True break if track_has_stable_release: click.echo( "There is already an non-pre-release snap in the store. We do not release pre-releases." ) continue for channel in [("candidate", "rc"), ("beta", "beta"), ("edge", "alpha")]: pre_release = get_latest_pre_release(track, channel[1]) if not pre_release: click.echo("No {} pre-release".format(channel[1]))
if __name__ == '__main__': ''' Releases to beta and candidate what is under edge on the tracks provided in $TRACKS. Cross distro tests should run. ''' print( "Check edge for a new release cross-distro test and release to beta and candidate." ) print("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: print("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: print("No stable upstream release yet.") continue edge_snap = Microk8sSnap(track, 'edge', juju_unit, juju_controller) if not edge_snap.released: print("Nothing released on {} edge.".format(track)) break beta_snap = Microk8sSnap(track, 'beta', juju_unit, juju_controller) if beta_snap.released and not beta_snap.is_prerelease: # We already have a snap on beta that is not a pre-release. Let's see if we have to push a new release. if beta_snap.version == edge_snap.version and always_release == 'no': # Beta and edge are the same version. Nothing to release on this track. print( "Beta and edge have the same version {}. We will not release." .format(beta_snap.version)) continue print("Beta is at {}, edge at {}, and 'always_release' is {}.".
# Set this to the proxy your environment may have proxy = os.environ.get('PROXY') if not proxy or proxy.strip() == '': proxy = None if __name__ == '__main__': ''' Releases to stable what is under candidate on the tracks provided in $TRACKS. Cross distro tests should run. ''' print("Check candidate maturity and release microk8s to stable.") print("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: print("Looking at track {}".format(track)) candidate_snap = Microk8sSnap(track, 'candidate') if not candidate_snap.released: # Nothing to release print("Nothing on candidate. Nothing to release.") break if (datetime.now(timezone.utc) - candidate_snap.release_date ).days < 8 and always_release == 'no': # Candidate not mature enough print( "Not releasing because candidate is {} days old and 'always_release' is {}" .format((datetime.now(timezone.utc) - candidate_snap.release_date).days, always_release)) continue stable_snap = Microk8sSnap(track, 'stable')
if __name__ == "__main__": """ Releases to stable what is under candidate on the tracks provided in $TRACKS. Cross distro tests should run. """ click.echo("Check candidate maturity and release microk8s to stable.") click.echo("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: click.echo("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: click.echo("No stable upstream release yet.") continue candidate_snap = Microk8sSnap(track, "candidate", juju_unit, juju_controller) if not candidate_snap.released: # Nothing to release click.echo("Nothing on candidate. Nothing to release.") break if (datetime.now(timezone.utc) - candidate_snap.release_date ).days < 8 and always_release == "no": # Candidate not mature enough click.echo( "Not releasing because candidate is {} days old and 'always_release' is {}" .format( (datetime.now(timezone.utc) - candidate_snap.release_date).days, always_release, ))
if __name__ == "__main__": """ Releases to beta and candidate what is under edge on the tracks provided in $TRACKS. Cross distro tests should run. """ click.echo( "Check edge for a new release cross-distro test and release to beta and candidate." ) click.echo("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: click.echo("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: click.echo("No stable upstream release yet.") continue edge_snap = Microk8sSnap(track, "edge", juju_unit, juju_controller, juju_model, testflinger_queue) if not edge_snap.released: click.echo("Nothing released on {} edge.".format(track)) break beta_snap = Microk8sSnap(track, "beta", juju_unit, juju_controller, juju_model) if beta_snap.released and not beta_snap.is_prerelease: # We already have a snap on beta that is not a pre-release. Let's see if we have to push a new release. if beta_snap.version == edge_snap.version and always_release == "no": # Beta and edge are the same version. Nothing to release on this track. click.echo( "Beta and edge have the same version {}. We will not release." .format(beta_snap.version)) continue
if __name__ == "__main__": """ Releases to beta and candidate what is under edge on the tracks provided in $TRACKS. Cross distro tests should run. """ print( "Check edge for a new release cross-distro test and release to beta and candidate." ) print("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: print("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: print("No stable upstream release yet.") continue edge_snap = Microk8sSnap(track, "edge", juju_unit, juju_controller) if not edge_snap.released: print("Nothing released on {} edge.".format(track)) break beta_snap = Microk8sSnap(track, "beta", juju_unit, juju_controller) if beta_snap.released and not beta_snap.is_prerelease: # We already have a snap on beta that is not a pre-release. Let's see if we have to push a new release. if beta_snap.version == edge_snap.version and always_release == "no": # Beta and edge are the same version. Nothing to release on this track. print( "Beta and edge have the same version {}. We will not release." .format(beta_snap.version)) continue print("Beta is at {}, edge at {}, and 'always_release' is {}.".
return None # trigger build ubuntu = launchpad.distributions["ubuntu"] request = microk8s.requestBuilds(archive=ubuntu.main_archive, pocket="Updates") return request if __name__ == "__main__": click.echo("Running a build and release of microk8s") for track in get_tracks(all=True): click.echo("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: continue edge_snap = Microk8sSnap(track, "edge") if not edge_snap.released: # Nothing released on edge. LP builders are probably not in place continue click.echo( "Upstream has {} and snapped version is at {}".format( upstream, edge_snap.version ) ) if upstream != edge_snap.version: if not upstream.startswith("{}.".format(edge_snap.major_minor_version)): # There is a minor version difference. # For example upstream says we are on v1.12.x and the edge snap is on v1.11.y # This should occur only in the "latest" track that follows the latest k8s if track != "latest": click.echo(
if __name__ == '__main__': ''' Releases to stable what is under candidate on the tracks provided in $TRACKS. Cross distro tests should run. ''' print("Check candidate maturity and release microk8s to stable.") print("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: print("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: print("No stable upstream release yet.") continue candidate_snap = Microk8sSnap(track, 'candidate', juju_unit, juju_controller) if not candidate_snap.released: # Nothing to release print("Nothing on candidate. Nothing to release.") break if (datetime.now(timezone.utc) - candidate_snap.release_date).days < 8 and always_release == 'no': # Candidate not mature enough print("Not releasing because candidate is {} days old and 'always_release' is {}".format( (datetime.now(timezone.utc) - candidate_snap.release_date).days, always_release )) continue stable_snap = Microk8sSnap(track, 'stable', juju_unit, juju_controller) if stable_snap.released and not stable_snap.is_prerelease: # We already have a snap released on stable that is not a pre-release. Lets run some tests.
continue if track == "latest": ersion = upstream[1:] ersion_list = ersion.split(".") source_track = "{}.{}".format(ersion_list[0], ersion_list[1]) source_channel = "stable" click.echo("latest/stable is populated from the {}/{}".format( source_track, source_channel)) else: source_track = track source_channel = "candidate" click.echo("{}/stable is populated from the {}/{}".format( track, source_track, source_channel)) candidate_snap = Microk8sSnap(source_track, source_channel, juju_unit, juju_controller, juju_model) if not candidate_snap.released: # Nothing to release click.echo("Nothing on candidate. Nothing to release.") break if (datetime.now(timezone.utc) - candidate_snap.release_date ).days < 8 and always_release == "no": # Candidate not mature enough click.echo( "Not releasing because candidate is {} days old and 'always_release' is {}" .format( (datetime.now(timezone.utc) - candidate_snap.release_date).days, always_release, ))
proxy = os.environ.get('PROXY') if not proxy or proxy.strip() == '': proxy = None if __name__ == '__main__': ''' Releases to beta and candidate what is under edge on the tracks provided in $TRACKS. Cross distro tests should run. ''' print( "Check edge for a new release cross-distro test and release to beta and candidate." ) print("Dry run is set to '{}'.".format(dry_run)) for track in tracks_requested: print("Looking at track {}".format(track)) edge_snap = Microk8sSnap(track, 'edge') if not edge_snap.released: print("Nothing released on {} edge.".format(track)) break beta_snap = Microk8sSnap(track, 'beta') if beta_snap.released: # We already have a snap on beta. Let's see if we have to push a new release. if beta_snap.version == edge_snap.version and always_release == 'no': # Beta and edge are the same version. Nothing to release on this track. print( "Beta and edge have the same version {}. We will not release." .format(beta_snap.version)) continue print("Beta is at {}, edge at {}, and 'always_release' is {}.".
# trigger build ubuntu = launchpad.distributions["ubuntu"] request = microk8s.requestBuilds(archive=ubuntu.main_archive, pocket='Updates') return request if __name__ == '__main__': print("Running a build and release of microk8s") for track in get_tracks(all=True): print("Looking at track {}".format(track)) upstream = upstream_release(track) if not upstream: continue edge_snap = Microk8sSnap(track, 'edge') if not edge_snap.released: # Nothing released on edge. LP builders are probably not in place continue print("Upstream has {} and snapped version is at {}".format(upstream, edge_snap.version)) if upstream != edge_snap.version: if not upstream.startswith("{}.".format(edge_snap.major_minor_version)): # There is a minor version difference. # For example upstream says we are on v1.12.x and the edge snap is on v1.11.y # This should occur only in the "latest" track that follows the latest k8s if track != 'latest': print("Track {} has an edge snap of {}.".format(track, edge_snap.version)) raise Exception("Tracks should not change releases") print("Triggering LP builders") request = trigger_lp_builders(track)