Skip to content

Commit 0a45483

Browse files
authored
feat: hadolint presteps for treeless shallow checkout (IN-3652) (#379)
## Description The `checkout` from hadolint job pulls way too much information. This is a prestep to do our own checkout before `hadolint` job cutting the job from 4-5 minutes to <1 minute. It is important to also use `checkout: false` parameter: ``` jobs: - docker/hadolint: dockerfiles: Dockerfile:Dockerfile.nginx ignore_rules: DL3018 failure_threshold: error checkout: false pre-steps: - vfcommon/hadolint_presteps: ssh_fingerprint: << pipeline.parameters.ssh-fingerprint >> ``` As seen in the [CircleCI job](https://app.circleci.com/pipelines/github/voiceflow/creator-app/307518/workflows/dfd0fa35-a072-41f5-a99b-6e9ca5e64d8e/jobs/1731970) of [this PR](voiceflow/creator-app#16997) --- **NOTE**: CircleCI does not allow referencing an orb from inside another orb. Only able to use multiple orbs in the project itself.
1 parent eaf5392 commit 0a45483

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
description: >
2+
Install git and setup for treeless shallow clone before hadolint
3+
4+
parameters:
5+
ssh_fingerprint:
6+
description: SSH Key
7+
type: string
8+
9+
steps:
10+
- add_ssh_keys:
11+
fingerprints:
12+
- "<< parameters.ssh_fingerprint >>"
13+
14+
- run:
15+
name: Install git
16+
command: "apt update && apt install -y git"
17+
18+
- run:
19+
name: Setup SSH
20+
command: |
21+
mkdir -p ~/.ssh
22+
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=' >>~/.ssh/known_hosts
23+
24+
- run:
25+
name: Treeless Shallow Checkout
26+
command: |
27+
git clone --single-branch --no-tags --filter=tree:0 --depth 1 -b "${CIRCLE_BRANCH}" "${CIRCLE_REPOSITORY_URL}" ~/project

0 commit comments

Comments
 (0)