-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3
- Loading branch information
Showing
38 changed files
with
1,190 additions
and
145 deletions.
There are no files selected for viewing
This file contains 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,2 +1,3 @@ | ||
.idea | ||
.pytest_cache | ||
.gitignore |
This file contains 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 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,13 @@ | ||
from exasol_script_languages_container_ci_setup.cli.commands import ( | ||
health, | ||
generate_buildspec, | ||
generate_release_buildspec, | ||
deploy_source_credentials, | ||
deploy_ci_build, | ||
deploy_release_build, | ||
validate_ci_build, | ||
validate_source_credentials | ||
validate_release_build, | ||
validate_source_credentials, | ||
start_release_build, | ||
start_test_release_build | ||
) |
This file contains 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
32 changes: 32 additions & 0 deletions
32
exasol_script_languages_container_ci_setup/cli/commands/deploy_release_build.py
This file contains 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,32 @@ | ||
import logging | ||
import sys | ||
from typing import Optional | ||
|
||
import click | ||
|
||
from exasol_script_languages_container_ci_setup.cli.cli import cli | ||
from exasol_script_languages_container_ci_setup.cli.common import add_options | ||
from exasol_script_languages_container_ci_setup.cli.options.logging import logging_options, set_log_level | ||
from exasol_script_languages_container_ci_setup.lib.aws_access import AwsAccess | ||
from exasol_script_languages_container_ci_setup.cli.options.aws_options import aws_options | ||
from exasol_script_languages_container_ci_setup.lib.release_build import run_deploy_release_build | ||
|
||
|
||
@cli.command() | ||
@add_options(aws_options) | ||
@add_options(logging_options) | ||
@click.option('--project', type=str, required=True, | ||
help="""The project for which the stack will be created.""") | ||
@click.option('--project-url', type=str, required=True, | ||
help="""The URL of the project on Github.""") | ||
def deploy_release_build( | ||
aws_profile: Optional[str], | ||
log_level: str, | ||
project: str, | ||
project_url: str): | ||
set_log_level(log_level) | ||
try: | ||
run_deploy_release_build(AwsAccess(aws_profile), project, project_url) | ||
except Exception: | ||
logging.error("run_deploy_release_build failed.") | ||
sys.exit(1) |
This file contains 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
33 changes: 33 additions & 0 deletions
33
exasol_script_languages_container_ci_setup/cli/commands/generate_release_buildspec.py
This file contains 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,33 @@ | ||
from typing import Tuple, Optional | ||
|
||
import click | ||
|
||
from exasol_script_languages_container_ci_setup.cli.cli import cli | ||
from exasol_script_languages_container_ci_setup.cli.common import add_options | ||
from exasol_script_languages_container_ci_setup.cli.options.logging import logging_options, set_log_level | ||
from exasol_script_languages_container_ci_setup.lib.run_generate_release_buildspec import run_generate_release_buildspec | ||
|
||
|
||
@cli.command() | ||
@add_options(logging_options) | ||
@click.option('--flavor-root-path', required=True, multiple=True, | ||
type=click.Path(file_okay=False, dir_okay=True, exists=True), | ||
help="Path where script language container flavors are located.") | ||
@click.option('--output-path', type=click.Path(file_okay=False, dir_okay=True, exists=True, writable=True), | ||
default="./aws-code-build/release", show_default=True, | ||
help="Path where buildspec files will be deployed.") | ||
@click.option('--config-file', type=click.Path(file_okay=True, dir_okay=False, exists=True), | ||
help="Configuration file for build (project specific).") | ||
def generate_release_buildspecs( | ||
flavor_root_path: Tuple[str, ...], | ||
log_level: str, | ||
output_path: str, | ||
config_file: Optional[str] | ||
): | ||
""" | ||
This command generates the buildspec file(s) for the AWS CodeBuild Release build based | ||
on the flavors located in path "flavor_root_path". | ||
""" | ||
set_log_level(log_level) | ||
run_generate_release_buildspec(flavor_root_path, output_path, config_file) | ||
|
34 changes: 34 additions & 0 deletions
34
exasol_script_languages_container_ci_setup/cli/commands/start_release_build.py
This file contains 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,34 @@ | ||
import os | ||
from typing import Optional | ||
|
||
import click | ||
|
||
from exasol_script_languages_container_ci_setup.cli.cli import cli | ||
from exasol_script_languages_container_ci_setup.cli.common import add_options | ||
from exasol_script_languages_container_ci_setup.cli.options.logging import logging_options, set_log_level | ||
from exasol_script_languages_container_ci_setup.lib.aws_access import AwsAccess | ||
from exasol_script_languages_container_ci_setup.cli.options.aws_options import aws_options | ||
from exasol_script_languages_container_ci_setup.lib.run_start_release_build import run_start_release_build | ||
|
||
|
||
@cli.command() | ||
@add_options(aws_options) | ||
@add_options(logging_options) | ||
@click.option('--project', type=str, required=True, | ||
help="""The project name. Must be same name as used for the AWS CodeBuild release stack creation.""") | ||
@click.option('--upload-url', type=str, required=False, | ||
help="""The URL of the Github release where artifacts will be stored.""") | ||
@click.option('--branch', type=str, required=True, | ||
help="""The branch of the repository which will be used.""") | ||
def start_release_build( | ||
aws_profile: Optional[str], | ||
log_level: str, | ||
project: str, | ||
upload_url: str, | ||
branch: str): | ||
""" | ||
This command triggers the AWS release Codebuild to upload the | ||
release artifacts onto the given Github release, indicated by parameter 'upload_url'. | ||
""" | ||
set_log_level(log_level) | ||
run_start_release_build(AwsAccess(aws_profile), project, upload_url, branch, os.getenv("GITHUB_TOKEN")) |
41 changes: 41 additions & 0 deletions
41
exasol_script_languages_container_ci_setup/cli/commands/start_test_release_build.py
This file contains 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,41 @@ | ||
import os | ||
from typing import Optional | ||
|
||
import click | ||
|
||
from exasol_script_languages_container_ci_setup.cli.cli import cli | ||
from exasol_script_languages_container_ci_setup.cli.common import add_options | ||
from exasol_script_languages_container_ci_setup.cli.options.logging import logging_options, set_log_level | ||
from exasol_script_languages_container_ci_setup.lib.aws_access import AwsAccess | ||
from exasol_script_languages_container_ci_setup.cli.options.aws_options import aws_options | ||
from exasol_script_languages_container_ci_setup.lib.github_draft_release_creator import GithubDraftReleaseCreator | ||
from exasol_script_languages_container_ci_setup.lib.run_start_release_build import run_start_test_release_build | ||
|
||
|
||
@cli.command() | ||
@add_options(aws_options) | ||
@add_options(logging_options) | ||
@click.option('--project', type=str, required=True, | ||
help="""The project name. Must be same name as used for the AWS CodeBuild release stack creation.""") | ||
@click.option('--repo-name', type=str, required=True, | ||
help="""The repository for which the test release should be created. | ||
For example 'exasol/script-languages'.""", ) | ||
@click.option('--branch', type=str, required=True, | ||
help="""The branch for which the test release should be created.""") | ||
@click.option('--release-title', type=str, required=True, | ||
help="""The title of the Github draft release which will be created.""") | ||
def start_test_release_build( | ||
aws_profile: Optional[str], | ||
log_level: str, | ||
repo_name: str, | ||
project: str, | ||
branch: str, | ||
release_title: str | ||
): | ||
""" | ||
This command creates a release draft on Github and triggers the AWS release Codebuild to upload the | ||
release artifacts onto the new Github release. | ||
""" | ||
set_log_level(log_level) | ||
run_start_test_release_build(AwsAccess(aws_profile), GithubDraftReleaseCreator(), | ||
repo_name, project, branch, release_title, os.getenv("GITHUB_TOKEN")) |
This file contains 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
26 changes: 26 additions & 0 deletions
26
exasol_script_languages_container_ci_setup/cli/commands/validate_release_build.py
This file contains 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,26 @@ | ||
from typing import Optional | ||
|
||
import click | ||
|
||
from exasol_script_languages_container_ci_setup.cli.cli import cli | ||
from exasol_script_languages_container_ci_setup.cli.common import add_options | ||
from exasol_script_languages_container_ci_setup.cli.options.logging import logging_options, set_log_level | ||
from exasol_script_languages_container_ci_setup.lib.aws_access import AwsAccess | ||
from exasol_script_languages_container_ci_setup.cli.options.aws_options import aws_options | ||
from exasol_script_languages_container_ci_setup.lib.release_build import run_validate_release_build | ||
|
||
|
||
@cli.command() | ||
@add_options(aws_options) | ||
@add_options(logging_options) | ||
@click.option('--project', type=str, required=True, | ||
help="""The project for which the stack will be created.""") | ||
@click.option('--project-url', type=str, required=True, | ||
help="""The URL of the project on Github.""") | ||
def validate_release_build( | ||
aws_profile: Optional[str], | ||
log_level: str, | ||
project: str, | ||
project_url: str): | ||
set_log_level(log_level) | ||
run_validate_release_build(AwsAccess(aws_profile), project, project_url) |
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_script_languages_container_ci_setup/cli/options/aws_options.py
This file contains 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,6 +1,6 @@ | ||
import click | ||
|
||
aws_options = [ | ||
click.option('--aws-profile', required=True, type=str, | ||
click.option('--aws-profile', required=False, type=str, | ||
help="Id of the AWS profile to use."), | ||
] |
This file contains 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
Oops, something went wrong.