Esempio n. 1
0
def _download(buildpack_dir, build_path, cache_dir):
    util.resolve_dependency(
        DEPENDENCY,
        os.path.join(build_path, NAMESPACE),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
    )
Esempio n. 2
0
def stage(buildpack_dir, install_path, cache_path):
    if get_new_relic_license_key():
        util.resolve_dependency(
            "%s.agent" % NAMESPACE,
            _get_destination_dir(install_path),
            buildpack_dir=buildpack_dir,
            cache_dir=cache_path,
        )
Esempio n. 3
0
def stage(buildpack_dir, build_dir, cache_dir):
    logging.debug("Staging logging...")
    NAMESPACE = ARTIFACT = "mendix-logfilter"
    util.resolve_dependency(
        "logs.%s" % NAMESPACE,
        os.path.join(build_dir, ".local", NAMESPACE),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
    )
Esempio n. 4
0
def _download_pkgs(buildpack_dir, install_path, cache_dir):
    # Download producer streams artifact
    overrides = {}
    version = os.getenv("DATABROKER_STREAMS_VERSION")
    if version:
        overrides = {"version": version}
    util.resolve_dependency(
        DEPENDENCY,
        os.path.join(install_path, PDR_STREAMS_DIR),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
        overrides=overrides,
    )
Esempio n. 5
0
def _download(buildpack_dir, build_path, cache_dir):
    util.resolve_dependency(
        "%s.buildpack" % NAMESPACE,
        os.path.join(build_path, NAMESPACE),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
    )
    util.resolve_dependency(
        TRACE_AGENT_DEPENDENCY,
        os.path.join(build_path, NAMESPACE),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
        unpack=False,
    )
Esempio n. 6
0
def ensure_and_get_jvm(
    java_major_version,
    buildpack_dir,
    cache_dir,
    dot_local_location,
    package="jdk",
):
    # Get Java override full version override
    override_version = os.getenv(JAVA_VERSION_OVERRIDE_KEY)
    overrides = {}
    if override_version:
        logging.info("Overriding Java version to [%s]..." % override_version)
        if not override_version.isdigit():
            overrides = {
                "version": override_version,
            }

    # Get dependency
    dependency = _get_java_dependency(
        java_major_version, package, buildpack_dir, overrides
    )

    jdk_dir = _compose_jvm_target_dir(dependency)

    rootfs_java_path = "/{}".format(jdk_dir)
    if not os.path.isdir(rootfs_java_path):
        logging.debug(
            "Downloading and installing Java {} if required...".format(
                package.upper()
            )
        )
        util.resolve_dependency(
            dependency,
            os.path.join(dot_local_location, jdk_dir),
            buildpack_dir=buildpack_dir,
            cache_dir=cache_dir,
            unpack_strip_directories=True,
            overrides=overrides,
        )
        logging.debug("Java {} installed".format(package.upper()))
    else:
        logging.debug("Root FS with Java SDK detected, not installing Java")

    return util.get_existing_directory_or_raise(
        [
            "/" + jdk_dir,
            os.path.join(dot_local_location, jdk_dir),
        ],
        "Java not found",
    )
Esempio n. 7
0
def stage(buildpack_dir, destination_path, cache_path):
    if appdynamics_used():
        util.resolve_dependency(
            "appdynamics.agent",
            # destination_path - DOT_LOCAL_LOCATION
            destination_path + "/appdynamics/",
            buildpack_dir=buildpack_dir,
            cache_dir=cache_path,
        )

        if machine_agent_enabled():
            util.resolve_dependency(
                "appdynamics.machine-agent",
                destination_path + "/appdynamics/machineagent/",
                buildpack_dir=buildpack_dir,
                cache_dir=cache_path,
            )
Esempio n. 8
0
def stage(buildpack_dir, build_path, cache_path):
    if is_enabled():
        try:
            util.resolve_dependency(
                "dynatrace.agent",
                build_path,  # DOT_LOCAL_LOCATION,
                buildpack_dir=buildpack_dir,
                cache_dir=cache_path,  # CACHE_DIR,
                unpack=True,
                overrides={
                    "url": os.environ.get("DT_SAAS_URL"),
                    "environment": os.environ.get("DT_TENANT"),
                    "token": os.environ.get("DT_PAAS_TOKEN"),
                },
            )
        except Exception as e:
            logging.warning("Dynatrace agent download and unpack failed",
                            exc_info=True)
