Skip to content

Commit

Permalink
ci: Switch to devbox (#1843)
Browse files Browse the repository at this point in the history
* ci: Switch to devbox

Signed-off-by: Mikołaj Baranowski <[email protected]>

* fix: Martin's comments

Signed-off-by: Mikołaj Baranowski <[email protected]>

* chore: Addressing Jimmi's comments

Signed-off-by: Mikołaj Baranowski <[email protected]>

* chore: Another round of Jimmi's comments

Signed-off-by: Mikołaj Baranowski <[email protected]>

* chore: Use devbox run

Signed-off-by: Mikołaj Baranowski <[email protected]>

---------

Signed-off-by: Mikołaj Baranowski <[email protected]>
  • Loading branch information
mikolajb authored Feb 14, 2024
1 parent 54f1758 commit ea0d86d
Show file tree
Hide file tree
Showing 25 changed files with 396 additions and 1,406 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/create-dev-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,21 @@ jobs:
ref: ${{ matrix.branch }}
depth: 0

- name: Setup asdf
uses: asdf-vm/actions/setup@v3
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Generate tag
run: |
# Overriding a variable that causes a conflict in legacy
# versions of gh-dkp
export GITHUB_REPOSITORY="kommander-applications"
OUT=$(make repo.dev.tag)
OUT=$(devbox run -- make repo.dev.tag)
echo "TAG=$(echo ${OUT##* })" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.MESOSPHERECI_USER_TOKEN }}
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/flux-update-scheduled-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ jobs:
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }}

- name: Setup asdf
uses: asdf-vm/actions/setup@v3
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Check for Flux update
env:
GH_TOKEN: ${{ secrets.MESOSPHERECI_USER_TOKEN }}
run: make KOMMANDER_REPO_PATH=${GITHUB_WORKSPACE}/kommander make flux-update
run: devbox run -- "make KOMMANDER_REPO_PATH=${GITHUB_WORKSPACE}/kommander make flux-update"
12 changes: 9 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install tools
uses: asdf-vm/actions/install@v3
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Run pre-commit
env:
MAGEFILE_VERBOSE: true
run: ./mage lint:precommit
run: devbox run -- ./mage lint:precommit
14 changes: 9 additions & 5 deletions .github/workflows/manifest-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ jobs:
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }}

- name: Setup asdf
uses: asdf-vm/actions/setup@v3
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Run tests
run: GOOS=linux GOARCH=amd64 make validate-manifests
run: devbox run -- "GOOS=linux GOARCH=amd64 make validate-manifests"
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ jobs:
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }}

- name: Install asdf & tools
uses: asdf-vm/actions/install@v3
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -42,4 +48,4 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
GIT_TAG: ${{ env.GIT_TAG }}
run: make release
run: devbox run -- make release
12 changes: 9 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup asdf
uses: asdf-vm/actions/setup@v3
- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Run unit tests
run: make go-test
run: devbox run -- make go-test

- name: Report Coveralls
uses: coverallsapp/github-action@v2
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/update-service-labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Setup asdf
uses: asdf-vm/actions/setup@v3

- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Update .github/service-labeler.yaml
run: make workflow-labeler-yaml-update
- name: Commit and push changes
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/validate-licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,22 @@ jobs:
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Setup asdf
uses: asdf-vm/actions/setup@v3
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install NIX
uses: cachix/install-nix-action@v24

- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
skip-nix-installation: true

- name: Generate image list
run: |
export PATH=${PWD}/.local/bin:$PATH
make install-tool.helm install-tool.go.envsubst install-tool.go.gojq
helm plugin install https://github.com/d2iq-labs/helm-list-images
./hack/list-images.sh > images.txt
devbox run -- helm plugin install https://github.com/d2iq-labs/helm-list-images
devbox run -- ./hack/list-images.sh > images.txt
echo "printing contents of images.txt"
cat images.txt
- name: Update licenses
Expand Down
3 changes: 0 additions & 3 deletions .go-tools

This file was deleted.

10 changes: 0 additions & 10 deletions .tool-versions

This file was deleted.

38 changes: 0 additions & 38 deletions Dockerfile.ci

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
include make/all.mk

# Versions for tools that are not managed by asdf.
ASDF_VERSION=0.8.1
DOCKER_VERSION=20.10.7

# Inputs required to build the CI Docker image with a determinstic tag.
CI_DOCKER_BUILD_ARGS=ASDF_VERSION=$(ASDF_VERSION)\
DOCKER_VERSION=$(DOCKER_VERSION)
CI_DOCKER_EXTRA_FILES=.tool-versions
28 changes: 28 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"packages": {
"awscli2": "latest",
"direnv": "latest",
"docker": "latest",
"envsubst": "latest",
"fluxcd": "latest",
"github-cli": "latest",
"gitlint": "latest",
"go": "1.20",
"gojq": "latest",
"golangci-lint": "latest",
"kubernetes-helm": "latest",
"kustomize": "latest",
"pre-commit": "latest",
"yq-go": "latest"
},
"shell": {
"scripts": {
"sync-go-version": [
"VERSION=$(go mod edit -json hack/release/go.mod | jq -r .Go)",
"tmp=$(mktemp)",
"jq \".packages.go = \\\"${VERSION}\\\"\" devbox.json > ${tmp}",
"mv ${tmp} devbox.json"
]
}
}
}
Loading

0 comments on commit ea0d86d

Please sign in to comment.