def finish_release(repo_url, version): """Merge release to master and deploy to production""" validate_dependencies() with init_working_dir(repo_url): check_release_tag(version) merge_release_candidate() tag_release(version) merge_release()
def finish_release(*, github_access_token, repo_url, version, timezone): """Merge release to master and deploy to production""" validate_dependencies() with init_working_dir(github_access_token, repo_url): check_release_tag(version) set_release_date(version, timezone) merge_release_candidate() tag_release(version) merge_release()
async def wait_for_deploy(repo_url, hash_url, watch_branch): """Wait until server is finished with the deploy""" validate_dependencies() with init_working_dir(repo_url): latest_hash = check_output( ["git", "rev-parse", "origin/{}".format(watch_branch)]).decode().strip() print("Polling {url} for {hash}...".format(url=hash_url, hash=latest_hash)) while fetch_release_hash(hash_url) != latest_hash: await asyncio.sleep(30) print(".", end='') print("Hashes match, deployment was successful!")
def test_validate_dependencies(): """validate_dependencies should raise an exception if a dependency is missing or invalid""" with patch('release.dependency_exists', return_value=True) as dependency_exists_stub: validate_dependencies() for dependency in ('node', 'hub', 'git', 'git-release-notes'): dependency_exists_stub.assert_any_call(dependency) with patch( 'release.dependency_exists', # the cell-var-from-loop warning can be ignored because this function is executed # immediately after its definition side_effect=lambda _dependency: _dependency != dependency, # pylint: disable=cell-var-from-loop ), pytest.raises(DependencyException): validate_dependencies()
def test_validate_node_version(major): """validate_dependencies should check that the major node.js version is new enough""" node_version = "v{}.2.1".format(major).encode() with patch( 'release.dependency_exists', return_value=True, ), patch( 'release.check_output', return_value=node_version, ): if major >= 6: validate_dependencies() else: with pytest.raises(DependencyException): validate_dependencies()