Esempio n. 9
0
def stage(buildpack_path, build_path, cache_path):
    logging.debug("Staging nginx...")
    shutil.copytree(
        os.path.join(buildpack_path, "etc/nginx"),
        os.path.join(build_path, "nginx"),
    )

    if not _is_custom_nginx():
        logging.debug("Downloading nginx...")
        util.resolve_dependency(
            "nginx",
            os.path.join(build_path, "nginx"),
            buildpack_dir=buildpack_path,
            cache_dir=cache_path,
        )
    else:
        logging.debug(
            "Custom nginx path provided, nginx will not be downloaded"
        )
Esempio n. 10
0
def _download_pkgs(buildpack_dir, install_path, cache_dir):
    # Download kafka connect and debezium
    util.resolve_dependency(
        "%s.kafka-connect" % NAMESPACE,
        os.path.join(install_path, BASE_DIR, KAFKA_CONNECT_DIR),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
    )
    overrides = {}
    version = os.getenv("DATABROKER_DBZ_VERSION")
    if version:
        overrides = {"version": version}
    util.resolve_dependency(
        "%s.debezium" % NAMESPACE,
        os.path.join(install_path, BASE_DIR, DBZ_DIR),
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
        overrides=overrides,
    )
Esempio n. 11
0
def stage(buildpack_dir, install_dir, cache_dir, runtime_version):
    if is_enabled(runtime_version):
        util.resolve_dependency(
            DEPENDENCY,
            _get_destination_dir(install_dir),
            buildpack_dir=buildpack_dir,
            cache_dir=cache_dir,
            unpack=False,
        )
        shutil.copy(
            os.path.join(
                buildpack_dir,
                "etc",
                "mx-java-agent",
                "DefaultInstrumentationConfig.json",
            ),
            os.path.join(
                _get_destination_dir(install_dir),
                "DefaultInstrumentationConfig.json",
            ),
        )
Esempio n. 12
0
def resolve_runtime_dependency(
    buildpack_dir,
    build_dir,
    cache_dir,
    destination=None,
    prefix="mendix",
):
    url = os.getenv(FORCED_MXRUNTIME_URL_KEY, util.get_blobstore())
    if url.endswith("/"):
        url = url[:-1]
    if not destination:
        destination = os.path.join(build_dir, "runtimes")
    util.resolve_dependency(
        "mendix.runtime.%s" % prefix,
        destination,
        buildpack_dir=buildpack_dir,
        cache_dir=cache_dir,
        ignore_cache=FORCED_MXRUNTIME_URL_KEY in os.environ,
        overrides={
            "version": str(get_runtime_version(build_dir)),
            "url": url,
        },
    )
Esempio n. 13
0
def stage(buildpack_path, cache_path, local_path, java_major_version):
    logging.debug("Staging Java...")

    # Download Java
    util.mkdir_p(os.path.join(local_path, "bin"))
    jvm_location = ensure_and_get_jvm(
        java_major_version,
        buildpack_path,
        cache_path,
        local_path,
        package="jre",
    )

    # Create a symlink in .local/bin/java
    os.symlink(
        # Use .. when JDK is in .local because absolute path
        # is different at staging time
        os.path.join(jvm_location.replace(local_path, ".."), "bin", "java"),
        os.path.join(local_path, "bin", "java"),
    )

    # Import Mozilla CA certificates
    # This is done by a third-party tool (keyutil),
    # using the Python certifi certificate bundle
    #
    # Recent versions of Adoptium have these on board,
    # we should reconsider importing these certificates ourselves.
    dependency = util.resolve_dependency(
        "java.keyutil",
        None,
        buildpack_dir=buildpack_path,
        cache_dir=cache_path,
    )
    _update_java_cacert(
        os.path.basename(dependency["artifact"]), cache_path, jvm_location
    )

    # Configure if TLSv1.0 and TLSv1.1 are allowed for outgoing connections
    _configure_outgoing_tls_10_11(jvm_location, java_major_version)

    logging.debug("Staging Java finished")