mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-11 17:50:08 +01:00
Merge branch 'feat/cicd-component' into 'main'
feat: add CI Component template See merge request TECHNOFAB/nix-gitlab-ci!3
This commit is contained in:
commit
f30adf88d3
4 changed files with 49 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
include:
|
include:
|
||||||
- gitlab-ci.yml
|
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/nix-gitlab-ci@$CI_COMMIT_SHA
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
|
@ -16,9 +16,10 @@ build:image:
|
||||||
- export PATH="$PATH:$HOME/.nix-profile/bin"
|
- export PATH="$PATH:$HOME/.nix-profile/bin"
|
||||||
script:
|
script:
|
||||||
- nix build .#image${VARIANT}
|
- nix build .#image${VARIANT}
|
||||||
|
- export NORMALIZED_BRANCH=${CI_COMMIT_BRANCH/\//-}
|
||||||
- skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}" --tmpdir /tmp
|
- skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}" --tmpdir /tmp
|
||||||
"docker-archive:result"
|
"docker-archive:result"
|
||||||
"docker://$CI_REGISTRY_IMAGE/nix-ci:${CI_COMMIT_BRANCH/main/latest}${VARIANT}"
|
"docker://$CI_REGISTRY_IMAGE/nix-ci:${NORMALIZED_BRANCH/main/latest}${VARIANT}"
|
||||||
- skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}" --tmpdir /tmp
|
- skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}" --tmpdir /tmp
|
||||||
"docker-archive:result"
|
"docker-archive:result"
|
||||||
"docker://$CI_REGISTRY_IMAGE/nix-ci:$(date +"%m-%d-%y")${VARIANT}"
|
"docker://$CI_REGISTRY_IMAGE/nix-ci:$(date +"%m-%d-%y")${VARIANT}"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ which can be imported in multiple projects.
|
||||||
```yaml
|
```yaml
|
||||||
# .gitlab-ci.yml
|
# .gitlab-ci.yml
|
||||||
include:
|
include:
|
||||||
- project: TECHNOFAB/nix-gitlab-ci
|
- component: gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci@0.2.0
|
||||||
ref: main
|
inputs:
|
||||||
file: gitlab-ci.yml
|
# specify inputs here, for example:
|
||||||
|
image_tag: latest-cachix
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
#
|
||||||
|
# NOTE: DEPRECATED: please switch to the CI/CD Component or include "templates/nix-gitlab-ci.yml"
|
||||||
|
#
|
||||||
variables:
|
variables:
|
||||||
# latest | latest-cachix | latest-attic etc.
|
# latest | latest-cachix | latest-attic etc.
|
||||||
NIX_CI_IMAGE_TAG: latest
|
NIX_CI_IMAGE_TAG: latest
|
||||||
|
|
|
||||||
38
templates/nix-gitlab-ci.yml
Normal file
38
templates/nix-gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
spec:
|
||||||
|
inputs:
|
||||||
|
image_tag:
|
||||||
|
type: string
|
||||||
|
description: "latest | latest-cachix | latest-attic etc."
|
||||||
|
default: latest
|
||||||
|
---
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- trigger
|
||||||
|
|
||||||
|
nix-ci:build:
|
||||||
|
stage: build
|
||||||
|
image: registry.gitlab.com/technofab/nix-gitlab-ci/nix-ci:$[[ inputs.image_tag ]]
|
||||||
|
before_script:
|
||||||
|
- source setup_nix_ci
|
||||||
|
script:
|
||||||
|
# build the generated-gitlab-ci.yml
|
||||||
|
- nix build .#gitlab-ci-config
|
||||||
|
- install result generated-gitlab-ci.yml
|
||||||
|
after_script:
|
||||||
|
# upload to binary cache
|
||||||
|
- finalize_nix_ci
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- generated-gitlab-ci.yml
|
||||||
|
|
||||||
|
nix-ci:trigger:
|
||||||
|
stage: trigger
|
||||||
|
needs:
|
||||||
|
- nix-ci:build
|
||||||
|
trigger:
|
||||||
|
include:
|
||||||
|
- artifact: generated-gitlab-ci.yml
|
||||||
|
job: nix-ci:build
|
||||||
|
strategy: depend
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue