chore(gitlab-ci): upload to docker registry directly

This commit is contained in:
Gregor Kleen 2021-09-22 16:07:44 +02:00
parent f010028cc1
commit 1c1a63cfd0
3 changed files with 28 additions and 18 deletions

View File

@ -6,7 +6,7 @@ workflow:
default:
image:
name: registry.gitlab.com/fradrive/fradrive/nix-unstable:hcdba12p7ajl9xylgmw4kfn6p9c185xy
name: registry.gitlab.com/fradrive/fradrive/nix-unstable:0.1.0
variables:
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"
@ -233,7 +233,7 @@ demo docker:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDemoDocker
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx-demo.nar.xz # image is already compressed, closure isn't, therefore xz
- cp -pr --reflink=auto -L result uniworx-demo.tar.gz
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -252,18 +252,22 @@ demo docker:
artifacts: false
artifacts:
paths:
- uniworx-demo.nar.xz
- uniworx-demo.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day"
retry: 2
interruptible: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: manuel
allow_failure: true
docker:
stage: docker:build
script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDocker
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx.nar.xz # image is already compressed, closure isn't, therefore xz
- cp -pr --reflink=auto -L result uniworx.tar.gz
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -280,11 +284,15 @@ docker:
artifacts: false
artifacts:
paths:
- uniworx.nar.xz
- uniworx.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day"
retry: 2
interruptible: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: manuel
allow_failure: true
parse changelog:
stage: prepare release
@ -311,7 +319,7 @@ parse changelog:
upload docker:
stage: upload
script:
- xzcat uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L run .#pushUniworxDocker
before_script: *nix-before
needs:
@ -323,12 +331,10 @@ upload docker:
artifacts: false
- job: uniworx:lib:uniworx # transitive
artifacts: false
- job: uniworx:exe:uniworx # transitive
artifacts: false
- job: check # transitive
artifacts: false
- job: docker
- job: uniworx:exe:uniworx
artifacts: true
- job: check # sanity
artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success
@ -336,7 +342,8 @@ upload docker:
upload demo docker:
stage: upload
script:
- xzcat uniworx-demo.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
- nix -L run .#pushUniworxDemoDocker
before_script: *nix-before
needs:
@ -348,12 +355,12 @@ upload demo docker:
artifacts: false
- job: uniworx:lib:uniworx # transitive
artifacts: false
- job: uniworx:exe:uniworx # transitive
artifacts: false
- job: check # transitive
artifacts: false
- job: demo docker
- job: uniworx:exe:uniworx
artifacts: true
- job: uniworx:exe:uniworxdb
artifacts: true
- job: check # sanity
artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success

View File

@ -0,0 +1,3 @@
{
"version": "0.1.0"
}

View File

@ -126,7 +126,7 @@ in
ciDocker = prev.dockerTools.buildImageWithNixDb rec {
name = "uniworx-ci";
inherit created;
tag = fromImage.imageTag;
tag = (builtins.fromJSON (prev.lib.readFile ./ci-version.json)).version;
fromImage = prev.docker-nixpkgs.nix-unstable;
contents = with final; [