President Donald Trump has announced that Defense Secretary Jim Mattis will retire at the end of February.