Skip to content

Commit 1d978f8

Browse files
chore: import CI and fork-cli tools into skyscanner-internal/develop/v2.14.9/package-fork-tool
1 parent 38985bd commit 1d978f8

File tree

8 files changed

+1444
-172
lines changed

8 files changed

+1444
-172
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@
33
| Workflow | Description |
44
|--------------------|----------------------------------------------------------------|
55
| ci-build.yaml | Build, lint, test, codegen, build-ui, analyze, e2e-test |
6-
| codeql.yaml | CodeQL analysis |
76
| image-reuse.yaml | Build, push, and Sign container images |
87
| image.yaml | Build container image for PR's & publish for push events |
9-
| init-release.yaml | Build manifests and version then create a PR for release branch|
10-
| pr-title-check.yaml| Lint PR for semantic information |
11-
| release.yaml | Build images, cli-binaries, provenances, and post actions |
12-
| scorecard.yaml | Generate scorecard for supply-chain security |
13-
| update-snyk.yaml | Scheduled snyk reports |
148

159
# Reusable workflows
1610

1711
## image-reuse.yaml
1812

19-
- The resuable workflow can be used to publish or build images with multiple container registries(Quay,GHCR, dockerhub), and then sign them with cosign when an image is published.
13+
- The reusable workflow can be used to publish or build images with multiple container registries(Quay,GHCR, dockerhub), and then sign them with cosign when an image is published.
2014
- A GO version `must` be specified e.g. 1.21
2115
- The image name for each registry *must* contain the tag. Note: multiple tags are allowed for each registry using a CSV type.
2216
- Multiple platforms can be specified e.g. linux/amd64,linux/arm64
@@ -26,9 +20,7 @@
2620
| Inputs | Description | Type | Required | Defaults |
2721
|-------------------|-------------------------------------|-------------|----------|-----------------|
2822
| go-version | Version of Go to be used | string | true | none |
29-
| quay_image_name | Full image name and tag | CSV, string | false | none |
3023
| ghcr_image_name | Full image name and tag | CSV, string | false | none |
31-
| docker_image_name | Full image name and tag | CSV, string | false | none |
3224
| platforms | Platforms to build (linux/amd64) | CSV, string | false | linux/amd64 |
3325
| push | Whether to push image/s to registry | boolean | false | false |
3426
| target | Target build stage | string | false | none |

.github/workflows/ci-build.yaml

Lines changed: 100 additions & 71 deletions
Large diffs are not rendered by default.

.github/workflows/image-reuse.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@ jobs:
6767
if: ${{ github.ref_type != 'tag'}}
6868

6969
- name: Setup Golang
70-
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
70+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
7171
with:
7272
go-version: ${{ inputs.go-version }}
73+
cache: false
7374

7475
- name: Install cosign
75-
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
76+
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3.9.1
7677

77-
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
78-
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
78+
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
79+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
7980

8081
- name: Setup tags for container image as a CSV type
8182
run: |
@@ -102,23 +103,23 @@ jobs:
102103
echo 'EOF' >> $GITHUB_ENV
103104
104105
- name: Login to Quay.io
105-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
106+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
106107
with:
107108
registry: quay.io
108109
username: ${{ secrets.quay_username }}
109110
password: ${{ secrets.quay_password }}
110111
if: ${{ inputs.quay_image_name && inputs.push }}
111112

112113
- name: Login to GitHub Container Registry
113-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
114+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
114115
with:
115116
registry: ghcr.io
116117
username: ${{ secrets.ghcr_username }}
117118
password: ${{ secrets.ghcr_password }}
118119
if: ${{ inputs.ghcr_image_name && inputs.push }}
119120

120121
- name: Login to dockerhub Container Registry
121-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
122+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
122123
with:
123124
username: ${{ secrets.docker_username }}
124125
password: ${{ secrets.docker_password }}
@@ -141,7 +142,7 @@ jobs:
141142

142143
- name: Build and push container image
143144
id: image
144-
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0
145+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 #v6.18.0
145146
with:
146147
context: .
147148
platforms: ${{ inputs.platforms }}

.github/workflows/image.yaml

Lines changed: 69 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ name: Image
33
on:
44
push:
55
branches:
6-
- master
6+
# We use skyscanner-internal/master as the base branch for integration
7+
# This branch contains our CI changes and is not meant for direct contributions.
8+
# Our internal development is to be merged into here.
9+
# The changes that are ready for contribution should be cherry-picked to skyscanner-contrib/master.
10+
- skyscanner-internal/master
11+
# Branches to be used for development and testing. They should be based on skyscanner-internal/master.
12+
- skyscanner-internal/develop/**
713
pull_request:
814
branches:
9-
- master
10-
types: [ labeled, unlabeled, opened, synchronize, reopened ]
15+
- skyscanner-internal/master
16+
# Cleaned up, ready for contribution PRs are to be cherry-picked here
17+
- skyscanner-contrib/master
18+
types: [labeled, unlabeled, opened, synchronize, reopened]
1119

1220
concurrency:
1321
group: ${{ github.workflow }}-${{ github.ref }}
@@ -19,7 +27,7 @@ jobs:
1927
set-vars:
2028
permissions:
2129
contents: read
22-
if: github.repository == 'argoproj/argo-cd'
30+
if: github.repository == 'Skyscanner/argo-cd'
2331
runs-on: ubuntu-22.04
2432
outputs:
2533
image-tag: ${{ steps.image.outputs.tag}}
@@ -28,7 +36,13 @@ jobs:
2836
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
2937

3038
- name: Set image tag for ghcr
31-
run: echo "tag=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
39+
run: |
40+
# Get the branch name
41+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
42+
# Sanitize branch name for container registry compliance
43+
SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | sed -e 's/\//-/g' | tr '[:upper:]' '[:lower:]')
44+
# Set the image tag with sanitized branch name
45+
echo "tag=$(cat ./VERSION)-${SANITIZED_BRANCH}-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
3246
id: image
3347

3448
- name: Determine image platforms to use
@@ -37,7 +51,7 @@ jobs:
3751
IMAGE_PLATFORMS=linux/amd64
3852
if [[ "${{ github.event_name }}" == "push" || "${{ contains(github.event.pull_request.labels.*.name, 'test-multi-image') }}" == "true" ]]
3953
then
40-
IMAGE_PLATFORMS=linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
54+
IMAGE_PLATFORMS=linux/amd64,linux/arm64
4155
fi
4256
echo "Building image for platforms: $IMAGE_PLATFORMS"
4357
echo "platforms=$IMAGE_PLATFORMS" >> $GITHUB_OUTPUT
@@ -46,74 +60,76 @@ jobs:
4660
needs: [set-vars]
4761
permissions:
4862
contents: read
49-
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
63+
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
5064
id-token: write # for creating OIDC tokens for signing.
51-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name != 'push' }}
65+
if: ${{ github.repository == 'Skyscanner/argo-cd' && github.event_name != 'push' }}
5266
uses: ./.github/workflows/image-reuse.yaml
5367
with:
5468
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
5569
# renovate: datasource=golang-version packageName=golang
56-
go-version: 1.23.3
70+
go-version: 1.24.4
5771
platforms: ${{ needs.set-vars.outputs.platforms }}
5872
push: false
5973

6074
build-and-publish:
6175
needs: [set-vars]
6276
permissions:
6377
contents: read
64-
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
78+
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
6579
id-token: write # for creating OIDC tokens for signing.
66-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
80+
if: ${{ github.repository == 'Skyscanner/argo-cd' && github.event_name == 'push' }}
6781
uses: ./.github/workflows/image-reuse.yaml
6882
with:
69-
quay_image_name: quay.io/argoproj/argocd:latest
70-
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
83+
# quay_image_name: quay.io/argoproj/argocd:latest
84+
ghcr_image_name: ghcr.io/skyscanner/argocd:${{ needs.set-vars.outputs.image-tag }}
7185
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
7286
# renovate: datasource=golang-version packageName=golang
73-
go-version: 1.23.3
87+
go-version: 1.24.4
7488
platforms: ${{ needs.set-vars.outputs.platforms }}
7589
push: true
7690
secrets:
77-
quay_username: ${{ secrets.RELEASE_QUAY_USERNAME }}
78-
quay_password: ${{ secrets.RELEASE_QUAY_TOKEN }}
91+
#quay_username: ${{ secrets.RELEASE_QUAY_USERNAME }}
92+
#quay_password: ${{ secrets.RELEASE_QUAY_TOKEN }}
7993
ghcr_username: ${{ github.actor }}
8094
ghcr_password: ${{ secrets.GITHUB_TOKEN }}
8195

82-
build-and-publish-provenance: # Push attestations to GHCR, latest image is polluting quay.io
83-
needs:
84-
- build-and-publish
85-
permissions:
86-
actions: read # for detecting the Github Actions environment.
87-
id-token: write # for creating OIDC tokens for signing.
88-
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
89-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
90-
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
91-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0
92-
with:
93-
image: ghcr.io/argoproj/argo-cd/argocd
94-
digest: ${{ needs.build-and-publish.outputs.image-digest }}
95-
registry-username: ${{ github.actor }}
96-
secrets:
97-
registry-password: ${{ secrets.GITHUB_TOKEN }}
98-
99-
Deploy:
100-
needs:
101-
- build-and-publish
102-
- set-vars
103-
permissions:
104-
contents: write # for git to push upgrade commit if not already deployed
105-
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
106-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
107-
runs-on: ubuntu-22.04
108-
steps:
109-
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
110-
- run: git clone "https://$TOKEN@github.com/argoproj/argoproj-deployments"
111-
env:
112-
TOKEN: ${{ secrets.TOKEN }}
113-
- run: |
114-
docker run -u $(id -u):$(id -g) -v $(pwd):/src -w /src --rm -t ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }} kustomize edit set image quay.io/argoproj/argocd=ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
115-
git config --global user.email 'ci@argoproj.com'
116-
git config --global user.name 'CI'
117-
git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ needs.set-vars.outputs.image-tag }}' && git push)
118-
working-directory: argoproj-deployments/argocd
96+
# TODO: Needs allowlisting
97+
# build-and-publish-provenance: # Push attestations to GHCR, latest image is polluting quay.io
98+
# needs:
99+
# - build-and-publish
100+
# permissions:
101+
# actions: read # for detecting the Github Actions environment.
102+
# id-token: write # for creating OIDC tokens for signing.
103+
# packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
104+
# if: ${{ github.repository == 'Skyscanner/argo-cd' && github.event_name == 'push' }}
105+
# # Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
106+
# uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
107+
# with:
108+
# image: ghcr.io/argoproj/argo-cd/argocd
109+
# digest: ${{ needs.build-and-publish.outputs.image-digest }}
110+
# registry-username: ${{ github.actor }}
111+
# secrets:
112+
# registry-password: ${{ secrets.GITHUB_TOKEN }}
119113

114+
# TODO: We would need to fork this repo as well and repoint it to our argocd-deployments repo.
115+
# Do we want this?
116+
# Deploy:
117+
# needs:
118+
# - build-and-publish
119+
# - set-vars
120+
# permissions:
121+
# contents: write # for git to push upgrade commit if not already deployed
122+
# packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
123+
# if: ${{ github.repository == 'Skyscanner/argo-cd' && github.event_name == 'push' }}
124+
# runs-on: ubuntu-22.04
125+
# steps:
126+
# - uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
127+
# - run: git clone "https://$TOKEN@github.com/argoproj/argoproj-deployments"
128+
# env:
129+
# TOKEN: ${{ secrets.TOKEN }}
130+
# - run: |
131+
# docker run -u $(id -u):$(id -g) -v $(pwd):/src -w /src --rm -t ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }} kustomize edit set image quay.io/argoproj/argocd=ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
132+
# git config --global user.email 'ci@argoproj.com'
133+
# git config --global user.name 'CI'
134+
# git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ needs.set-vars.outputs.image-tag }}' && git push)
135+
# working-directory: argoproj-deployments/argocd

0 commit comments

Comments
 (0)