Sudan 's government and southern rebels have signed an agreement promising to end the nation 's 21-year civil war by the end of the year .