This repository was archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Adjust release behavior in balrogscript. #25
Merged
MihaiTabara
merged 6 commits into
mozilla-releng:master
from
MihaiTabara:firefox_releases
Dec 14, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Changelog | ||
| All notable changes to this project will be documented in this file. | ||
| This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
|
||
| ## [1.0.0] - 2017-12-14 | ||
| ### Added | ||
| - Changelog | ||
| - Support for processing release manifest from beetmover | ||
|
|
||
| ### Fixed | ||
| - fixed some logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import json | ||
| import os | ||
| import pytest | ||
| import shutil | ||
| import tempfile | ||
|
|
||
|
|
||
| # constants, helpers, and fixtures {{{1 | ||
| NIGHTLY_MANIFEST_PATH = os.path.join(os.path.dirname(__file__), "data", "nightly_manifest.json") | ||
| NIGHTLY_TASK_PATH = os.path.join(os.path.dirname(__file__), "data", "nightly_task.json") | ||
|
|
||
|
|
||
| @pytest.fixture(scope='function') | ||
| def nightly_manifest(): | ||
| with open(NIGHTLY_MANIFEST_PATH, "r") as fh: | ||
| return json.load(fh) | ||
|
|
||
|
|
||
| @pytest.yield_fixture(scope='function') | ||
| def config(): | ||
| tmpdir = tempfile.mkdtemp() | ||
| try: | ||
| yield { | ||
| "work_dir": os.path.join(tmpdir, "work_dir"), | ||
| "artifact_dir": os.path.join(tmpdir, "artifact_dir"), | ||
| "schema_file": "balrogscript/data/balrog_task_schema.json", | ||
| "dummy": False, | ||
| "api_root": "BALROG_API_ROOT", | ||
| "server_config": { | ||
| "nightly": { | ||
| "balrog_username": "BALROG_USERNAME", | ||
| "balrog_password": "BALROG_PASSWORD", | ||
| "allowed_channels": ["nightly"] | ||
| }, | ||
| "release": { | ||
| "balrog_username": "BALROG_USERNAME", | ||
| "balrog_password": "BALROG_PASSWORD", | ||
| "allowed_channels": ["release", "release-localtest", "release-cdntest"] | ||
| }, | ||
| "dep": { | ||
| "balrog_username": "BALROG_USERNAME", | ||
| "balrog_password": "BALROG_PASSWORD", | ||
| "allowed_channels": ["nightly", "release", "beta", "etc"] | ||
| }, | ||
|
|
||
| }, | ||
| "disable_certs": False, | ||
| "verbose": True | ||
| } | ||
| finally: | ||
| shutil.rmtree(tmpdir) | ||
|
|
||
|
|
||
| @pytest.yield_fixture(scope='function') | ||
| def nightly_config(config): | ||
| os.makedirs(os.path.join(config['work_dir'], "upstream-task-id", "public")) | ||
| shutil.copyfile( | ||
| NIGHTLY_MANIFEST_PATH, | ||
| os.path.join(config['work_dir'], "upstream-task-id", "public", "manifest.json") | ||
| ) | ||
| shutil.copyfile( | ||
| NIGHTLY_TASK_PATH, | ||
| os.path.join(config['work_dir'], "task.json") | ||
| ) | ||
| yield config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # -*- coding: utf-8 -*- | ||
| import pytest | ||
|
|
||
| from balrogscript.test import config, nightly_config | ||
| from balrogscript.task import (get_task, get_task_channel, get_task_server, | ||
| get_upstream_artifacts) | ||
|
|
||
| assert nightly_config # silence pyflakes | ||
| assert config # silence pyflakes | ||
|
|
||
|
|
||
| def test_get_task_channel(nightly_config): | ||
| task = get_task(nightly_config) | ||
| with pytest.raises(NotImplementedError): | ||
| get_task_channel(task, nightly_config) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("scopes,expected,raises", (( | ||
| ["project:releng:balrog:server:dep", "project:releng:balrog:server:release"], | ||
| None, True, | ||
| ), ( | ||
| ["project:releng:balrog:server:!!"], | ||
| None, True | ||
| ), ( | ||
| ["project:releng:balrog:server:foo", "project:releng:balrog:action:foo"], | ||
| None, True | ||
| ), ( | ||
| ["project:releng:balrog:server:dep", "project:releng:balrog:action:foo"], | ||
| "dep", False | ||
| ))) | ||
| def test_get_task_server(nightly_config, scopes, expected, raises): | ||
| task = get_task(nightly_config) | ||
| task['scopes'] = scopes | ||
|
|
||
| if raises: | ||
| with pytest.raises(ValueError): | ||
| get_task_server(task, nightly_config) | ||
| else: | ||
| assert expected == get_task_server(task, nightly_config) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("expected", ([ | ||
| [{ | ||
| u'paths': [u'public/manifest.json'], | ||
| u'taskId': u'upstream-task-id', | ||
| u'taskType': u'baz' | ||
| }] | ||
| ])) | ||
| def test_get_upstream_artifacts(nightly_config, expected): | ||
| task = get_task(nightly_config) | ||
| assert get_upstream_artifacts(task) == expected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "version": [ | ||
| 0, | ||
| 1, | ||
| 1 | ||
| 0, | ||
| 0 | ||
| ], | ||
| "version_string": "0.1.1" | ||
| "version_string": "1.0.0" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we always submit completes. I'd make them optional as well. Just add a check to make sure that either of them is set, aka
any([complete_info, partial_info]).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always do - https://github.com/mozilla-releng/beetmoverscript/blob/master/beetmoverscript/script.py#L274