Given. $f(x)$, period $2\pi$: a trapezoidal "tent" — flat at height $\pi/2$ on the outer bands $\pi/2\le|x|\lt\pi$, rising linearly to a peak of $\pi$ at $x=0$ over $|x|\lt\pi/2$.
Find. The full Fourier series $f(x)=\tfrac{a_0}{2}+\sum_{n=1}^\infty\big[a_n\cos(nx)+b_n\sin(nx)\big]$.
Approach. Test symmetry first (an even function needs only cosine terms and halves the work); then compute $a_0$ and $a_n$ by splitting the integral over $[0,\pi]$ at the corner $x=\pi/2$.
Test symmetry. For $0\lt x\lt\pi/2$: $-x\in(-\pi/2,0)$, and on that branch $f(-x)=(-x)+\pi=\pi-x=f(x)$. For $\pi/2\le x\lt\pi$: $-x\in(-\pi,-\pi/2]$, and $f(-x)=\pi/2=f(x)$. So $\boxed{f(-x)=f(x)}$ everywhere: $f$ is even, hence $b_n=0$ for every $n$ and only cosine terms survive.
Compute $a_0$. For an even function, $a_0=\dfrac{2}{\pi}\displaystyle\int_0^{\pi}f(x)\,dx=\dfrac{2}{\pi}\left[\int_0^{\pi/2}(\pi-x)\,dx+\int_{\pi/2}^{\pi}\dfrac{\pi}{2}\,dx\right]$. The first piece is $\big[\pi x-\tfrac{x^2}{2}\big]_0^{\pi/2}=\tfrac{\pi^2}{2}-\tfrac{\pi^2}{8}=\tfrac{3\pi^2}{8}$; the second is $\tfrac{\pi}{2}\cdot\tfrac{\pi}{2}=\tfrac{\pi^2}{4}$. So
$$a_0=\dfrac{2}{\pi}\left(\dfrac{3\pi^2}{8}+\dfrac{\pi^2}{4}\right)=\dfrac{2}{\pi}\cdot\dfrac{5\pi^2}{8}=\dfrac{5\pi}{4}\quad\Rightarrow\quad\boxed{\dfrac{a_0}{2}=\dfrac{5\pi}{8}}$$
Compute $a_n$.
$$a_n=\dfrac{2}{\pi}\left[\int_0^{\pi/2}(\pi-x)\cos(nx)\,dx+\int_{\pi/2}^{\pi}\dfrac{\pi}{2}\cos(nx)\,dx\right]$$
Integrating the first piece by parts (once, since it is linear in $x$) and the second piece directly, then combining over a common denominator, collapses to the closed form
$$a_n=\dfrac{2\big[1-\cos(n\pi/2)\big]}{\pi n^2}$$
Assemble the series.
$$\boxed{f(x)=\dfrac{5\pi}{8}+\sum_{k=0}^{\infty}\dfrac{2}{\pi(2k+1)^2}\cos\big((2k+1)x\big)+\sum_{k=0}^{\infty}\dfrac{4}{\pi(4k+2)^2}\cos\big((4k+2)x\big)}$$
The sketch below confirms the even trapezoidal tent, peaking at $\pi\approx3.1416$ at $x=0$ and settling at the plateau $\pi/2\approx1.5708$ over $\pi/2\le|x|\lt\pi$, repeating with period $2\pi$.
Figure: $f(x)$ sketched over $[-2\pi,2\pi]$ — even, period $2\pi$, trapezoidal tent peaking at $\pi$.