Skip to content

Commit 5566306

Browse files
Merge pull request #71 from codecov/feature/ci-consolidate
Ci Consolidate
2 parents af0132a + 3483fa3 commit 5566306

File tree

7 files changed

+82
-174
lines changed

7 files changed

+82
-174
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Gateway CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
10+
jobs:
11+
build-self-hosted:
12+
name: Build Self Hosted Image
13+
uses: codecov/gha-workflows/.github/workflows/[email protected]
14+
secrets: inherit
15+
with:
16+
repo: ${{ vars.CODECOV_GATEWAY_IMAGE || 'codecov/self-hosted-gateway' }}
17+
cache_requirements: false
18+
19+
self-hosted:
20+
name: Push Self Hosted Image
21+
needs: [ build-self-hosted ]
22+
secrets: inherit
23+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/production') && github.repository_owner == 'codecov' }}
24+
uses: codecov/gha-workflows/.github/workflows/[email protected]
25+
with:
26+
push_rolling: true
27+
cache_requirements: false
28+
repo: ${{ vars.CODECOV_GATEWAY_IMAGE || 'codecov/self-hosted-gateway' }}
29+

.github/workflows/create-release.yml

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

.github/workflows/gcr.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Create Self Hosted Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionName:
7+
description: 'Name of version (ie 23.9.5)'
8+
required: true
9+
10+
jobs:
11+
create-release-pr:
12+
name: Create PR for Release ${{ github.event.inputs.versionName }}
13+
uses: codecov/gha-workflows/.github/workflows/[email protected]
14+
secrets: inherit
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Create Self Hosted Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [closed]
8+
9+
jobs:
10+
create-release:
11+
name: Tag Release ${{ github.head_ref }} and Push Docker image to Docker Hub
12+
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }}
13+
uses: codecov/gha-workflows/.github/workflows/[email protected]
14+
secrets: inherit
15+
16+
push-image:
17+
needs: [create-release]
18+
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }}
19+
uses: codecov/gha-workflows/.github/workflows/[email protected]
20+
secrets: inherit
21+
with:
22+
push_release: true
23+
repo: ${{ vars.CODECOV_GATEWAY_IMAGE || 'codecov/self-hosted-gateway' }}
24+
cache_requirements: false

.github/workflows/update-release.yml

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

Makefile

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ build_date ?= $(shell git show -s --date=iso8601-strict --pretty=format:%cd $$sh
44
branch = $(shell git branch | grep \* | cut -f2 -d' ')
55
epoch := $(shell date +"%s")
66
dockerhub_image := codecov/self-hosted-gateway
7-
IMAGE := ${CODECOV_GATEWAY_IMAGE}
8-
DEVOPS_IMAGE := ${CODECOV_DEVOPS_IMAGE}
7+
IMAGE := ${AR_REPO}
98
export DOCKER_BUILDKIT := 1
109

1110
shell:
@@ -29,43 +28,34 @@ build.local:
2928
docker tag ${IMAGE}:${release_version}-latest ${IMAGE}:latest
3029
docker tag ${IMAGE}:${release_version}-latest ${IMAGE}:latest-stable
3130

32-
build:
31+
build.self-hosted:
3332
docker build . -t ${IMAGE}:${release_version}-${sha} -t ${IMAGE}:${release_version}-latest -t ${dockerhub_image}:rolling \
3433
--label "org.label-schema.build-date"="$(build_date)" \
3534
--label "org.label-schema.name"="Self-Hosted Gateway" \
3635
--label "org.label-schema.vendor"="Codecov" \
3736
--label "org.label-schema.version"="${release_version}-${sha}" \
3837
--label "org.vcs-branch"="$(branch)" \
3938
--build-arg COMMIT_SHA="${sha}" \
40-
--build-arg VERSION="${release_version}" \
41-
--squash
39+
--build-arg VERSION="${release_version}"
4240

43-
push:
44-
docker push ${IMAGE}:${release_version}-${sha}
45-
docker push ${IMAGE}:${release_version}-latest
41+
tag.self-hosted-rolling:
42+
docker tag ${IMAGE}:${release_version}-${sha} ${dockerhub_image}:rolling
4643

44+
save.self-hosted:
45+
docker save -o self-hosted.tar ${IMAGE}:${release_version}-${sha}
4746

48-
push.rolling:
49-
docker push ${dockerhub_image}:rolling
50-
51-
pull-for-release:
52-
docker pull ${IMAGE}:${release_version}-${sha}
47+
load.self-hosted:
48+
docker load --input self-hosted.tar
5349

54-
pull.devops:
55-
docker pull ${DEVOPS_IMAGE}
50+
push.self-hosted-rolling:
51+
docker push ${dockerhub_image}:rolling
5652

57-
release:
53+
tag.self-hosted-release:
5854
docker tag ${IMAGE}:${release_version}-${sha} ${dockerhub_image}:${release_version}
5955
docker tag ${IMAGE}:${release_version}-${sha} ${dockerhub_image}:latest-stable
6056
docker tag ${IMAGE}:${release_version}-${sha} ${dockerhub_image}:latest-calver
57+
58+
push.self-hosted-release:
6159
docker push ${dockerhub_image}:${release_version}
6260
docker push ${dockerhub_image}:latest-stable
63-
docker push ${dockerhub_image}:latest-calver
64-
65-
dive:
66-
$(MAKE) pull.devops
67-
docker run -e CI=true -v /var/run/docker.sock:/var/run/docker.sock ${DEVOPS_IMAGE} dive ${IMAGE}:${release_version}-${sha} --lowestEfficiency=0.97 --highestUserWastedPercent=0.06
68-
69-
deep-dive:
70-
$(MAKE) pull.devops
71-
docker run -v /var/run/docker.sock:/var/run/docker.sock -v "$(shell pwd)":/tmp ${DEVOPS_IMAGE} /usr/bin/deep-dive -v --config /tmp/.deep-dive.yaml ${IMAGE}:${release_version}-${sha}
61+
docker push ${dockerhub_image}:latest-calver

0 commit comments

Comments
 (0)