Loading .gitlab-ci.yml +38 −3 Original line number Diff line number Diff line # See https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml image: python:latest image: nixos/nix build-job: stages: - build - comment variables: NIX_CACHE_HOME: "./nix-cache" build: rules: - if: $CI_PIPELINE_SOURCE == $CI_PIPELINE_SOURCE # Truly terrible syntax (otherwise, won’t run during MR as a side effect of the rule in comment-link ) stage: "build" cache: key: nix-user-cache paths: - nix-cache script: - "python ./tools/merge_data.py ./entries atlas.json" - NIX_CACHE_HOME=$(pwd)/nix-cache - "nix run --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs/25.05#python3 -- ./tools/merge_data.py ./entries atlas.json" artifacts: expire_in: "1 year" expose_as: "atlas_json" paths: - "atlas.json" comment: stage: "comment" rules: - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'" cache: key: nix-user-cache paths: - nix-cache script: # Here are the comments that will always be added # - DOCUMENTATION="Did you update the corresponding documentation?" # Here we parse them into URL # - DOCUMENTATION_PARSED=$(echo $DOCUMENTATION | sed 's/ /%20/g') - NIX_CACHE_HOME=$(pwd)/nix-cache - ATLAS_JSON_URL=$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/refs/merge-requests/$CI_MERGE_REQUEST_IID/head/raw/atlas.json?job=build - BODY="You can preview the data at https://atlas.mariusdavid.fr?atlas=$(nix --extra-experimental-features nix-command --extra-experimental-features flakes run nixpkgs/25.05#urlencode -- $ATLAS_JSON_URL)" - echo $BODY # And finally we post them on your merge request! - 'curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_CI_COMMENT_API_KEY}" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes" --data-urlencode "body=$BODY"' No newline at end of file Loading
.gitlab-ci.yml +38 −3 Original line number Diff line number Diff line # See https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml image: python:latest image: nixos/nix build-job: stages: - build - comment variables: NIX_CACHE_HOME: "./nix-cache" build: rules: - if: $CI_PIPELINE_SOURCE == $CI_PIPELINE_SOURCE # Truly terrible syntax (otherwise, won’t run during MR as a side effect of the rule in comment-link ) stage: "build" cache: key: nix-user-cache paths: - nix-cache script: - "python ./tools/merge_data.py ./entries atlas.json" - NIX_CACHE_HOME=$(pwd)/nix-cache - "nix run --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs/25.05#python3 -- ./tools/merge_data.py ./entries atlas.json" artifacts: expire_in: "1 year" expose_as: "atlas_json" paths: - "atlas.json" comment: stage: "comment" rules: - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'" cache: key: nix-user-cache paths: - nix-cache script: # Here are the comments that will always be added # - DOCUMENTATION="Did you update the corresponding documentation?" # Here we parse them into URL # - DOCUMENTATION_PARSED=$(echo $DOCUMENTATION | sed 's/ /%20/g') - NIX_CACHE_HOME=$(pwd)/nix-cache - ATLAS_JSON_URL=$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/refs/merge-requests/$CI_MERGE_REQUEST_IID/head/raw/atlas.json?job=build - BODY="You can preview the data at https://atlas.mariusdavid.fr?atlas=$(nix --extra-experimental-features nix-command --extra-experimental-features flakes run nixpkgs/25.05#urlencode -- $ATLAS_JSON_URL)" - echo $BODY # And finally we post them on your merge request! - 'curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_CI_COMMENT_API_KEY}" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes" --data-urlencode "body=$BODY"' No newline at end of file