Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Simply press "Add" and add the environment variables:

Image RemovedImage Added

At the bottom of the page, press "Save" and you're done. The environment variables are now available to all slaves.

...

To protect the integrity of these secrets, you need to run on a restricted node. Please consult this guide for further details. Restri

Environment variables and the AWS profiles are not being propagated to the Docker containers. Thus, you have to do necessary actions before entering the Docker environment. An example can be found at https://github.com/apache/incubator-mxnet/blob/master/ci/Jenkinsfile_docker_cache and https://github.com/apache/incubator-mxnet/blob/master/ci/docker_cache.py

Retrieving credentials

In order to retrieve credentials, you have to query the AWS API using the instance profiles' credentials. This can be done with the following example code:

Code Block
languagepy
titleRetrieving credentials in Python
def _get_dockerhub_credentials():  # pragma: no cover
    import boto3
    import botocore
    secret_name = os.environ['DOCKERHUB_SECRET_NAME']
    endpoint_url = os.environ['DOCKERHUB_SECRET_ENDPOINT_URL']
    region_name = os.environ['DOCKERHUB_SECRET_ENDPOINT_REGION']

    session = boto3.Session()
    client = session.client(
        service_name='secretsmanager',
        region_name=region_name,
        endpoint_url=endpoint_url
    )
    try:
        get_secret_value_response = client.get_secret_value(
            SecretId=secret_name
        )
    except botocore.exceptions.ClientError as client_error:
        if client_error.response['Error']['Code'] == 'ResourceNotFoundException':
            logging.exception("The requested secret %s was not found", secret_name)
        elif client_error.response['Error']['Code'] == 'InvalidRequestException':
            logging.exception("The request was invalid due to:")
        elif client_error.response['Error']['Code'] == 'InvalidParameterException':
            logging.exception("The request had invalid params:")
        else:
            raise
    else:
        secret = get_secret_value_response['SecretString']
        secret_dict = json.loads(secret)
        return secret_dict