istio.io/istio@v0.0.0-20240520182934-d79c90f27776/prow/release-commit.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright Istio Authors
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #    http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  WD=$(dirname "$0")
    18  WD=$(cd "$WD"; pwd)
    19  ROOT=$(dirname "$WD")
    20  
    21  set -eux
    22  
    23  # shellcheck source=prow/lib.sh
    24  source "${ROOT}/prow/lib.sh"
    25  
    26  setup_gcloud_credentials
    27  
    28  # Old prow image does not set this, so needed explicitly here as this is not called through make
    29  export GO111MODULE=on
    30  
    31  DOCKER_HUB=${DOCKER_HUB:-gcr.io/istio-testing}
    32  GCS_BUCKET=${GCS_BUCKET:-istio-build/dev}
    33  
    34  # Enable emulation required for cross compiling a few images (VMs)
    35  docker run --rm --privileged "${DOCKER_HUB}/qemu-user-static" --reset -p yes
    36  export ISTIO_DOCKER_QEMU=true
    37  
    38  # Use a pinned version in case breaking changes are needed
    39  BUILDER_SHA=ea760fe00ff2476a83df23a8a4903170d9dab028
    40  
    41  # Reference to the next minor version of Istio
    42  # This will create a version like 1.4-alpha.sha
    43  NEXT_VERSION=$(cat "${ROOT}/VERSION")
    44  TAG=$(git rev-parse HEAD)
    45  VERSION="${NEXT_VERSION}-alpha.${TAG}"
    46  
    47  # In CI we want to store the outputs to artifacts, which will preserve the build
    48  # If not specified, we can just create a temporary directory
    49  WORK_DIR="$(mktemp -d)/build"
    50  mkdir -p "${WORK_DIR}"
    51  
    52  MANIFEST=$(cat <<EOF
    53  version: ${VERSION}
    54  docker: ${DOCKER_HUB}
    55  directory: ${WORK_DIR}
    56  ignoreVulnerability: true
    57  dependencies:
    58  ${DEPENDENCIES:-$(cat <<EOD
    59    istio:
    60      localpath: ${ROOT}
    61    api:
    62      git: https://github.com/istio/api
    63      auto: modules
    64    proxy:
    65      git: https://github.com/istio/proxy
    66      auto: deps
    67    client-go:
    68      git: https://github.com/istio/client-go
    69      branch: master
    70    test-infra:
    71      git: https://github.com/istio/test-infra
    72      branch: master
    73    tools:
    74      git: https://github.com/istio/tools
    75      branch: master
    76    release-builder:
    77      git: https://github.com/istio/release-builder
    78      sha: ${BUILDER_SHA}
    79    ztunnel:
    80      git: https://github.com/istio/ztunnel
    81      auto: deps
    82  architectures: [linux/amd64, linux/arm64]
    83  EOD
    84  )}
    85  dashboards:
    86    istio-mesh-dashboard: 7639
    87    istio-performance-dashboard: 11829
    88    istio-service-dashboard: 7636
    89    istio-workload-dashboard: 7630
    90    pilot-dashboard: 7645
    91    istio-extension-dashboard: 13277
    92  ${PROXY_OVERRIDE:-}
    93  EOF
    94  )
    95  
    96  # "Temporary" hacks
    97  export PATH=${GOPATH}/bin:${PATH}
    98  
    99  go install "istio.io/release-builder@${BUILDER_SHA}"
   100  
   101  release-builder build --manifest <(echo "${MANIFEST}")
   102  
   103  release-builder validate --release "${WORK_DIR}/out"
   104  
   105  if [[ -z "${DRY_RUN:-}" ]]; then
   106    release-builder publish --release "${WORK_DIR}/out" \
   107      --gcsbucket "${GCS_BUCKET}" --gcsaliases "${TAG},${NEXT_VERSION}-dev,latest" \
   108      --dockerhub "${DOCKER_HUB}" --dockertags "${TAG},${VERSION},${NEXT_VERSION}-dev,latest"
   109  fi