diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d71780a1..ea31a66ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,16 +42,17 @@ jobs: shell: bash run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: make release + - name: Release env: DOCKER_USERNAME: ${{ secrets.NEXUS_USERNAME }} DOCKER_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} GIT_TAG: ${{ env.GIT_TAG }} - run: devbox run -- make release + run: devbox run -- just release - name: Release OCI artifact env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: devbox run -- just release-oci ${{ env.GIT_TAG }} + GIT_TAG: ${{ env.GIT_TAG }} + run: devbox run -- just release-oci diff --git a/hack/build-archive.sh b/hack/build-archive.sh deleted file mode 100755 index 949e061fa..000000000 --- a/hack/build-archive.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -euox pipefail - -ARCHIVE_NAME=$1 - -dir=$(mktemp --directory) - -tar -xvf "${ARCHIVE_NAME}" --directory "$dir" -yq 'del(.resources[] | select(. == "ai-navigator-repos.yaml"))' --inplace "$dir"/common/helm-repositories/kustomization.yaml - -# update the modified time -tar -cvzf "${ARCHIVE_NAME}" -C "$dir" . - -# cleanup -rm -rf "$dir" diff --git a/justfile b/justfile index b0a21a8fe..a3a1d44c3 100644 --- a/justfile +++ b/justfile @@ -1,15 +1,27 @@ set dotenv-load -registry := "registry-1.docker.io" +git_tag := env_var_or_default("GIT_TAG", "v0.0.0") + +registry := "docker.io" org_name := "mesosphere" repository := org_name / "kommander-applications" include_file := justfile_directory() / ".include-airgapped" exclude_file := justfile_directory() / ".exclude-airgapped" git_operator_version := env("GIT_OPERATOR_VERSION", "latest") -release-oci tag tmp_dir=`mktemp --directory`: - rsync --info=name --archive --recursive --files-from={{ include_file }} --exclude-from={{ exclude_file }} {{ justfile_directory() }} {{ tmp_dir }} - cd {{ tmp_dir }} && echo "${DOCKER_PASSWORD}" | oras push --password-stdin --username "${DOCKER_USERNAME}" --verbose {{ registry }}/{{ repository }}:{{ tag }} . +s3_path := "dkp" / git_tag +s3_bucket := "downloads.mesosphere.io" +s3_uri := "s3://" / s3_bucket / s3_path +s3_acl := "bucket-owner-full-control" +archive_name := "kommander-applications-" + git_tag+ ".tar.gz" +published_url := "https://downloads.d2iq.com" / s3_path / archive_name + +release tmp_dir=`mktemp --directory`: (_prepare-archive tmp_dir) + aws s3 cp --acl {{ s3_acl }} {{ archive_name }} {{ s3_uri }} + @echo "Published to {{ published_url }}" + +release-oci tmp_dir=`mktemp --directory`: (_prepare-files-for-a-bundle tmp_dir) + cd {{ tmp_dir }} && echo "${DOCKER_PASSWORD}" | oras push --password-stdin --username "${DOCKER_USERNAME}" --verbose {{ registry }}/{{ repository }}:{{ git_tag }} . service_version:=`ls services/git-operator/ | grep -E "v?[[:digit:]]\.[[:digit:]]\.[[:digit:]]"` service_dir:=justfile_directory() / "services/git-operator" / service_version @@ -19,3 +31,13 @@ git-operator-fetch-manifests tmp_dir=`mktemp --directory`: # HACK: strip SHA off git-operator image kustomize build {{ tmp_dir }}/default | sed -r 's/(image\: docker\.io\/mesosphere\/git-operator\:v[0-9]+\.[0-9]+.[0-9]+)\@sha256\:.*?$/\1/g' >{{ service_dir }}/git-operator-manifests/all.yaml [ -z "$(git diff --name-only services/git-operator)" ] || echo -e '\n\n\nWARNING: Git Operator manifests have changed!\nEdit {{ service_dir }}/additional-images.txt to ensure additional images are up to date.\n\n' + +_prepare-archive dir: (_prepare-files-for-a-bundle dir) + tar -cvzf {{ justfile_directory() }}/{{ archive_name }} -C {{ dir }} . + +_cleanup: + rm {{ archive_name }} + +_prepare-files-for-a-bundle output_dir: + rsync --archive --recursive --files-from={{ include_file }} --exclude-from={{ exclude_file }} {{ justfile_directory() }} {{ output_dir }} + yq 'del(.resources[] | select(. == "ai-navigator-repos.yaml"))' --inplace {{ output_dir }}/common/helm-repositories/kustomization.yaml diff --git a/make/all.mk b/make/all.mk index 606998456..90a78e5ff 100644 --- a/make/all.mk +++ b/make/all.mk @@ -7,7 +7,6 @@ include $(INCLUDE_DIR)repo.mk include $(INCLUDE_DIR)docker.mk include $(INCLUDE_DIR)flux.mk include $(INCLUDE_DIR)tools.mk -include $(INCLUDE_DIR)release.mk include $(INCLUDE_DIR)pre-commit.mk include $(INCLUDE_DIR)validate.mk include $(INCLUDE_DIR)go.mk diff --git a/make/release.mk b/make/release.mk deleted file mode 100644 index 4747fc221..000000000 --- a/make/release.mk +++ /dev/null @@ -1,27 +0,0 @@ -S3_BUCKET ?= "downloads.mesosphere.io" -S3_PATH ?= "dkp/$(GIT_TAG)" -S3_ACL ?= "bucket-owner-full-control" - -.PHONY: release -release: ARCHIVE_NAME = kommander-applications-$(GIT_TAG).tar.gz -release: PUBLISHED_URL = https://downloads.d2iq.com/dkp/$(GIT_TAG)/$(ARCHIVE_NAME) -release: - # We don't want to have ai-navigator in airgapped bundle - # and we don't want to have ai-navigator-cluster-info-agent in airgapped bundle - # the connected customers download the k-apps from GitHub where it is still present - git archive --format "tar.gz" -o $(ARCHIVE_NAME) \ - $(GIT_TAG) -- \ - common services charts \ - clusters projects workspaces \ - ":(exclude)common/helm-repositories/ai-navigator-repos.yaml" \ - ":(exclude)services/ai-navigator-app" \ - ":(exclude)services/ai-navigator-cluster-info-agent" - ./hack/build-archive.sh $(ARCHIVE_NAME) - aws s3 cp --acl $(S3_ACL) $(ARCHIVE_NAME) s3://$(S3_BUCKET)/$(S3_PATH)/ - echo "Published to $(PUBLISHED_URL)" -ifeq (,$(findstring dev,$(GIT_TAG))) - # Make sure to set SLACK_WEBHOOK environment variable to webhook url for the below mentioned channel - curl -X POST -H 'Content-type: application/json' \ - --data '{"channel":"#eng-shipit","blocks":[{"type":"header","text":{"type":"plain_text","text":":github: Kommander Applications Git Repo Tarball $(GIT_TAG) is out!","emoji":true}},{"type":"section","text":{"type":"mrkdwn","text":"$(PUBLISHED_URL)"}}]}' \ - $(SLACK_WEBHOOK) -endif