github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/rollout-service/Earthfile (about)

     1  VERSION --use-function-keyword 0.7
     2  IMPORT ../../infrastructure/earthly/go AS go-build
     3  
     4  LOCALLY
     5  ARG --global service=$(basename $PWD)
     6  ARG --global src_files=$(find pkg -type f ! -name "*_test.go")
     7  ARG --global cgo_enabled=0
     8  
     9  deps:
    10      FROM ../../+deps
    11      DO go-build+DEPS --service=$service --src_files=$src_files
    12      WORKDIR services/$service
    13  
    14  artifacts:
    15      FROM +deps
    16      SAVE ARTIFACT /etc/ssl/certs/ca-certificates.crt
    17      SAVE ARTIFACT /usr/share/zoneinfo
    18  
    19  compile:
    20      FROM +deps
    21      DO go-build+COMPILE --cgo_enabled=$cgo_enabled
    22  
    23  unit-test:
    24      FROM +compile
    25      ARG GO_TEST_ARGS
    26      DO go-build+UNIT_TEST --GO_TEST_ARGS=$GO_TEST_ARGS
    27  
    28  lint:
    29      FROM +deps
    30      DO go-build+LINT
    31      
    32  docker:
    33      FROM alpine:3.18
    34      ARG UID=1000
    35      ARG registry="europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult"
    36      ARG tag="local"
    37      ARG use_datadog=false
    38      DO go-build+DOCKER --UID=$UID --image_tag=$registry/kuberpult-$service:$tag --entry_point=/main --cgo_enabled=$cgo_enabled --service=$service --use_datadog=$use_datadog
    39  
    40  release:
    41      FROM +docker
    42      ARG registry="europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult"
    43      ARG --required tag
    44      DO go-build+RELEASE --image_tag=$registry/kuberpult-$service:$tag
    45  
    46  build-pr:
    47      ARG --required tag
    48      ARG registry="ghcr.io/freiheit-com/kuberpult"
    49      ARG mirror="false"
    50      ARG mirror_registry="europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult"
    51  
    52      DO +BUILD_ALL --tag=$tag --registry=$registry --mirror=$mirror  --mirror_registry=$mirror_registry
    53  
    54  build-main:
    55      ARG --required tag
    56      ARG registry="ghcr.io/freiheit-com/kuberpult"
    57      ARG mirror="false"
    58      ARG mirror_registry="europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult"
    59  
    60      DO +BUILD_ALL --tag=$tag --registry=$registry --mirror=$mirror  --mirror_registry=$mirror_registry --dd_release=true
    61  
    62  BUILD_ALL:
    63      FUNCTION
    64      ARG --required tag
    65      ARG --required registry
    66      ARG mirror_registry="europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult"
    67      ARG mirror="false"
    68      ARG dd_release=false
    69  
    70      FROM +deps
    71      BUILD +lint
    72      BUILD +unit-test 
    73      BUILD +release --registry=$registry --tag=$tag
    74      IF [ "$mirror" = "true" ]
    75          BUILD +release --registry=$mirror_registry --tag=$tag
    76      END
    77      IF [ "$dd_release" = "true" ]
    78          BUILD +release --registry=$mirror_registry --tag="${tag}-datadog" --use_datadog=true
    79      END