From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695A1C433E0 for ; Tue, 16 Feb 2021 10:38:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A40EC64DDA for ; Tue, 16 Feb 2021 10:38:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A40EC64DDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBxkL-0006Bt-HL for qemu-devel@archiver.kernel.org; Tue, 16 Feb 2021 05:38:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBxjK-0005gp-Oa for qemu-devel@nongnu.org; Tue, 16 Feb 2021 05:37:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lBxjH-0001ga-Qb for qemu-devel@nongnu.org; Tue, 16 Feb 2021 05:37:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613471834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1mv0fVtJk9SHBPdOpJXbpFxOhxt6eq11u3D9Ojwq3x8=; b=WyPtaLBHtwkjnGMDZJxqpCdm6WMi/zex+m/4CEE7a9G/lkwh2eA4nE4EA90jix+g+HrKkJ UbjJ8mQ5W08uU5QPc8Azvyg7k760qvQR6FwxANXVPQ93DJBj0/31b3C8QEemRksucrDfaV MFwizNGsIa6qEdmnWXQLRjvdR8I88Cg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-M8wk3JlINUWcXThQWriDqg-1; Tue, 16 Feb 2021 05:37:11 -0500 X-MC-Unique: M8wk3JlINUWcXThQWriDqg-1 Received: by mail-wr1-f71.google.com with SMTP id d10so12807482wrq.17 for ; Tue, 16 Feb 2021 02:37:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1mv0fVtJk9SHBPdOpJXbpFxOhxt6eq11u3D9Ojwq3x8=; b=G/5CTuh+rpJWOWJiUcC7Vx74uxAjYGjvQbl5TKWE7NFTrLcVDCqHS2Dr9rF4JelUbg 37Fh4jIV8ZVUGlQz1NtMnQ2xHlP5gUkAutsJj27a4InT6lL1l/OX/XOtnusSPLMZdeSY MXoWo4c1Q3+v4lVyjPUqgqNgfWJT9LF+hIwKakf2rGPu7iqJeboLZ03Na/TkrHOFq86g tZlTbDEznt63/ko0GWPXRPoWiB2ZOE1NGmAkq0lUXsfmn8FHS5DVxW1IWYO8PgJWUkhe +jpfRPWLgsvYK4veyLZgntenxVb9YMwYD9YFTN+YaZrqQbR37sw6e8UnPIZYvp0c6f/m UuPA== X-Gm-Message-State: AOAM531MOc+nCDXmnkMIXdDuoelfyDQzwvrKCrtOMH1dDyBdz2tX9kLT vADTbs46eXMOqnP8ndEii3wOCQb46gWrImQUruBAi63o0cKgDau3Wo11ZYRN0wkpOYaQJIyTGo9 6/yFRhU50mKKXJGQ= X-Received: by 2002:a7b:c5c7:: with SMTP id n7mr2736381wmk.63.1613471830617; Tue, 16 Feb 2021 02:37:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIHhrBA7aPYPbGp7OlagwJv/N9eVfGkpxmDUAz+swq4Fdh0O7PIhX2NMMr4WDk6KukiFSsqA== X-Received: by 2002:a7b:c5c7:: with SMTP id n7mr2736358wmk.63.1613471830416; Tue, 16 Feb 2021 02:37:10 -0800 (PST) Received: from [192.168.1.36] (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id c2sm8727865wrx.70.2021.02.16.02.37.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Feb 2021 02:37:10 -0800 (PST) Subject: Re: [PATCH] gitlab-ci: Only push Docker 'latest' image when building default branch To: =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= References: <20210215192814.989441-1-philmd@redhat.com> <97878d0a-5c47-c50c-c4ef-f6d69a52a7d0@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <3d817033-2a28-9ed8-5712-c5d7a53b76db@redhat.com> Date: Tue, 16 Feb 2021 11:37:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Thomas Huth , =?UTF-8?Q?Alex_Benn=c3=a9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 2/16/21 10:52 AM, Daniel P. Berrangé wrote: > On Tue, Feb 16, 2021 at 08:05:09AM +0100, Philippe Mathieu-Daudé wrote: >> On 2/16/21 7:55 AM, Thomas Huth wrote: >>> On 15/02/2021 20.28, Philippe Mathieu-Daudé wrote: >>>> While we are interested in building docker images in different >>>> branches, it only makes sense to push 'latest' to the registry >>>> when this is the project default branch (usually 'master'). >>>> >>>> Else when pushing different branches concurrently we might have >>>> inconsistent image state between branches. >>>> >>>> Signed-off-by: Philippe Mathieu-Daudé >>>> --- >>>>   .gitlab-ci.d/containers.yml | 2 +- >>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml >>>> index 90fac85ce46..52a915f4141 100644 >>>> --- a/.gitlab-ci.d/containers.yml >>>> +++ b/.gitlab-ci.d/containers.yml >>>> @@ -17,7 +17,7 @@ >>>>             -t "qemu/$NAME" -f "tests/docker/dockerfiles/$NAME.docker" >>>>             -r $CI_REGISTRY_IMAGE >>>>       - docker tag "qemu/$NAME" "$TAG" >>>> -    - docker push "$TAG" >>>> +    - test "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" && docker push >>>> "$TAG" >>> >>> So does that mean that the following stages in the CI (i.e. build, test) >>> are only always (i.e. also for the non-master branches) going to use >>> containers that have been build on the master branch? >> >> Hmm good point. Should we use "$CI_COMMIT_BRANCH" instead of "latest"? > > This doesn't work because git branch names are not guaranteed to be > valid docker tag names. Please see my thread here: > > https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg03535.html Indeed this thread describes the problem I am having. I'll see if there are follow up on your thread. Another way of fixing this is to find a way to only allow 1 pipeline at a time. I haven't tried it yet because I don't like the idea of making CI slower, but this is still better than debugging inconsistent pipelines when Docker images are rebuilt. Regards, Phil.