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: default:
image: image:
name: registry.gitlab.com/fradrive/fradrive/nix-unstable:hcdba12p7ajl9xylgmw4kfn6p9c185xy name: registry.gitlab.com/fradrive/fradrive/nix-unstable:0.1.0
variables: variables:
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz" 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:uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDemoDocker - 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 before_script: *nix-before
needs: needs:
- job: node dependencies # transitive - job: node dependencies # transitive
@ -252,18 +252,22 @@ demo docker:
artifacts: false artifacts: false
artifacts: artifacts:
paths: paths:
- uniworx-demo.nar.xz - uniworx-demo.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day" expire_in: "1 day"
retry: 2 retry: 2
interruptible: true interruptible: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: manuel
allow_failure: true
docker: docker:
stage: docker:build stage: docker:build
script: script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDocker - 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 before_script: *nix-before
needs: needs:
- job: node dependencies # transitive - job: node dependencies # transitive
@ -280,11 +284,15 @@ docker:
artifacts: false artifacts: false
artifacts: artifacts:
paths: paths:
- uniworx.nar.xz - uniworx.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day" expire_in: "1 day"
retry: 2 retry: 2
interruptible: true interruptible: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: manuel
allow_failure: true
parse changelog: parse changelog:
stage: prepare release stage: prepare release
@ -311,7 +319,7 @@ parse changelog:
upload docker: upload docker:
stage: upload stage: upload
script: script:
- xzcat uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L run .#pushUniworxDocker - nix -L run .#pushUniworxDocker
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -323,12 +331,10 @@ upload docker:
artifacts: false artifacts: false
- job: uniworx:lib:uniworx # transitive - job: uniworx:lib:uniworx # transitive
artifacts: false artifacts: false
- job: uniworx:exe:uniworx # transitive - job: uniworx:exe:uniworx
artifacts: false
- job: check # transitive
artifacts: false
- job: docker
artifacts: true artifacts: true
- job: check # sanity
artifacts: false
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success when: on_success
@ -336,7 +342,8 @@ upload docker:
upload demo docker: upload demo docker:
stage: upload stage: upload
script: 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 - nix -L run .#pushUniworxDemoDocker
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -348,12 +355,12 @@ upload demo docker:
artifacts: false artifacts: false
- job: uniworx:lib:uniworx # transitive - job: uniworx:lib:uniworx # transitive
artifacts: false artifacts: false
- job: uniworx:exe:uniworx # transitive - job: uniworx:exe:uniworx
artifacts: false
- job: check # transitive
artifacts: false
- job: demo docker
artifacts: true artifacts: true
- job: uniworx:exe:uniworxdb
artifacts: true
- job: check # sanity
artifacts: false
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success 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 { ciDocker = prev.dockerTools.buildImageWithNixDb rec {
name = "uniworx-ci"; name = "uniworx-ci";
inherit created; inherit created;
tag = fromImage.imageTag; tag = (builtins.fromJSON (prev.lib.readFile ./ci-version.json)).version;
fromImage = prev.docker-nixpkgs.nix-unstable; fromImage = prev.docker-nixpkgs.nix-unstable;
contents = with final; [ contents = with final; [