Skip to content
Snippets Groups Projects
Verified Commit 7b8f45ea authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: update deploy and test code #56

parent e3e5caf2
Branches
Tags v1.13.2
No related merge requests found
{ pkgs }:
pkgs.writeShellScriptBin "hello-world" ''
echo "Hello, world!"
''
......@@ -22,12 +22,12 @@ stages:
- test
- deploy
before_script:
- echo > .env-gitlab-ci
- variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
- cat .env-gitlab-ci
- env
- nix shell nixpkgs#docker-client -c docker info
#before_script:
#- echo > .env-gitlab-ci
#- variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
#- cat .env-gitlab-ci
#- env
#- nix shell nixpkgs#docker-client -c docker info
after_script:
- if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi
......@@ -53,7 +53,9 @@ deploy:
tags:
- nixos
script:
- devenv shell -c deploy-lib
- nix develop --command deploy
after_script:
- nix develop --command cleanup
when: on_success
......
......@@ -5,87 +5,14 @@
</component>
<component name="ChangeListManager">
<list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/nix/scripts/deploy.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.back/Taskfile.yml" beforeDir="false" />
<change afterPath="$PROJECT_DIR$/nix/scripts/cleanup.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.back/scripts/hello.nix" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.gitlab-ci.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.gitlab-ci.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/flake.lock" beforeDir="false" afterPath="$PROJECT_DIR$/flake.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/flake.nix" beforeDir="false" afterPath="$PROJECT_DIR$/flake.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/filippo.io/edwards25519/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/fsnotify/fsnotify/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.github/CONTRIBUTING.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.github/ISSUE_TEMPLATE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.github/PULL_REQUEST_TEMPLATE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.github/workflows/codeql.yml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.github/workflows/test.yml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/AUTHORS" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/CHANGELOG.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/README.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/atomic_bool.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/atomic_bool_go118.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/atomic_bool_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/auth.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/auth_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/benchmark_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/buffer.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/collations.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/conncheck.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/conncheck_dummy.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/conncheck_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/connection.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/connection_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/connector.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/connector_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/const.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/driver.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/driver_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/dsn.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/dsn_fuzz_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/dsn_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/errors.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/errors_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/fields.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/go.mod" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/go.sum" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/infile.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/nulltime.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/nulltime_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/packets.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/packets_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/result.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/rows.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/statement.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/statement_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/transaction.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/utils.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/go-sql-driver/mysql/utils_test.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/google/uuid/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/jinzhu/inflection/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/jinzhu/now/License" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/kr/fs/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/pkg/sftp/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/robfig/cron/v3/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/shirou/gopsutil/v3/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/tklauser/go-sysconf/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/github.com/tklauser/numcpus/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/go.uber.org/multierr/LICENSE.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/go.uber.org/zap/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/golang.org/x/crypto/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/golang.org/x/sys/unix/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/gopkg.in/yaml.v3/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/gopkg.in/yaml.v3/NOTICE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/gorm.io/driver/mysql/License" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/licenses/gorm.io/gorm/LICENSE" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/build-cover-report.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/build-cover-report.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/check-code.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/check-code.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/common.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/common.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/deploy.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/deploy.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/go-task.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/go-task.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/run-ci-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-ci-tests.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/run-extended-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-extended-tests.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/run-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-tests.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/schedule-time_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/schedule-time_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scheduler_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/scheduler_test.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......
......@@ -25,7 +25,6 @@
script-build-cover-report = pkgs'.callPackage ./nix/scripts/build-cover-report.nix {};
import-version = version.packages.${system}.version;
in {
devShells = {
default = let
......
......@@ -67,7 +67,7 @@ in
fi
echo_step "Running gosec"
if ! ${pkgs.gosec}/bin/gosec .
if ! ${pkgs.gosec}/bin/gosec -quiet .
then
echo_fail "gosec failed"
exit 1
......
{
pkgs,
lib,
...
}: let
common = pkgs.callPackage ./common.nix {};
in
pkgs.writeShellScriptBin "clean-up" ''
${common}
echo_header "Cleaning up"
${pkgs.git}/bin/git config --global --unset credential.helper
if [ -f /root/.docker/config.json ]; then rm /root/.docker/config.json; fi
''
......@@ -4,14 +4,6 @@
...
}: let
common = pkgs.callPackage ./common.nix {};
# Definieren eines schreibbaren Verzeichnisses
writableDir = pkgs.stdenv.mkDerivation {
name = "cover-report";
buildCommand = ''
mkdir -p $out
'';
};
in
pkgs.writeShellScriptBin "deploy" ''
${common}
......@@ -30,23 +22,29 @@ in
exit 1
fi
if [ -z "''${CI_PROJECT_DIR}" ]; then
echo_fail "Error: CI_PROJECT_DIR environment variable is not set."
exit 1
fi
cd ''${CI_PROJECT_DIR} || exit 1
${pkgs.git}/bin/git config --global user.email "''${GITLAB_USER_EMAIL}"
${pkgs.git}/bin/git config --global user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
${pkgs.git}/bin/git config --global credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=''${CI_JOB_TOKEN}"; }; f'
${pkgs.git}/bin/git config --global pull.rebase true
${pkgs.git}/bin/git config --global http.sslVerify "false"
${pkgs.git}/bin/git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
${pkgs.git}/bin/git fetch --all --tags --unshallow
${pkgs.git}/bin/git reset --hard origin/master
${pkgs.git}/bin/git clean -fd
${pkgs.git}/bin/git checkout $CI_COMMIT_REF_NAME
${pkgs.git}/bin/git pull origin $CI_COMMIT_REF_NAME
if [ -z "''${CI_PROJECT_DIR}" ]; then
echo_fail "Error: CI_PROJECT_DIR environment variable is not set."
exit 1
fi
cd ''${CI_PROJECT_DIR} || exit 1
${pkgs.git}/bin/git --no-pager log --decorate=short --pretty=oneline
${pkgs.git}/bin/git fetch --prune --prune-tags
if ! ${pkgs.git}/bin/git --no-pager log --decorate=short --pretty=oneline
then
......
......@@ -53,8 +53,11 @@
- gc
- commit
cmds:
- check-code
- cd "{{.USER_WORKING_DIR}}" && cd $(git rev-parse --show-toplevel) && nix run git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes#git-commit --no-write-lock-file
silent: true
env:
USER_WORKING_DIR: "{{.USER_WORKING_DIR}}"
'';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment