Beispiel #1
0
def main():

    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--deploy-env', default='dev')
    parser.add_argument("--region", default="eu-west-1")
    parser.add_argument('--stack-name')
    parser.add_argument('--require-approval', default='broadening')
    parser.add_argument('--clean', nargs='?', const=True, help="Remove existing environment before deploying")
    parser.add_argument('--synth', nargs='?', const=True, help="Synthesize cloudformation.yml before deploying")
    parser.add_argument('--no-build', nargs='?', const=True, default=False, help="Skip lambda build")
    parser.add_argument('--skip-deps', nargs="?", const=True, default=False, help="Skip lambda dependencies")
    args = parser.parse_args()

    # environment update with the .env file
    init_local_dotenv()

    if not args.no_build:
        print("Building the lambda package...")
        do_build(consume_dependencies=not args.skip_deps)

    if args.clean:
        print("cdk destroy...")
        rc = os.system(f"cdk destroy")
        if rc != 0:
            print(f"cdk destroy failed with return code: {rc}")
            exit(1)

    if args.synth:
        print("cdk synth...")
        Path("cdk.out").mkdir(parents=True, exist_ok=True)
        rc = os.system(f"cdk synth --no-staging > .build{os.path.sep}template.yml")
        if rc:
            print(f"cdk synth failed with return code: {rc}")
            exit(1)

    print("cdk deploy...")
    rc = os.system(f"cdk deploy --require-approval {args.require_approval}")
    if rc:
        print(f"cdk deploy failed with return code: {rc}")
        exit(1)

    user_pool_id = users.get_user_pool_id(get_stack_name())

    password = os.environ.get('DEFAULT_USER_PASSWORD', default='Password123')
    email = os.environ.get('USER_EMAIL')
    users.create_user(getpass.getuser(), password, user_pool_id, email=email)

    ruleset_name = get_stack_output("RuleSetName")
    if ruleset_name is None:
        print("Error getting Ruleset name, please set the receipt rule set to active in the SES console")
        exit(1)

    ses = boto3.client('ses')
    ses.set_active_receipt_rule_set(RuleSetName=ruleset_name)
Beispiel #2
0
def main():
    last_frida_tag = util.get_last_frida_tag()
    last_project_tag = util.get_last_project_tag()
    last_commit_tag = util.get_last_commit_tag()
    new_project_tag = "0"

    if last_frida_tag != util.strip_revision(last_project_tag) \
        or (last_frida_tag != util.strip_revision(last_commit_tag)
            and util.get_commit_message().lower() == "release"):

        new_project_tag = util.get_next_revision(last_frida_tag)
        print(f"Update needed to {new_project_tag}")

        # for use by deployment
        with open("NEW_TAG.txt", "w") as the_file:
            the_file.write(new_project_tag)
    else:
        print("All good!")

    build.do_build(last_frida_tag, new_project_tag)
Beispiel #3
0
for arg in sys.argv:
    arg = arg.lower()
    if arg == "test.py":
        continue
    elif arg == "debug":
        flavor = "Debug"
    elif arg == "release":
        flavor = "Release"
    elif arg == "nobuild":
        nobuild = True
    else:
        log("unrecognized argument: " + arg)
        sys.exit()

if not nobuild:
    result = build.do_build(root_dir, True, True,
                            flavor)  # should_make, should_build
    if result.returncode != 0:
        log("build failed with exit code {0} => won't execute the tests".
            format(result.returncode))
        log("to execute the tests from the last successful build run `test.py nobuild`"
            )
        sys.exit()

install_dir = os.path.join(root_dir, "build", platform.system(), flavor, "bin")
if not os.path.isdir(install_dir):
    log("please build first: 'build.py [debug|release] [ir]'")
    sys.exit()

print("\n")

# Configure DLL lookup locations to include full state simulator and qdk