Skip to content

(core): Normalize hashing algorithm between different OSs #14555

@TRANTANKHOA

Description

@TRANTANKHOA

The Question

How can I have the same asset hash when building the stack from different OS?
I'm very reluctant to implement a custom hash for the source content but the snapshot test we have will fail when run in the CI container since the snapshot was created on Windows.

Environment

  • CDK CLI Version: 1.100.0
  • Module Version: 1.100.0
  • Node.js Version: v14.16.0
  • OS: Windows 10 Pro 19042.928
  • Language (Version): ~3.9.7

Other information

For example I have a PythonFunction as belows

new PythonFunction(this, 'TaskMonitoringLambda', {
    entry: path.join(__dirname, '..', 'lambda'),
    index: 'failed_task_notification.py',
    handler: 'push',
    runtime: Runtime.PYTHON_3_7,
    retryAttempts: this.node.tryGetContext('max_retries'),
    memorySize: 128,
    functionName: `${machineID}TaskMonitoringLambda`,
    assetHashType: AssetHashType.SOURCE, // see https://github.com/aws/aws-cdk/pull/12984
    environment: {
        'FAILED_TASK_TOPIC': failedTaskTopic.topicArn,
        'REGION': this.node.tryGetContext('region'),
        'ENV': env
    }
})

and the asset hash for this is stable between repeated builds in Windows, despite cleaning out the caches and docker images etc..
However the hash produced in Centos container is different.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalityeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.feature/enhancementA new API to make things easier or more intuitive. A catch-all for general feature requests.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions