Skip to content

build api: fix release version #12982

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

Merged
merged 9 commits into from
May 18, 2020
Merged

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented May 15, 2020

Summary of changes

This is non trivial fix as the function is being used outside of this repository.
Tools rely on it to return list of targets for 2 or 5. As we removed release_version from many targets,
this broke the logic. To keep the logic as it was, without updating all tools out there now,
lets just return full set of targets - all are supported.

In case for Mbed 2, returning all targets does not make sense, but rather raise an exception here. Not supported. This avoids suprised. If you look at build api functions there are many checks for 2 or 5 so more
clean up needed to actually get release_version out of the tools.

Impact of changes

Migration actions required

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[x] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@0xc0170
Copy link
Contributor Author

0xc0170 commented May 15, 2020

Run the first series of tests

@evedon evedon requested a review from hugueskamba May 15, 2020 16:09
@mergify mergify bot added the needs: work label May 15, 2020

if version == `2`:
raise InvalidReleaseTargetException("Mbed 2 not supported anymore with this version of tools")

mbed_official_release = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure the syntax is correct here. Can you run the script with your changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking what CI expected and seems to be as it is here. will study CI results once we get some, if all is being tested as it should

@hugueskamba
Copy link
Collaborator

@evedon
I thought this is script is only used to build Mbed 2. Nothing should be running it anymore since support for Mbed 2 has been dropped.

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 15, 2020

We had previously similar experience, tools are used in expected way - this release version is due to supporting multiple versions so CI had to check for version + target.

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 16, 2020

I fixed travis error

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

CI started

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

ci restarted

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

CI restarted

I changed the approach for mbed 2 in that function, can't afford to raise an exception as that is a breaking change there for now. Rather return an empty tuple, as that is what others expect (CI should not break - if we use exception, I would need to refactor CI config and others).

@mergify mergify bot added needs: work and removed needs: CI labels May 18, 2020
@mbed-ci
Copy link

mbed-ci commented May 18, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 4
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

Ci restarted, can't find the error only jenkins generic exception

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

I found the errors in the log, investigating

0xc0170 and others added 5 commits May 18, 2020 08:57
This is non trivial fix as the function is being used outside of this repository.
Tools rely on it to return list of targets for 2 or 5. As we removed release_version from many targets,
this broke the logic. To keep the logic as it was, without updating all tools out there now,
lets just return full set of targets - all are supported.

In case for Mbed 2, returning all targets does not make sense, but rather raise an exception here. Not supported. This avoids suprised. If you look at build api functions there are many checks for 2 or 5 so more
clean up needed to actually get release_version out of the tools.
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
We cant afford to raise an exception now. As anyone using this out there do not catch it. Rather
an empty list, as it can work after this fix - won't do anything.
@0xc0170 0xc0170 force-pushed the fix_release_version branch from 5a65d26 to 59db9f6 Compare May 18, 2020 07:57
@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

Rebased on top of master to be sure we got all needed (the latest targets removals)

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

CI restarted

@MarceloSalazar The failures might be related to the latest removals (mbed 2 only targets?), will need to check. It might be that CI ignored it previously based on release_version. Lets review CI once it completes after my latest rebase

@mergify mergify bot added needs: work and removed needs: CI labels May 18, 2020
@mbed-ci
Copy link

mbed-ci commented May 18, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 6
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-ARM

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

@jeromecoutant would you know why some nucleo fail here:

mbed-os-example-blinky
[Warning] @0,0: L3912W: Option 'legacyalign' is deprecated.
[Error] @0,0: L6218E: Undefined symbol Image$$ARM_LIB_HEAP$$ZI$$Base (referred from BUILD/NUCLEO_F070RB/ARM/mbed-os/rtos/source/TARGET_CORTEX/TOOLCHAIN_ARM_STD/mbed_boot_arm_std.o).

These targets were supported in Mbed OS 5, so should build without errors with this fix we have in here.

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

@jeromecoutant we identified a bug, its in the CI tools (+ this fix), its around baremetal, we are working on fixing that.

@jamesbeyond
Copy link
Contributor

jamesbeyond commented May 18, 2020

