A highly performing muon system has been fundamental to achieve many of the physics results obtained by CMS during the LHC Run-2. The CMS muon spectrometer presently consists of three detector technologies covering different regions of pseudorapidity. Drift Tube (DT) chambers equip the CMS muon system barrel, whereas Cathode Strip Chambers (CSC) are installed at the CMS endcaps; both are used for offline tracking and provide trigger capabilities. In addition, Resistive Plate Chambers (RPC) complement DT and CSC in both barrel and endcaps, and are mostly used in the trigger. Finally, at different stages of the CMS upgrade programme, the endcaps of the muon spectrometer will be equipped with multiple layers Gas Electron Multiplier (GEM) chambers. A slice test consisting of 10 GEM chambers was successfully operated in 2018, in parallel to the rest of the muon system, to gain experience in view of the installation of the first complete GEM layer, planned to happen during the second LHC long shutdown (LS2). In this report, the performance of the different detectors comprising the CMS muon system, together with the muon trigger performance, evaluated using data collected at a centre-of-mass energy of 13 TeV during the LHC Run-2, will be presented. The experience from the integration and commissioning of the GEM slice tests will also be discussed, and the status and plans towards the installation of the first complete layer of GEM detector, happening over LS2, will be highlighted.