Control of a qubit under Markovian and non-Markovian noise