Skip to content

Commit a4810c1

Browse files
authored
toil: remove push image promotion (#95)
1 parent 8669be8 commit a4810c1

File tree

6 files changed

+28
-161
lines changed

6 files changed

+28
-161
lines changed

.semaphore/env-create.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ blocks:
4343
- terraform init
4444
- make helm.install
4545
secrets:
46-
- name: container-registry-writer
4746
- name: e2e-test-github-app-${{parameters.CLOUD_TEST_ENV_PREFIX}}
4847
- name: e2e-test-gitlab-app-${{parameters.CLOUD_TEST_ENV_PREFIX}}
4948
- name: Update DNS

.semaphore/generate-helm-chart.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ agent:
77
blocks:
88
- name: Build images
99
task:
10-
secrets:
11-
- name: semreg-semaphoredev-credentials
1210
env_vars:
1311
- name: RAILS_ENV
1412
value: "production"
@@ -60,15 +58,14 @@ blocks:
6058
commands:
6159
- checkout
6260
- if git rev-parse --is-shallow-repository | grep -q true; then git fetch --unshallow --tags; else git fetch --tags; fi
63-
- echo $SEMAPHORE_REGISTRY_PASSWORD | docker login --username "$SEMAPHORE_REGISTRY_USERNAME" --password-stdin $SEMAPHORE_REGISTRY_HOST || echo "Semaphore Registry login failed, but continuing the build process." && true
64-
- export REGISTRY_HOST=$SEMAPHORE_REGISTRY_HOST
6561
- export APP_NAME=$(jq -r --arg application "$APPLICATION" '.services[$application][]["app"]' .semaphore/services.json)
6662
- cd $(jq -r --arg application "$APPLICATION" '.services[$application][]["path"]' .semaphore/services.json)
67-
- make build
63+
- make build NO_BUILD_CACHE=true
6864
- 'if [[ -n $SEMAPHORE_GIT_TAG_NAME ]]; then make configure.sign; fi'
69-
- make ghcr.configure
70-
- make ghcr.push
71-
- 'if [[ -n $SEMAPHORE_GIT_TAG_NAME ]]; then make ghcr.sign; fi'
65+
- export REGISTRY_HOST=ghcr.io/semaphoreio
66+
- make registry.configure
67+
- make registry.push
68+
- 'if [[ -n $SEMAPHORE_GIT_TAG_NAME ]]; then make registry.sign; fi'
7269

7370
- name: "Create Helm chart"
7471
task:

.semaphore/push-image.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.semaphore/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ blocks:
1414
- checkout
1515
- make cosign.install
1616
- make configure.sign
17-
- make ghcr.configure
18-
- make ghcr.helm.configure
17+
- make registry.configure
18+
- make registry.helm.configure
1919
- ./release.sh

.semaphore/semaphore.yml

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,92 +3686,6 @@ blocks:
36863686
- make test
36873687
- cache store
36883688
promotions:
3689-
- name: Push Image - Production
3690-
pipeline_file: push-image.yml
3691-
deployment_target: Production
3692-
parameters:
3693-
env_vars:
3694-
- name: SERVICE
3695-
required: true
3696-
options:
3697-
- "APIv1alpha"
3698-
- "APIv2"
3699-
- "ArtifactHub"
3700-
- "Audit"
3701-
- "Badge"
3702-
- "BranchHub"
3703-
- "Dashboardhub"
3704-
- "Encryptor"
3705-
- "Front"
3706-
- "GithubNotifier"
3707-
- "Gofer"
3708-
- "Guard"
3709-
- "HooksProcessor"
3710-
- "HooksReceiver"
3711-
- "Keycloak image"
3712-
- "Keycloak setup"
3713-
- "Loghub2"
3714-
- "Monolith"
3715-
- "Notifications"
3716-
- "PeriodicScheduler"
3717-
- "Plumber"
3718-
- "PreFlightChecks"
3719-
- "ProjectHub REST API"
3720-
- "ProjectHub"
3721-
- "PublicApiGateway"
3722-
- "RBAC CE"
3723-
- "RBAC EE"
3724-
- "Repohub"
3725-
- "RepositoryHub"
3726-
- "Scouter"
3727-
- "SecretHub"
3728-
- "Self Hosted Hub"
3729-
- "Statsd"
3730-
- "Velocity"
3731-
- "Zebra"
3732-
- name: Push Image
3733-
pipeline_file: push-image.yml
3734-
deployment_target: PreProduction
3735-
parameters:
3736-
env_vars:
3737-
- name: SERVICE
3738-
required: true
3739-
options:
3740-
- "APIv1alpha"
3741-
- "APIv2"
3742-
- "ArtifactHub"
3743-
- "Audit"
3744-
- "Badge"
3745-
- "BranchHub"
3746-
- "Dashboardhub"
3747-
- "Encryptor"
3748-
- "Front"
3749-
- "GithubHooks"
3750-
- "GithubNotifier"
3751-
- "Gofer"
3752-
- "Guard"
3753-
- "HooksProcessor"
3754-
- "HooksReceiver"
3755-
- "Keycloak image"
3756-
- "Keycloak setup"
3757-
- "Loghub2"
3758-
- "Notifications"
3759-
- "PeriodicScheduler"
3760-
- "Plumber"
3761-
- "PreFlightChecks"
3762-
- "ProjectHub REST API"
3763-
- "ProjectHub"
3764-
- "PublicApiGateway"
3765-
- "RBAC CE"
3766-
- "RBAC EE"
3767-
- "Repohub"
3768-
- "RepositoryHub"
3769-
- "Scouter"
3770-
- "SecretHub"
3771-
- "Self Hosted Hub"
3772-
- "Statsd"
3773-
- "Velocity"
3774-
- "Zebra"
37753689
- name: Generate Helm Chart
37763690
pipeline_file: generate-helm-chart.yml
37773691
deployment_target: github-packages

Makefile

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ ifneq ($(CI),)
5757
FORMAT_ARGS?=--dry-run --check-formatted
5858
endif
5959

60-
DOCKERHUB_RELEASE_TAG?=$(shell git rev-list -1 HEAD -- .)
61-
GCR_RELEASE_TAG?=$(SEMAPHORE_WORKFLOW_ID)-sha-$(SEMAPHORE_GIT_SHA)
60+
RELEASE_TAG?=$(shell git rev-list -1 HEAD -- .)
6261
BUILDKIT_INLINE_CACHE=1
6362

6463
#
@@ -152,10 +151,21 @@ tag:
152151
# If MIX_ENV is set, we're dealing with an Elixir application,
153152
# so we need to create the 'deps' and '_build' folders.
154153
#
155-
build: pull
154+
build:
156155
ifneq ($(MIX_ENV),)
157156
mkdir -p deps _build
158157
endif
158+
ifeq ($(NO_BUILD_CACHE),true)
159+
docker build -f Dockerfile \
160+
--target $(DOCKER_BUILD_TARGET) \
161+
--progress $(DOCKER_BUILD_PROGRESS) \
162+
--build-arg BUILDKIT_INLINE_CACHE=$(BUILDKIT_INLINE_CACHE) \
163+
--build-arg APP_NAME=$(APP_NAME) \
164+
--build-arg BUILD_ENV=$(BUILD_ENV) \
165+
-t $(IMAGE):$(IMAGE_TAG) \
166+
$(DOCKER_BUILD_PATH)
167+
else
168+
$(MAKE) pull
159169
docker build -f Dockerfile \
160170
--target $(DOCKER_BUILD_TARGET) \
161171
--progress $(DOCKER_BUILD_PROGRESS) \
@@ -166,6 +176,7 @@ endif
166176
--cache-from=$(REGISTRY_HOST)/$(MAIN_IMAGE):$(IMAGE_TAG) \
167177
-t $(IMAGE):$(IMAGE_TAG) \
168178
$(DOCKER_BUILD_PATH)
179+
endif
169180

170181
#
171182
# Development operations
@@ -248,34 +259,21 @@ configure.sign:
248259
pip install google-cloud-iam && \
249260
$(ROOT_MAKEFILE_PATH)/get_id_token.py $$GOOGLE_PROJECT_NAME ci-image-signer > /tmp/sigstore-token
250261

251-
gcloud.configure:
252-
gcloud auth activate-service-account $(GCP_REGISTRY_WRITER_EMAIL) --key-file ~/gce-registry-writer-key.json
253-
gcloud --quiet auth configure-docker
262+
registry.push:
263+
docker tag $(IMAGE):$(IMAGE_TAG) $(REGISTRY_HOST)/$(APP_NAME):$(RELEASE_TAG)
264+
docker push $(REGISTRY_HOST)/$(APP_NAME):$(RELEASE_TAG)
254265

255-
gcloud.push:
256-
docker tag $(IMAGE):$(IMAGE_TAG) us.gcr.io/$(GOOGLE_PROJECT_NAME)/$(APP_NAME):$(GCR_RELEASE_TAG)
257-
docker push us.gcr.io/$(GOOGLE_PROJECT_NAME)/$(APP_NAME):$(GCR_RELEASE_TAG)
258-
259-
gcloud.sign: cosign.install
266+
registry.sign: cosign.install
260267
cosign sign -y \
261268
--identity-token $$(cat /tmp/sigstore-token) \
262-
$(shell docker inspect --format='{{index .RepoDigests 0}}' us.gcr.io/$(GOOGLE_PROJECT_NAME)/$(APP_NAME):$(GCR_RELEASE_TAG))
269+
$(shell docker inspect --format='{{index .RepoDigests 0}}' $(REGISTRY_HOST)/$(APP_NAME):$(RELEASE_TAG))
263270

264-
ghcr.configure:
271+
registry.configure:
265272
@printf "%s" "$(GITHUB_TOKEN)" | docker login ghcr.io -u "$(GITHUB_USERNAME)" --password-stdin
266273

267-
ghcr.helm.configure:
274+
registry.helm.configure:
268275
@printf "%s" "$(GITHUB_TOKEN)" | helm registry login ghcr.io/semaphoreio --username "$(GITHUB_USERNAME)" --password-stdin
269276

270-
ghcr.push:
271-
docker tag $(IMAGE):$(IMAGE_TAG) ghcr.io/semaphoreio/$(APP_NAME):$(DOCKERHUB_RELEASE_TAG)
272-
docker push ghcr.io/semaphoreio/$(APP_NAME):$(DOCKERHUB_RELEASE_TAG)
273-
274-
ghcr.sign: cosign.install
275-
cosign sign -y \
276-
--identity-token $$(cat /tmp/sigstore-token) \
277-
$(shell docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/semaphoreio/$(APP_NAME):$(DOCKERHUB_RELEASE_TAG))
278-
279277
cosign.install:
280278
curl -O -L "https://github.com/sigstore/cosign/releases/download/v2.4.1/cosign-linux-amd64" && \
281279
sudo mv cosign-linux-amd64 /usr/local/bin/cosign && \

0 commit comments

Comments
 (0)