# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# IMPORTANT: This Prowjob was generated by running `make prowjobs -C templater`.
# DO NOT EDIT THIS FILE BY HAND! Refer to docs/prowjobs.md for instructions on
# how to add a new Prowjob or update an existing Prowjob.
################################################################################

presubmits:
  aws/eks-distro-build-tooling:
  - name: eks-distro-base-tooling-presubmits-golang-1-18-al-2
    always_run: false
    run_if_changed: "eks-distro-base/.*|scripts/setup_public_ecr_push.sh"
    max_concurrency: 10
    cluster: "prow-presubmits-cluster"
    skip_report: false
    extra_refs:
    - org: eks-distro-pr-bot
      repo: eks-distro-build-tooling
      base_ref: main
    - org: eks-distro-pr-bot
      repo: eks-distro
      base_ref: main
    - org: eks-distro-pr-bot
      repo: eks-anywhere-build-tooling
      base_ref: main
    - org: eks-distro-pr-bot
      repo: eks-anywhere
      base_ref: main
    decoration_config:
      gcs_configuration:
        bucket: s3://prowpresubmitsdataclusterstack-prowbucket7c73355c-vfwwxd2eb4gp
        path_strategy: explicit
      s3_credentials_secret: s3-credentials
    labels:
      image-build: "true"
      local-registry: "true"
      disk-usage: "true"
    spec:
      serviceaccountName: presubmits-build-account
      automountServiceAccountToken: false
      containers:
      - name: build-container
        image: public.ecr.aws/eks-distro-build-tooling/builder-base:minimal-875f14aa285cd879ded85d553f44fa919fd962eb.2
        command:
        - bash
        - -c
        - >
          trap '(docker buildx rm eks-d-builders || true) && touch /status/done && rm -rf /home/prow/go/src/' EXIT
          &&
          scripts/buildkit_check.sh
          &&
          scripts/local_registry_check.sh
          &&
          scripts/setup_buildx.sh
          &&
          export DATE_EPOCH=$(date "+%F-%s")
          &&
          make golang-1.18-compiler-images -C $PROJECT_PATH IMAGE_TAG=${DATE_EPOCH}.${AL_TAG}
          &&
          make create-pr -C $PROJECT_PATH IMAGE_TAG=${DATE_EPOCH}.${AL_TAG}
        env:
        - name: PROJECT_PATH
          value: "eks-distro-base"
        - name: AL_TAG
          value: "2"
        - name: IMAGE_REPO
          value: "localhost:5000"
        - name: PLATFORMS
          value: "linux/amd64"
        - name: BUILDKITD_IMAGE
          value: "moby/buildkit:v0.10.5-rootless"
        - name: USE_BUILDX
          value: "true"
        resources:
          requests:
            memory: "4Gi"
            cpu: "1024m"
      - name: buildkitd
        image: moby/buildkit:v0.10.5-rootless
        command:
        - sh
        args:
        - /script/entrypoint.sh
        securityContext:
          runAsUser: 1000
          runAsGroup: 1000
      - name: registry
        image: public.ecr.aws/docker/library/registry:2
        command:
        - sh
        args:
        - /registry-script/entrypoint.sh
        readinessProbe:
          httpGet:
            path: /
            port: 5000
          initialDelaySeconds: 5
          periodSeconds: 3
      - command:
        - sh
        args:
        - /disk-usage-script/entrypoint.sh
        image: public.ecr.aws/amazonlinux/amazonlinux:2
        name: disk-monitor