After some discussion/investigation, I think we are going to need a way of distinguishing mbed 6 bare-metal profile only targets from the targets support both bare-metal and rtos.

in current targets.json file, "supported_application_profiles": ["bare-metal"] is a bit ambiguity, we can't really claim this target support bare-metal ONLY, unless all other targets have "supported_application_profiles": ["bare-metal","rtos"] .
Maybe we can put this into the top-level target, so every one inherits by default?

So the above context, I'd like to propose the change to this impacted functions to

def get_mbed_official_release(version, profile=None):
    if version == '2':
        return tuple(tuple([]))

    if version in ['5', '6']:
        mbed_official_release = (
            tuple(
                tuple(
                    [
                        TARGET_MAP[target].name,
                        tuple(['ARM', 'GCC_ARM'])
                    ]
                ) for target in TARGET_NAMES \
                if not profile or profile in TARGET_MAP[target].supported_application_profiles
            )
        )

    return mbed_official_release

if the profile parameter not given, it treated as querying for all profiles.
So in the CI scripts, I can use build_api.get_mbed_official_release(6 profile="rtos") to query the targets only support RTOS

@0xc0170 @evedon @MarceloSalazar

mbed_official_release = (
tuple(
tuple(
[
TARGET_MAP[target].name,
tuple(transform_release_toolchains(
TARGET_MAP[target], version))
tuple(['ARM', 'GCC_ARM'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wonder why do we use hard-coded tuple here? instead of calling the function? and IAR been dropped?
We can fix the function if need?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to avoid refactoring at the moment (so changes just to one function to get the functionality needed). transform_release_toolchains does not have much meaning anymore as only ARM or GCC ARM is supported, so this can be hardcoded here

0xc0170 added 3 commits May 18, 2020 19:31
To select supported_application_profiles attribute from targets
Every target is assumed to supported Mbed OS. If its not the case, it supports
only baremetal. Thus removing rtos, and adding bare-metal to the app profile.
For only baremetal targets, just drop in replace. Don't need to add/remove.
@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

I updated the PR as proposed (adding rtos and baremetal t o the top level Target and overwrite it for some).

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

CI started

@0xc0170
Copy link
Contributor Author

0xc0170 commented May 18, 2020

@jamesbeyond if CI merges, please merge this to test this with nightly asap.

@mbed-ci
Copy link

mbed-ci commented May 18, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 7
Build artifacts

@jamesbeyond
Copy link
Contributor

CI passed, merging PR

@jamesbeyond jamesbeyond merged commit f478a21 into ARMmbed:master May 18, 2020
@mergify mergify bot removed the ready for merge label May 18, 2020
@hugueskamba
Copy link
Collaborator

After some discussion/investigation, I think we are going to need a way of distinguishing mbed 6 bare-metal profile only targets from the targets support both bare-metal and rtos.

in current targets.json file, "supported_application_profiles": ["bare-metal"] is a bit ambiguity, we can't really claim this target support bare-metal ONLY, unless all other targets have "supported_application_profiles": ["bare-metal","rtos"] .
Maybe we can put this into the top-level target, so every one inherits by default?

So the above context, I'd like to propose the change to this impacted functions to

def get_mbed_official_release(version, profile=None):
    if version == '2':
        return tuple(tuple([]))

    if version in ['5', '6']:
        mbed_official_release = (
            tuple(
                tuple(
                    [
                        TARGET_MAP[target].name,
                        tuple(['ARM', 'GCC_ARM'])
                    ]
                ) for target in TARGET_NAMES \
                if not profile or profile in TARGET_MAP[target].supported_application_profiles
            )
        )

    return mbed_official_release

if the profile parameter not given, it treated as querying for all profiles.
So in the CI scripts, I can use build_api.get_mbed_official_release(6 profile="rtos") to query the targets only support RTOS

@0xc0170 @evedon @MarceloSalazar

All targets will inherit "supported_application_profiles":["bare-metal", "rtos"] except those that will overwrite the attribute to say "supported_application_profiles":["bare-metal"]. This is because it will indeed be added to the parent of all targets ("Target"). It will therefore be easy to determine which targets only support the bare-metal profile (if not "rtos" in target.supported_application_profiles: pass; ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants