Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:18015] fix the compile issue for slim image (#18015) #18057

Merged
merged 1 commit into from
Feb 7, 2024

Commits on Feb 7, 2024

  1. fix the compile issue for slim image (sonic-net#18015)

    Why I did it
    The PR introduced a bug for slim image build, sonic-net#17905, by which the sonic_asic_platform is missing when build docker image for slim image.
    
    [ building ] [ target/docker-dhcp-relay.gz ]
    /sonic/dockers/docker-dhcp-relay/cli-plugin-tests /sonic
    /sonic
    Traceback (most recent call last):
      File "/usr/local/bin/j2", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.9/dist-packages/j2cli/cli.py", line 202, in main
        output = render_command(
      File "/usr/local/lib/python3.9/dist-packages/j2cli/cli.py", line 186, in render_command
        result = renderer.render(args.template, context)
      File "/usr/local/lib/python3.9/dist-packages/j2cli/cli.py", line 85, in render
        return self._env \
      File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1090, in render
        self.environment.handle_exception()
      File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "/sonic/dockers/docker-dhcp-relay/Dockerfile.j2", line 48, in top-level template code
        {% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
    jinja2.exceptions.UndefinedError: 'sonic_asic_platform' is undefined
    make: *** [slave.mk:1072: target/docker-dhcp-relay.gz] Error 1
    make: *** Waiting for unfinished jobs....
    [ finished ] [ target/docker-swss-layer-bullseye.gz ]
    [ finished ] [ target/docker-syncd-brcm-dnx.gz ]
    make[1]: *** [Makefile.work:608: target/sonic-broadcom.bin] Error 2
    make[1]: Leaving directory '/data/work/1/s'
    make: *** [Makefile:41: target/sonic-broadcom.bin] Error 2
    And why it slipped the PR test? PR test doesn't compile with slim option, it won't check sonic_asic_platform != "broadcom" for PR build.
    
    Work item tracking
    Microsoft ADO (number only):
    How I did it
    Export sonic_asic_platform for docker build in slave.mk
    
    How to verify it
    build with slim image option.
    StormLiangMS authored and mssonicbld committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    ca6a106 View commit details
    Browse the repository at this point in the history