Container Builder无法正确标记图像,$ TAG_NAME无法正常工作

时间:2018-07-01 02:20:53

标签: google-cloud-platform google-kubernetes-engine google-container-builder

我正在使用以下方式在本地标记我的图像:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>

    <!-- Insert Grid.Resources (shown separately below) here -->

    <Rectangle x:Name="r1" Grid.Column="0" Grid.Row="0" StrokeThickness="1" />
    <Label Grid.Column="0" Grid.Row="0" Target="{x:Reference r1}" />
    <Rectangle x:Name="r2" Grid.Column="0" Grid.Row="1" StrokeThickness="5" />
    <Label Grid.Column="0" Grid.Row="1" Target="{x:Reference r2}" />
    <Rectangle x:Name="r3" Grid.Column="0" Grid.Row="2" StrokeThickness="10" />
    <Label Grid.Column="0" Grid.Row="2" Target="{x:Reference r3}" />
    <Rectangle x:Name="r4" Grid.Column="0" Grid.Row="3" StrokeThickness="15" />
    <Label Grid.Column="0" Grid.Row="3" Target="{x:Reference r4}" />

    <Border Grid.Column="1" Grid.Row="0" BorderThickness="1" Child="{StaticResource dt}" />
    <Border Grid.Column="1" Grid.Row="1" BorderThickness="5" Child="{StaticResource dt}" />
    <Border Grid.Column="1" Grid.Row="2" BorderThickness="10" Child="{StaticResource dt}" />
    <Border Grid.Column="1" Grid.Row="3" BorderThickness="15" Child="{StaticResource dt}" />

</Grid>

并获得一个简短的七个字符的哈希,可以用它们标记图像。

但是在Google Container Builder中,当我将图像名称设置为

<Grid.Resources>
    <TextBlock x:Key="dt"
               x:Shared="False" 
               Foreground="White" 
               DataContext="{Binding RelativeSource={RelativeSource Self}}">
        <Run Text="{Binding Path=DataContext.ActualWidth,StringFormat='ActualWidth: {0}',Mode=OneWay}" />
        <LineBreak />
        <Run Text="{Binding Path=DataContext.ActualHeight,StringFormat='ActualHeight: {0}',Mode=OneWay}" />
    </TextBlock>

    <Style TargetType="Label">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Label">
                    <TextBlock Foreground="White"
                            DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                            Width="{Binding Path=Target.ActualWidth}"
                            Height="{Binding Path=Target.ActualHeight}">
                        <Run Text="{Binding Path=Target.ActualWidth,StringFormat='ActualWidth: {0}',Mode=OneWay}" />
                        <LineBreak />
                        <Run Text="{Binding Path=Target.ActualHeight,StringFormat='ActualHeight: {0}',Mode=OneWay}" />
                    </TextBlock>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="common_style" TargetType="FrameworkElement">
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Width" Value="150" />
        <Setter Property="Height" Value="80" />
    </Style>

    <Style TargetType="Border" BasedOn="{StaticResource common_style}">
        <Setter Property="BorderBrush" Value="Navy" />
        <Setter Property="Background" Value="Gray" />
    </Style>

    <Style TargetType="Rectangle" BasedOn="{StaticResource common_style}">
        <Setter Property="Stroke" Value="Navy" />
        <Setter Property="Fill" Value="Gray" />
    </Style>
</Grid.Resources>

enter image description here

我得到一个很长的标签git describe --tags --always --dirty

当我尝试使用可用变量之一时,改为gcr.io/$PROJECT_ID/amal-img:$COMMIT_SHA ,即 gcr.io/$PROJECT_ID/amal-img/amal-img:00528e0498ebb746d047de3bb38e483b69f72d89

我收到错误消息$TAG_NAME

1 个答案:

答案 0 :(得分:1)

它未在屏幕快照的“受支持的变量”字段文本中列出,但您也许可以使用$SHORT_SHA-它作为受支持的替代项in the docs给出:

$SHORT_SHA : The first seven characters of COMMIT_SHA