From patchwork Tue Dec 7 08:49:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1564550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=lWUfyvkW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J7YsJ6H4bz9sXS for ; Tue, 7 Dec 2021 19:50:12 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4J7YsJ52mjz2yxm for ; Tue, 7 Dec 2021 19:50:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=lWUfyvkW; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42f; helo=mail-pf1-x42f.google.com; envelope-from=vicamo@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=lWUfyvkW; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4J7YrP05bcz2ywp for ; Tue, 7 Dec 2021 19:49:24 +1100 (AEDT) Received: by mail-pf1-x42f.google.com with SMTP id x5so12849608pfr.0 for ; Tue, 07 Dec 2021 00:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IZu5YMV55Ca8M95KoHf4jTLrEn+T9N3ktbkrfVyMNM8=; b=lWUfyvkWfthT/Vdkcz1GA+hXRrkCoUTrt6cC9oDxXr1ia/S3378HXGCc3J/KhdJMsj CZo0vEQ+JR8yqB1Fw/Qu9KtfLYQUJgjXrzWEsgOIftlcH2wm0PYKSnOM7qMLUecpK4oQ h+bIr++SdrPMpS2J11kpj2NEaUCEwMJiGNS+c2UNNjt2KbIugLW8/QMryJSACL3zjPoS xBEKJwv6m0aDN0us1G1G4KxKjublFuZ+M8mbNlmf7qCl8j4ww64m31rEDEuBzkvd2Z1x KAskyZpv0UcgJnQTAaO7PxradsdqoOzYgzPu8HNDfbq+6m4vvppOK9whJr/DJjxuo/uR NqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IZu5YMV55Ca8M95KoHf4jTLrEn+T9N3ktbkrfVyMNM8=; b=i83o9XsUO6BwQWF2a0eK1nDXh6S9fN8DL2oH7jpxOwLt5+kzp7Aykfzpb8coevFrck TwXrm5OwKj8U3nqCFUKMKh/4O7IL60S7fOuKbP5jgfJcar2jX54QtDJWVcFKcRqcY824 JHi+AC0Hbb6Bn0PhoSWomfM/34MGIYOJS/fPbRAPCXJLJ6kHAy7ettIeo+lcDF4ypSHt +azJ4Rhit0L5FYpKmpF1NjzwyXIGfY0U5Ywfqvr8g+4VrVigLzv89LsSDWCUooOcJKG0 hpbkMF2AMnfx9WgiP+8ySkGMqOKcLOQq7iQVDRBGJbka4AXwUwft9mRH6ShzNVIHitVc YkDA== X-Gm-Message-State: AOAM532pXC+1i2T0TAOEoQ9GlRrNki2axY4yRFPaDBOznFkVOhgKCZoS KlTKNKJlkQL7SQD7z3NMewgBXh9fxB4= X-Google-Smtp-Source: ABdhPJyoxTCcdc+Mu9lD8MZZ0xnS9HZqdMszg1f6+5NDZfLPP8KVfM4qKIBoZU9QL4kps2MESP32hA== X-Received: by 2002:aa7:8017:0:b0:4ad:526b:1b54 with SMTP id j23-20020aa78017000000b004ad526b1b54mr16720882pfi.29.1638866962517; Tue, 07 Dec 2021 00:49:22 -0800 (PST) Received: from localhost (218-173-141-247.dynamic-ip.hinet.net. [218.173.141.247]) by smtp.gmail.com with ESMTPSA id 59sm1961727pjz.34.2021.12.07.00.49.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 00:49:22 -0800 (PST) From: You-Sheng Yang To: patchwork@lists.ozlabs.org Subject: [PATCH 2/4] ci: test the existence of a patchwork specific table in the database Date: Tue, 7 Dec 2021 16:49:14 +0800 Message-Id: <20211207084916.240554-3-vicamo@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211207084916.240554-1-vicamo@gmail.com> References: <20211207084916.240554-1-vicamo@gmail.com> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Current dev docker image entrypoint script tests only the existence of the database, but while it might be a blank one, this fails server starting up because reset_data is not done. Signed-off-by: You-Sheng Yang --- docker-compose-pg.yml | 4 +++- docker-compose.yml | 4 ++++ tools/docker/entrypoint.sh | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose-pg.yml b/docker-compose-pg.yml index a45240e..9b6fdb4 100644 --- a/docker-compose-pg.yml +++ b/docker-compose-pg.yml @@ -5,6 +5,8 @@ services: volumes: - ./tools/docker/db/postdata:/var/lib/postgresql/data environment: + - POSTGRES_DB=patchwork + - POSTGRES_USER=patchwork - POSTGRES_PASSWORD=password web: @@ -28,5 +30,5 @@ services: - DATABASE_HOST=db - DATABASE_PORT=5432 - DATABASE_NAME=patchwork - - DATABASE_USER=postgres + - DATABASE_USER=patchwork - DATABASE_PASS=password diff --git a/docker-compose.yml b/docker-compose.yml index 1673823..8526e32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,9 @@ services: volumes: - ./tools/docker/db/data:/var/lib/mysql environment: + - MYSQL_DATABASE=patchwork + - MYSQL_USER=patchwork + - MYSQL_PASS=password - MYSQL_ROOT_PASSWORD=root web: @@ -27,6 +30,7 @@ services: # skip DATABASE_TYPE explicitly as mysql should be the default type. - DATABASE_HOST=db - DATABASE_PORT=3306 + - DATABASE_NAME=patchwork - DATABASE_USER=patchwork - DATABASE_PASS=password - MYSQL_ROOT_PASSWORD=root diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh index d111944..6be90b9 100755 --- a/tools/docker/entrypoint.sh +++ b/tools/docker/entrypoint.sh @@ -32,9 +32,9 @@ test_db_connection() { test_database() { if [ ${DATABASE_TYPE} = "postgres" ]; then - echo ';' | psql "${psql_args[@]}" "${DATABASE_NAME}" 2> /dev/null + echo 'DESCRIBE patchwork_project;' | psql "${psql_args[@]}" "${DATABASE_NAME}" 2> /dev/null else - echo ';' | mysql "${mysql_args[@]}" "${DATABASE_NAME}" 2> /dev/null + echo 'DESCRIBE patchwork_project;' | mysql "${mysql_args[@]}" "${DATABASE_NAME}" 2> /dev/null fi }