Configure GitLab CI/CD variables
Store sensitive credentials and connection details as protected CI/CD variables:1
Go to your GitLab project.
2
Select Settings > CI/CD.
3
Expand Variables.
4
Add the following variables:
| Variable name | Value |
|---|---|
PKI_P12_B64 | Base64-encoded PKCS#12 certificate |
PKI_PASS | PKCS#12 certificate password |
Bash
client-cert.p12.b64 into the PKI_P12_B64 variable.
Why mask and protect: Protected variables are only exposed to protected branches (e.g., main). Masked variables are hidden in job logs. Both settings prevent credential exposure.
Create the pipeline configuration file
In your project root directory, create or edit.gitlab-ci.yml:
YAML
Configure project-wide timeout settings
The sign job can run for up to 3 days while waiting for approval. Increase the project-wide timeout:Why this matters: GitLab’s default job timeout is 1 hour. Without this change, sign jobs will fail before approvers complete the workflow.
1
Go to Settings > CI/CD.
2
Expand General pipelines.
3
Set Timeout to
259200 seconds (3 days).4
Select [ Save changes ].
Understand the pipeline structure
Stages:- build: Compiles the Windows executable using MinGW cross-compiler
- sign: Submits the executable to CryptoHub, polls for approval, downloads the signed artifact
build_exejob uses themingwtag, routing it to runners configured for MinGW buildssign_exejob uses thecodesigntag, routing it to runners with access to the Futurex registry
- The
build_exejob producesexample.exeas an artifact - GitLab automatically makes this artifact available to the
sign_exejob - The
sign_exejob overwritesexample.exewith the signed version and publishes it as a new artifact
Understand the build job configuration
YAML
image: Uses a public Docker image with MinGW cross-compiler pre-installedtags: [mingw]: Routes this job to runners with themingwtagscript: Compilesmain.cinto a Windows executableartifacts: Preservesexample.exefor the sign stage
main.c with your actual source files. For multi-file projects, adjust the compilation command or use a Makefile.
Understand the sign job configuration
The sign job performs five operations:- TLS setup: Decodes the PKCS #12 certificate and configures CryptoHub connection
- Request submission: Submits the executable for signing with a unique request name
- Status polling: Polls request status every 10 seconds until it reaches a terminal state (signed, denied, deleted)
- Signature download: Retrieves the signature for the executable when approval is complete. The Futurex CLI handles embedding the signature into the executable.
The GitLab service on the CryptoHub uses TLS authentication. This means authentication occurs automatically, immediately after the TLS negotiation, using the certificate itself rather than a username and password.
| Variable | Default | Purpose |
|---|---|---|
POLL_INTERVAL | 10 | Seconds between status checks |
MAX_ATTEMPTS | 0 | Maximum polling attempts (0 = infinite) |
CH_HOSTNAME | Must be defined. There is no default value. | CryptoHub server hostname |
CH_PORT | Must be defined. There is no default value. | CryptoHub server port |
- pending: Job sleeps for
POLL_INTERVALseconds and checks status again - signed: Job downloads the signature, and Futurex CLI embeds it in the executable.
- denied: Job fails immediately with exit code 2
- deleted/unknown: Job fails immediately with exit code 3 (request was removed from CryptoHub)
- MAX_ATTEMPTS reached: Job fails with exit code 124 (timeout)
| Exit code | Meaning | Action required |
|---|---|---|
| 0 | Success (signature downloaded) | None |
| 2 | Request denied by approver | Review denial reason in CryptoHub |
| 3 | Request deleted or unknown | Check CryptoHub logs; request may have been manually removed |
| 124 | Polling timeout reached | Increase MAX_ATTEMPTS or resolve approval delays |
Commit and test the pipeline
1
Commit
.gitlab-ci.yml to your repository:2
Go to your GitLab project and select CI/CD > Pipelines.
3
Verify the pipeline starts automatically.
4
Observe the build job complete within 1-2 minutes.
5
Monitor the sign job logs. The job will display status checks every 10 seconds:
6
Approve the signing request in CryptoHub.
7
Verify the sign job completes, downloads the signature, and embeds it into the artifact.
Result
You now have a working CI/CD pipeline that:- Automatically compiles Windows executables on every commit
- Submits signature requests to CryptoHub
- Polls for approval without manual intervention
- Downloads signatures from CryptoHub once they are approved and uses the Futurex CLI to embed them in artifacts for deployment

