I'm just going to consider the local rings with residue field $\mathbf{F}_p$.
Suppose A' is an extension of $\mathbf{Z}/p$ with ideal $\mathbf{Z}/p$. If we take the fiber product with $\mathbf{Z}$, we get an extension of $\mathbf{Z}$ with ideal $\mathbf{Z}/p$. Up to isomorphism, there is only one such extension: $B' = \mathbf{Z}[t] / (t^2, pt)$. The kernel of the map from B' to A' is isomorphic to $\mathbf{Z}$ and reduces modulo t to the ideal generated by p. Therefore, the square-zero extensions of $\mathbf{Z}/p$ are all isomorphic to $\mathbf{Z}[t] / (t^2, pt, p + \lambda t)$ for some $\lambda \not= 0$. If $\lambda$ is not a multiple of p, we get $\mathbf{Z} / p^2$; if $\lambda$ is a multiple of $p$, we get $\mathbf{Z}[t] / (p, tp, t^2) = \mathbf{F}_p[t] / t^2$. So these are all the length 2 finite local rings with residue field $\mathbf{F}_p$.
For length 3, we'll look for extensions of $\mathbf{Z} / p^2$ by $\mathbf{Z} / p$. The same analysis shows that these are all of the form $\mathbf{Z}[t] / (t^2, pt, p^2 + \lambda t)$. If $\lambda$ is not divisible by $p$, we get $\mathbf{Z} / p^3$ and if $\lambda$ is divisible by $p$ we get $\mathbf{Z}[t] / (p^2, pt, t^2)$.
We also have to look for extensions of $\mathbf{F}_p[t] / t^2$. By base change, any such extension A' gives an extension B' of $\mathbf{Z}[t]$ with ideal $\mathbf{Z} / p$. Once again, there is only one of these up to isomorphism (since $\mathbf{Z}[t]$ is projective, for example) and it is given by $\mathbf{Z}[t,u] / (u^2, pu, tu)$. The ideal of the map from B' to A' generates the ideal of the map from $\mathbf{Z}[t]$ to $\mathbf{F}_p[t] / t^2$. Since this is generated by p and t^2 the ideal of A' in B' is generated by $(p + \lambda u, t^2 + \mu u)$ and A' is of the form
$\mathbf{Z}[t,u] / (u^2, pu, tu, p + \lambda u, t^2 + \mu u)$
for some polynomials $\lambda, \mu \in \mathbf{Z}[t]$.
Edit: If $\lambda$ is not in $(p, t)$ then it is invertible in the quotient, so we get
$\mathbf{Z}[t,u] / (p^2, tp, t^2 + \mu \lambda^{-1} p)$.
There are two possibilities up to isomorphism here, depending on whether $- \mu \lambda^{-1}$ is a quadratic residue modulo p.
If $\lambda$ is in $(p,t)$ we get
$\mathbf{Z}[t,u] / (u^2, pu, tu, p, t^2 + \mu u) = \mathbf{F}_p[t,u] / (u^2, tu, t^2 + \mu u)$.
The $\mu$ is also not in $(p, t)$ then we get $\mathbf{F}[t] / t^3$. If $\mu$ is in $(p,t)$ we get $\mathbf{F}_p[t,u] / (u^2, tu, t^2)$.
Modulo any mistake I made above, I think a complete list is of length 3 finite local rings with residue field $\mathbf{F}_p$ is
- $\mathbf{Z} / p^3$,
- $\mathbf{Z}[t] / (p^2, pt, t^2)$,
- $\mathbf{Z}[t] / (t^2 - p, t^3)$,
- $\mathbf{Z}[t] / (t^2 - \alpha p, t^3)$ where $\alpha$ is a non-quadratic residue modulo $p$,
- $\mathbf{F}_p[t] / t^3$, and
- $\mathbf{F}_p[t,u] / (t,u)^2$.