What you're looking for seems to be gitlab secrets:
Secrets management is the systems that developers use to securely store sensitive data in a secure environment with strict access controls. A secret is a sensitive credential that should be kept confidential. Examples of a secret include:
- Passwords
- SSH keys
- Access tokens
- Any other types of credentials where exposure would be harmful to an organization
They are specifically required by a job and are not viewable by every person who has access to the job's log. You might want to also take a look at pipeline security