diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..4353228 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,75 @@ +name: Release Workflow + +on: + push: + tags: + - '*' + branches: + - main + +jobs: + set-release-target: + runs-on: docker + outputs: + release_cible: ${{ steps.setvar.outputs.release_cible }} + steps: + - name: Déterminer la release cible + id: setvar + run: | + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + TAG="${GITHUB_REF#refs/tags/}" + echo "release_cible=$TAG" >> $GITHUB_OUTPUT + elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then + echo "release_cible=latest" >> $GITHUB_OUTPUT + else + echo "release_cible=unknown" >> $GITHUB_OUTPUT + fi + + - name: Afficher la variable + run: echo "Release cible = ${{ steps.setvar.outputs.release_cible }}" + + build: + runs-on: raw + container: + options: --privileged -v /var/run/docker.sock:/var/run/docker.sock + needs: set-release-target + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Install docker-cli + run: | + apt-get update + apt-get install -y ca-certificates curl + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + + # Add the repository to Apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install -y docker-ce-cli + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login docker registry + uses: docker/login-action@v2 + with: + username: ${{ forge.ACTOR }} + password: ${{ secrets.PACKAGE }} + registry: ${{ forge.SERVER_URL }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: git.g3e.fr/h6n/users:${{ needs.set-release-target.outputs.release_cible }} + target: release \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..80cbd6c --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,70 @@ +name: Test Pipeline + +on: + pull_request: + types: [opened, synchronize] + +jobs: + lint: + runs-on: raw + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Setup golang + uses: actions/setup-go@v5 + with: + go-version: "1.21" + + - name: golangci-lint + uses: https://github.com/golangci/golangci-lint-action@v8 + with: + version: v2.1 + args: --issues-exit-code 0 + + ci-test: + runs-on: raw + container: + options: --privileged -v /var/run/docker.sock:/var/run/docker.sock + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Install docker-cli + run: | + apt-get update + apt-get install -y ca-certificates curl + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + + # Add the repository to Apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install -y docker-ce-cli + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Setup golang + uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - name: Build image + run: | + docker build --pull -t users-release --target release . + + - name: Run Test + run: | + bash -ex ./scripts/prepar_test.sh + . ./config/test.src + go test -v ./cmd/ + go install gotest.tools/gotestsum@latest + gotestsum --junitfile report.xml --format testname \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2004cfe..ee22eb7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,7 +95,7 @@ release-latest: - build - integration_test -release-front: +release: stage: release image: docker:23.0.3-cli variables: diff --git a/Dockerfile b/Dockerfile index e8ee6d4..68ff1a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ -FROM golang:1.21-alpine AS develop +FROM golang:1.24-alpine AS develop # Changement du répertoire de travail WORKDIR / RUN apk update && apk add --no-cache curl tar && \ - curl -O https://gitlab.g3e.fr/api/v4/projects/34/packages/generic/minicurl/v1.0.0/minicurl_linux_amd64.tar.gz && \ - tar xzvf minicurl_linux_amd64.tar.gz + curl -OJ https://git.g3e.fr/api/packages/H6N/generic/minicurl/1.1.0/minicurl-linux-amd64 && \ + mv minicurl-linux-amd64 minicurl && \ + chmod +x ./minicurl # Changement du répertoire de travail WORKDIR /app diff --git a/README.md b/README.md index 361773c..bc768c2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Has this project is in H6N global project his requirement will first meet H6N ne ## Version -v1.1.0: Fer +v1.2.0: Helium ## Developpement diff --git a/cmd/login.go b/cmd/login.go index 53fa6e5..75a645f 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -5,6 +5,7 @@ import ( "github.com/labstack/echo/v4" logins "gitlab.g3e.fr/h6n/users/internal" + login_lib "gitlab.g3e.fr/h6n/users/lib/login" ) // Login @@ -16,12 +17,12 @@ import ( // @Param request body logins.RequestLogin true "request body" // @Success 200 {object} logins.ResponseLogin func login(c echo.Context) error { - var request logins.RequestLogin + var request login_lib.RequestLogin if err := c.Bind(&request); err != nil { return c.JSON(http.StatusBadRequest, err) } - if response, err := logins.CreateLogin(db, request); err != nil { + if response, err := logins.CreateLogin(dbGor, request); err != nil { return c.JSON(http.StatusBadRequest, "Not a valide user username or password") } else { return c.JSON(http.StatusOK, response) diff --git a/cmd/main.go b/cmd/main.go index 7092f54..6bf258d 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,15 +7,16 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" echoSwagger "github.com/swaggo/echo-swagger" + logins "gitlab.g3e.fr/h6n/users/internal" "gitlab.g3e.fr/h6n/users/lib" - - "database/sql" + "gitlab.g3e.fr/h6n/users/lib/health" + "gorm.io/gorm" _ "github.com/lib/pq" _ "gitlab.g3e.fr/h6n/users/cmd/docs" ) -var db *sql.DB = nil +var dbGor *gorm.DB = nil // Logout // @Tags auth @@ -39,16 +40,12 @@ func isLoggedIn(c echo.Context) error { return c.NoContent(http.StatusNoContent) } -func health(c echo.Context) error { - return c.NoContent(http.StatusOK) -} - func init_database() { var err error connStr := "postgres://acc:totor@postgres:5432/accounts?sslmode=disable" - db, err = sql.Open("postgres", connStr) + dbGor, err = logins.Init_database(connStr) if err != nil { fmt.Println(err) } @@ -58,20 +55,14 @@ func skip_auth(c echo.Context) bool { if c.Request().Method == "POST" && c.Path() == "/" { return true } - if c.Request().Method == "GET" && c.Path() == "/health" { - return true - } if len(c.Path()) > 9 && c.Path()[:9] == "/swagger/" { return true } - return false + return health.IsHealth(c) } func skip_log(c echo.Context) bool { - if c.Request().Method == "GET" && c.Path() == "/health" { - return true - } - return false + return health.IsHealth(c) } // @title Users @@ -109,7 +100,7 @@ func main() { e.GET("/", isLoggedIn) e.POST("/", login) e.DELETE("/", logout) - e.GET("/health", health) + e.GET("/health", health.Health) e.GET("/swagger/*", echoSwagger.WrapHandler) // Start server diff --git a/config/db.sql b/config/db.sql index 591d4d8..9357a40 100644 --- a/config/db.sql +++ b/config/db.sql @@ -1,7 +1 @@ -CREATE TABLE users ( - username TEXT PRIMARY KEY, - email TEXT UNIQUE NOT NULL, - password TEXT NOT NULL -); - INSERT INTO users(username, email, password) VALUES('0000000023', 'root@root.fr', '$2a$14$FU8FKR7pUq4akLThraD9kOu0zY0BuUFASo0xakgWEWbYF2gz20DuG'); \ No newline at end of file diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 0000000..7831a01 --- /dev/null +++ b/docs/release.md @@ -0,0 +1,10 @@ +# Release + +## Naming policy + +The naming policy is based on the [periodique table](https://fr.wikipedia.org/wiki/Tableau_p%C3%A9riodique_des_%C3%A9l%C3%A9ments#/media/Fichier:Tableau_p%C3%A9riodique_des_%C3%A9l%C3%A9ments.svg) for this project. + +## Release list + +- [v1.0.0 Helixire](./release/v1.0.0_damian.md) +- [v1.1.0 Fer](./release/v1.1.0_fer.md) diff --git a/docs/release/v1.2.0_helium.md b/docs/release/v1.2.0_helium.md new file mode 100644 index 0000000..098c527 --- /dev/null +++ b/docs/release/v1.2.0_helium.md @@ -0,0 +1,9 @@ +# Helium v1.2.0 + +## Release feature + +- Add naming policy +- Add health skip in lib +- Add health path in lib +- Fix ci name for release job +- Change database usage, use Gorm diff --git a/go.mod b/go.mod index 7f46fd1..f9b2551 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,11 @@ require ( github.com/go-openapi/spec v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.4.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/labstack/echo/v4 v4.11.4 // indirect github.com/labstack/gommon v0.4.2 // indirect @@ -39,5 +44,7 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/driver/postgres v1.5.7 // indirect + gorm.io/gorm v1.25.9 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index e6fc3b3..1ddc90a 100644 --- a/go.sum +++ b/go.sum @@ -40,6 +40,16 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -72,6 +82,7 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk= github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc= github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= @@ -128,5 +139,9 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= +gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= +gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8= +gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/internal/createLogin.go b/internal/createLogin.go index 140b350..8609ae5 100644 --- a/internal/createLogin.go +++ b/internal/createLogin.go @@ -1,7 +1,6 @@ package logins import ( - "database/sql" "encoding/base64" "encoding/hex" "errors" @@ -10,7 +9,9 @@ import ( "github.com/biscuit-auth/biscuit-go/v2" "github.com/biscuit-auth/biscuit-go/v2/parser" "gitlab.g3e.fr/h6n/users/lib" + login_lib "gitlab.g3e.fr/h6n/users/lib/login" "golang.org/x/crypto/bcrypt" + "gorm.io/gorm" ) func CheckPasswordHash(password, hash string) bool { @@ -18,20 +19,14 @@ func CheckPasswordHash(password, hash string) bool { return err == nil } -func CreateLogin(db *sql.DB, request RequestLogin) (ResponseLogin, error) { - type ( - User struct { - Username string - EncryptedPassword string - } - ) - var user User - var response ResponseLogin +func CreateLogin(db *gorm.DB, request login_lib.RequestLogin) (login_lib.ResponseLogin, error) { + var response login_lib.ResponseLogin - if err := db.QueryRow("SELECT username, password FROM users WHERE email = $1", request.Username).Scan(&user.Username, &user.EncryptedPassword); err != nil { - return response, err + var user = Users{Email: request.Username} + if err := db.First(&user); err.Error != nil { + return response, err.Error } - if !CheckPasswordHash(request.Password, user.EncryptedPassword) { + if !CheckPasswordHash(request.Password, user.Password) { return response, errors.ErrUnsupported } now := time.Now() diff --git a/internal/databases.go b/internal/databases.go new file mode 100644 index 0000000..8eb3d96 --- /dev/null +++ b/internal/databases.go @@ -0,0 +1,50 @@ +package logins + +import ( + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +type Users struct { + Username string `gorm:"primaryKey"` + Email string `gorm:"unique:users_email_key"` + Password string `gorm:""` +} + +func DropUnusedColumns(DB *gorm.DB, values ...interface{}) { + + for _, dst := range values { + stmt := &gorm.Statement{DB: DB} + if stmt.Parse(dst) != nil { + return + } + fields := stmt.Schema.Fields + columns, _ := DB.Debug().Migrator().ColumnTypes(dst) + + for i := range columns { + found := false + for j := range fields { + if columns[i].Name() == fields[j].DBName { + found = true + break + } + } + if !found { + if DB.Migrator().DropColumn(dst, columns[i].Name()) != nil { + return + } + } + } + } +} + +func Init_database(dsn string) (*gorm.DB, error) { + db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) + if err != nil { + return db, err + } + _ = db.AutoMigrate(&Users{}) + DropUnusedColumns(db, &Users{}) + + return db, nil +} diff --git a/lib/health/isHealth.go b/lib/health/isHealth.go new file mode 100644 index 0000000..7cac15c --- /dev/null +++ b/lib/health/isHealth.go @@ -0,0 +1,10 @@ +package health + +import "github.com/labstack/echo/v4" + +func IsHealth(c echo.Context) bool { + if c.Request().Method == "GET" && c.Path() == "/health" { + return true + } + return false +} diff --git a/lib/health/status.go b/lib/health/status.go new file mode 100644 index 0000000..0d9ea5e --- /dev/null +++ b/lib/health/status.go @@ -0,0 +1,11 @@ +package health + +import ( + "net/http" + + "github.com/labstack/echo/v4" +) + +func Health(c echo.Context) error { + return c.NoContent(http.StatusOK) +} diff --git a/lib/initBiscuit.go b/lib/initBiscuit.go index 0853db2..ed74eaf 100644 --- a/lib/initBiscuit.go +++ b/lib/initBiscuit.go @@ -3,6 +3,7 @@ package lib import ( "crypto/ed25519" "crypto/rand" + "fmt" "io" "os" "time" @@ -22,7 +23,12 @@ func InitLoginBiscuit() error { if file, err := os.Create(filePrivateKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() if _, err = io.WriteString(file, string(PrivateKey)); err != nil { return err @@ -34,7 +40,12 @@ func InitLoginBiscuit() error { if file, err := os.Create(filePublicKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() if _, err = io.WriteString(file, string(PublicKey)); err != nil { return err @@ -47,7 +58,12 @@ func InitLoginBiscuit() error { if file, err := os.Open(filePrivateKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() PrivateKey, err = io.ReadAll(file) if err != nil { @@ -57,7 +73,12 @@ func InitLoginBiscuit() error { if file, err := os.Open(filePublicKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() PublicKey, err = io.ReadAll(file) if err != nil { @@ -86,7 +107,12 @@ func InitGlobalBiscuit() error { if file, err := os.Open(filePrivateKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() PrivateKey, err = io.ReadAll(file) if err != nil { @@ -96,7 +122,12 @@ func InitGlobalBiscuit() error { if file, err := os.Open(filePublicKey); err != nil { return err } else { - defer file.Close() + defer func() { + if cerr := file.Close(); cerr != nil { + // ici tu peux logger ou faire quelque chose + fmt.Printf("Erreur à la fermeture: %v\n", cerr) + } + }() PublicKey, err = io.ReadAll(file) if err != nil { diff --git a/internal/struct.go b/lib/login/struct.go similarity index 93% rename from internal/struct.go rename to lib/login/struct.go index a32b8fb..1ad7774 100644 --- a/internal/struct.go +++ b/lib/login/struct.go @@ -1,4 +1,4 @@ -package logins +package login_lib type ( // RequestLogin model info diff --git a/scripts/prepar_test.sh b/scripts/prepar_test.sh index 2db967f..032e9af 100644 --- a/scripts/prepar_test.sh +++ b/scripts/prepar_test.sh @@ -1,20 +1,9 @@ #!/bin/bash - -cat <> /etc/apk/repositories -http://ftp.halifax.rwth-aachen.de/alpine/v3.16/main -http://ftp.halifax.rwth-aachen.de/alpine/v3.16/community -ENDFILE -apk update -apk add docker docker-cli-compose docker version docker compose version -docker load --input "$IMAGE_TYPE-$IMAGE_VERSION-release.tar.gz" -docker tag $CI_REGISTRY_IMAGE:$IMAGE_VERSION-release $IMAGE_TYPE:latest - -cat < docker-compose.yml -version: '3.1' +cat < compose.yml services: postgres: image: postgres:15.2-alpine3.17 @@ -29,7 +18,7 @@ services: timeout: 5s retries: 5 users: - image: $IMAGE_TYPE + image: users-release volumes: - ./docker/keys:/keys depends_on: