Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(devbox): Build image #2943

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,43 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-devbox-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
name: Build and Push app-autoscaler-release-devbox
env:
IMAGE_NAME: ${{ github.repository }}-devbox
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: ci/dockerfiles/autoscaler-devbox/Dockerfile
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main

build-and-push-image:
runs-on: ubuntu-latest
permissions:
Expand All @@ -30,6 +64,8 @@ jobs:
matrix:
image_suffix: ["tools"]
name: Build and Push app-autoscaler-release-${{ matrix.image_suffix }}
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
18 changes: 18 additions & 0 deletions ci/dockerfiles/autoscaler-devbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM jetpackio/devbox@sha256:430afb5a5c9b4ec9f56776e8fcb82fe67fa5fabba3ba67ebb1c13b17d0e8de8d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested if the CI-pipeline required stuff like make acceptance-tests, make test etc. works with this docker image?



# Installing your devbox project
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown "${DEVBOX_USER}:${DEVBOX_USER}" /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock


# Copying local flakes directories
COPY local-flake local-flake

RUN devbox run -- echo "Installed Packages."

CMD ["devbox", "shell"]
77 changes: 39 additions & 38 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
{
"packages": [
"path:local-flake#bosh-bootloader",
"path:local-flake#app-autoscaler-cli-plugin",
"path:local-flake#log-cache-cli-plugin",
"path:local-flake#uaac",
"credhub-cli@latest",
"delve@latest",
"gh@latest",
"go-tools@latest",
"gopls@latest",
"nodejs@latest",
"nodePackages.yaml-language-server@latest",
"rubocop@latest",
"rubyPackages.solargraph@latest",
"swagger-cli@latest",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"pre-commit@latest",
"[email protected]",
"[email protected]",
"[email protected]",
"which@latest",
"jq@latest",
"[email protected]",
"python@latest",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"google-cloud-sdk@latest",
"temurin-bin-17@latest",
"bundix@latest",
"oha@latest"
],
"packages": {
"path:local-flake#bosh-bootloader": "",
"path:local-flake#app-autoscaler-cli-plugin": "",
"path:local-flake#log-cache-cli-plugin": "",
"path:local-flake#cloud-mta-build-tool": "",
"path:local-flake#uaac": "",
"credhub-cli": "latest",
"delve": "latest",
"gh": "latest",
"go-tools": "latest",
"gopls": "latest",
"nodejs": "latest",
"nodePackages.yaml-language-server": "latest",
"rubocop": "latest",
"rubyPackages.solargraph": "latest",
"swagger-cli": "latest",
"actionlint": "1.6.27",
"direnv": "2.34.0",
"gnumake": "4.4",
"maven": "3.8.6",
"pre-commit": "latest",
"bosh-cli": "7.5.6",
"golangci-lint": "1.57.2",
"yq-go": "4.43.1",
"which": "latest",
"jq": "latest",
"fly": "7.10.0",
"python": "latest",
"cloudfoundry-cli": "8.7.10",
"shellcheck": "0.10.0",
"act": "0.2.62",
"go": "1.21.5",
"ruby": "3.3.1",
"ginkgo": "2.17.3",
"bundix": "latest",
"oha": "latest",
"google-cloud-sdk": "latest",
"temurin-bin-17": "latest"
},
"shell": {
"init_hook": [
"cf install-plugin -f $(which app-autoscaler-cli-plugin)",
Expand Down
24 changes: 24 additions & 0 deletions local-flake/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@
ldflags = ["-s" "-w" "-X main.version=${version}"];
};

cloud-mta-build-tool = nixpkgsFor.${system}.buildGoModule rec {
pname = "Cloud MTA Build Tool";
version = "1.2.26";

src = nixpkgsFor.${system}.fetchFromGitHub {
owner = "SAP";
repo = "cloud-mta-build-tool";
rev = "v${version}";
hash = "sha256-DKZ9Nj/sNC9dRjyiu4MKjLrIJWluYlZzUHWqEqtrNt4=";
};

vendorHash = "sha256-h8LPsuxvbr/aRhH1vR1fYgBot37yrfiemZTJMKj0zbk=";

ldflags = ["-s" "-w" "-X main.Version=${version}"];

doCheck = false;

postInstall = ''
pushd "$out/bin" &> /dev/null
ln -s 'cloud-mta-build-tool' 'mbt'
popd
'';
};

uaac = nixpkgsFor.${system}.bundlerApp rec {
pname = "cf-uaac";
gemdir = ./.;
Expand Down
5 changes: 1 addition & 4 deletions scripts/asdf2devbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
def get_installed_version(package):
with open(os.path.join(script_dir, '..', 'devbox.json'), 'r') as f:
data = json.load(f)
for pkg in data['packages']:
if pkg.startswith(f"{package}@"):
return pkg.split('@')[1]
return None
Comment on lines -14 to -17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one 👍

return data['packages'][package]

# Read the .tool-versions file and process each line
if __name__ == "__main__":
Expand Down
Loading