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

Latest Version Of Morph(1.8) Breaks CI #228

Open
bdkiran opened this issue Oct 25, 2024 · 10 comments
Open

Latest Version Of Morph(1.8) Breaks CI #228

bdkiran opened this issue Oct 25, 2024 · 10 comments

Comments

@bdkiran
Copy link

bdkiran commented Oct 25, 2024

I set up a GitHub actions that deploys to my virtual machines running in digital ocean, this has been running fine over the past couple of months until a few days ago when the 1.8 Version of Morph was released.

I'm getting the error when running the morph deploy network.nix switch command. This is being run in a Nix Shell on ubuntu:

       error: Neither nixpkgs.hostPlatform nor the legacy option nixpkgs.system has been set.
       You can set nixpkgs.hostPlatform in hardware-configuration.nix by re-running
       a recent version of nixos-generate-config.
       The option nixpkgs.system is still fully supported for NixOS 22.05 interoperability,
       but will be deprecated in the future, so we recommend to set nixpkgs.hostPlatform.
Error while running `nix-instantiate ..`: exit status 1

My understanding is that some nixpkgs.hostPlatform or nixpkgs.system needs to be set but is this option available in a nix-shell? Maybe there is a flag I can set on my nix-shell to emulate this.

Here is my deployment yaml for github actions

name: infra-deployment

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Code
      uses: actions/checkout@v4

    - name: Add SSH key
      env:
        SSH_AUTH_SOCK: /tmp/ssh_agent.sock
      run: |
          setup ssh keys
    
    - name: Install Nix On Runner
      uses: cachix/install-nix-action@v30
      with:
        nix_path: nixpkgs=channel:nixos-24.05-small

    - name: Deploy to Production
      uses: workflow/nix-shell-action@v3
      env:
        SSH_AUTH_SOCK: /tmp/ssh_agent.sock
      with:
        packages: morph
        script: |
          morph deploy network.nix switch

I understand that this is not a common use case of this package but I would like to resolve it. I would gladly contribute my workflows for others that want to do similar things in their pipelines. It has really helped me set up CI/CD in my nix server workflows.

@cafkafk
Copy link
Member

cafkafk commented Oct 25, 2024

I set up a GitHub actions that deploys to my virtual machines running in digital ocean, this has been running fine over the past couple of months until a few days ago when the 1.8 Version of Morph was released.

morph 1.8 hasn't hit nixpkgs-unstable or nixpkgs-stable yet, how did you install morph? what does morph --version say?

@bdkiran
Copy link
Author

bdkiran commented Oct 25, 2024

I found it was using this version from the logs of the actions runner

unpacking 'github:NixOS/nixpkgs/062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6' into the Git cache...
these 28 paths will be fetched (17.67 MiB download, 80.85 MiB unpacked):
  ...
  /nix/store/rpzpvql7bg3f7ajqrcgwnf2gxn4qcacc-morph-1.8.0
  /nix/store/md4pnq3k7cjl3gvjh8j5s11rm6hhzv4v-morph-1.8.0-lib
  ...
copying path '/nix/store/rpzpvql7bg3f7ajqrcgwnf2gxn4qcacc-morph-1.8.0' from 'http://127.0.0.1:37515'...
unpacking 'https://nixos.org/channels/nixos-[24](https://github.com/integrandio/integrand-infra/actions/runs/11520544650/job/32072112888#step:6:25).05-small/nixexprs.tar.xz' into the Git cache...

I'm not sure why it's pulling down that specific package but based on the logs it is. Also from previous runs, this seems to be the only thing that has changed in terms of dependencies.

This is a simplified version of the log I can provide the full log if needed.

@bdkiran
Copy link
Author

bdkiran commented Oct 25, 2024

My understanding is that morph is contained in the channel:nixos-24.05-small. I don't do any other installation.

I run morph via the nix-shell-action. However, I may be wrong with how the shell action works it may be installing that package itself when it is set up(By calling the latest github ref?).

I'm doing some tests now to remove that action abstraction.

@bdkiran
Copy link
Author

bdkiran commented Oct 25, 2024

@cafkafk
I went ahead and removed the dependency and ran morph version and it returned 1.8.0.

Installation

I'm "installing morph with nix shell nix shell nixpkgs#morph via the command. Its my understanding that morph is bundled withnixpkgs-unstable.

Github actions yaml

name: infra-deployment

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Code
      uses: actions/checkout@v4
    
    - name: Install Nix On Runner
      uses: cachix/install-nix-action@v30
      with:
        nix_path: nixpkgs=channel:nixos-unstable
    
    - name: Run Morph Nix Deploy 
      run: nix shell nixpkgs#morph --command sh -c "morph --version"

Logs

Full Logs:

nix shell nixpkgs#morph --command sh -c "morph --version"
  shell: /usr/bin/bash -e {0}
  env:
    NIX_PATH: nixpkgs=channel:nixos-unstable
    TMPDIR: /home/runner/work/_temp
    SSH_AUTH_SOCK: /tmp/ssh_agent.sock
unpacking 'github:NixOS/nixpkgs/41dea55[3](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:3)21e5a999b17033296ac05fe8a8b5a257' into the Git cache...
these 28 paths will be fetched (17.67 MiB download, 80.85 MiB unpacked):
  /nix/store/1n0xqghd6gl3vqhslv[4](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:4)6y10y7jhmgish-audit-4.0
  /nix/store/717iy[5](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:5)5ncqs0wmhdkwc5fg2vci5wbmq8-bash-5.2p32
  /nix/store/vg03r9ivgfbdb[6](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:6)2m0xpdsmwydypxbzh7-db-4.8.30
  /nix/store/r2z13zw654y9j[7](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:7)bh5i4knahj2p260br5-dns-root-data-2024-06-20
  /nix/store/y3kdn61k93rq2jx1lj2x72lnsk0l92qh-gcc-13.3.0-lib
  /nix/store/lw294qfdnf29lhxqwzy9byrmx975rvn9-gcc-13.3.0-libgcc
  /nix/store/sl141d1g77wvhr050ah[8](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:9)7lcyz2czdxa3-glibc-2.40-36
  /nix/store/rf0fghzwlqjz4hinr5vqsx2clpc1p9w5-iana-etc-20240318
  /nix/store/0q2xzcs68yz1j6bnrcd2gydfj121yj17-ldns-1.8.4
  /nix/store/d1mvzz1y3g1b8bjkmmmylxwrhyw5h370-libcap-2.70-lib
  /nix/store/dzaq6r17xj5kzgzjw3y14phj34vy2647-libcbor-0.11.0
  /nix/store/jvybql[9](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:10)4wz5ry5cfn4x90l9pj1lwk86y-libedit-20240808-3.1
  /nix/store/910i3jhip24di2cw6n4mdy39xlvmn54y-libfido2-1.15.0
  /nix/store/jwsdpq2yxw43ixalh93z726czz7bay2j-libidn2-2.3.7
  /nix/store/w19cxz37j5nrkg8w80y91bga893[10](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:11)jgi-libunistring-1.2
  /nix/store/2wa8n8wk5jq815bmyk12ijam26na4q8i-libxcrypt-4.4.36
  /nix/store/m5mhqggiq2pgq0q92pw8lwzilk08kary-linux-pam-1.6.1
  /nix/store/h65rq26y400y22027m4gaymz9bwfz2v9-mailcap-2.1.54
  /nix/store/rpzpvql7bg3f7ajqrcgwnf2gxn4qcacc-morph-1.8.0
  /nix/store/md4pnq3k7cjl3gvjh8j5s[11](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:12)rm6hhzv4v-morph-1.8.0-lib
  /nix/store/53iigsmf32bwkfdhhihq2rppgk23k2rg-ncurses-6.4.2022[12](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:13)31
  /nix/store/acsizblhw61cl9f5s8cg5n2xz3ndq0px-openssh-9.8p1
  /nix/store/k09x35dsjavyy4xbfda7aafi1knwqd20-openssl-3.3.2
  /nix/store/mr1g4l3icax812hijn8qnsjp59k82bak-pcsclite-2.2.3-lib
  /nix/store/cw7m8vly5kqgygrsy3yfishcavsaiqvp-systemd-minimal-libs-256.6
  /nix/store/4isk5ynprzbw7ddbj5rq5ag9a6xbl66f-tzdata-2024b
  /nix/store/4hcdxyjf9yiq7qf3i4548drb6sjmwa1v-xgcc-[13](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:14).3.0-libgcc
  /nix/store/haci0d018njygwdga95bsbx8ww2iswy7-zlib-1.3.1
copying path '/nix/store/rf0fghzwlqjz4hinr5vqsx2clpc1p9w5-iana-etc-20240318' from 'https://cache.nixos.org'...
copying path '/nix/store/h65rq26y400y22027m4gaymz9bwfz2v9-mailcap-2.1.54' from 'https://cache.nixos.org'...
copying path '/nix/store/md4pnq3k7cjl3gvjh8j5s11rm6hhzv4v-morph-1.8.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/r2z13zw654y9j7bh5i4knahj2p260br5-dns-root-data-2024-06-20' from 'https://cache.nixos.org'...
copying path '/nix/store/lw294qfdnf29lhxqwzy9byrmx975rvn9-gcc-13.3.0-libgcc' from 'https://cache.nixos.org'...
copying path '/nix/store/w19cxz37j5nrkg8w80y91bga89310jgi-libunistring-1.2' from 'https://cache.nixos.org'...
copying path '/nix/store/4hcdxyjf9yiq7qf3i4548drb6sjmwa1v-xgcc-13.3.0-libgcc' from 'https://cache.nixos.org'...
copying path '/nix/store/4isk5ynprzbw7ddbj5rq5ag9a6xbl66f-tzdata-2024b' from 'https://cache.nixos.org'...
copying path '/nix/store/jwsdpq2yxw43ixalh93z726czz7bay2j-libidn2-2.3.7' from 'https://cache.nixos.org'...
copying path '/nix/store/sl[14](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:15)1d1g77wvhr050ah87lcyz2czdxa3-glibc-2.40-36' from 'https://cache.nixos.org'...
copying path '/nix/store/717iy55ncqs0wmhdkwc5fg2vci5wbmq8-bash-5.2p32' from 'https://cache.nixos.org'...
copying path '/nix/store/53iigsmf32bwkfdhhihq2rppgk23k2rg-ncurses-6.4.20221231' from 'https://cache.nixos.org'...
copying path '/nix/store/k09x35dsjavyy4xbfda7aafi1knwqd20-openssl-3.3.2' from 'https://cache.nixos.org'...
copying path '/nix/store/y3kdn61k93rq2jx1lj2x72lnsk0l92qh-gcc-13.3.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/2wa8n8wk5jq8[15](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:16)bmyk12ijam26na4q8i-libxcrypt-4.4.36' from 'https://cache.nixos.org'...
copying path '/nix/store/dzaq6r17xj5kzgzjw3y14phj34vy2647-libcbor-0.11.0' from 'https://cache.nixos.org'...
copying path '/nix/store/d1mvzz1y3g1b8bjkmmmylxwrhyw5h370-libcap-2.70-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/haci0d018njygwdga95bsbx8ww2iswy7-zlib-1.3.1' from 'https://cache.nixos.org'...
copying path '/nix/store/mr1g4l3icax812hijn8qnsjp59k82bak-pcsclite-2.2.3-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/cw7m8vly5kqgygrsy3yfishcavsaiqvp-systemd-minimal-libs-256.6' from 'https://cache.nixos.org'...
copying path '/nix/store/1n0xqghd6gl3vqhslv46y10y7jhmgish-audit-4.0' from 'https://cache.nixos.org'...
copying path '/nix/store/910i3jhip24di2cw6n4mdy39xlvmn54y-libfido2-1.15.0' from 'https://cache.nixos.org'...
copying path '/nix/store/0q2xzcs68yz1j6bnrcd2gydfj121yj[17](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:18)-ldns-1.8.4' from 'https://cache.nixos.org'...
copying path '/nix/store/vg03r9ivgfbdb62m0xpdsmwydypxbzh7-db-4.8.30' from 'https://cache.nixos.org'...
copying path '/nix/store/jvybql94wz5ry5cfn4x90l9pj1lwk86y-libedit-[20](https://github.com/integrandio/integrand-infra/actions/runs/11522489956/job/32078478741#step:5:21)240808-3.1' from 'https://cache.nixos.org'...
copying path '/nix/store/m5mhqggiq2pgq0q92pw8lwzilk08kary-linux-pam-1.6.1' from 'https://cache.nixos.org'...
copying path '/nix/store/acsizblhw61cl9f5s8cg5n2xz3ndq0px-openssh-9.8p1' from 'https://cache.nixos.org'...
copying path '/nix/store/rpzpvql7bg3f7ajqrcgwnf2gxn4qcacc-morph-1.8.0' from 'https://cache.nixos.org'...
1.8.0

Could it possible that the 1.8 version has hit the nixpkgs channel?

@bdkiran
Copy link
Author

bdkiran commented Oct 25, 2024

I went ahead and found a fix for my specific issue. Looks like it revolved around the nix shell command documented here:

For whatever reason, default shell is the latest version of morph:
nix shell nixpkgs#morph --command sh -c "morph --version"
is 1.8

I went ahead and pined a specific nixpkgs version to 24.05
nix shell nixpkgs/nixos-24.05#morph --command sh -c "morph --version"
is 1.7

Going forward with version 1.8, do we know what is cause the original error? Seems to me like evalConfig: Ensure system is null for eval-config feature is breaking when used in a nix shell.

@cafkafk
Copy link
Member

cafkafk commented Oct 25, 2024

Could it possible that the 1.8 version has hit the nixpkgs channel?

Yes, seems it has in fact hit nixpkgs-unstable (but not nixos-unstable yet).
2024-10-25_23-12

Currently, morph does not have any versioning semantics (as convenient as that may be), so this change could potentially be breaking.

Considering the last release was in Apr 21, 2022, it seems likely that something has simply changed that isn't backwards compatible.

@bdkiran
Copy link
Author

bdkiran commented Oct 26, 2024

Okay I see, I'll go ahead and debug the 1.8 version issues I saw an post an update to fix the nix shell issue with Morph.

As I said earlier, I found my workflows to help me a lot in my CI/CD efforts when using github actions and Morph. Is there a place for me to add this documentation to the Morph repo? I don't mind adding a readme to help others do the same.

@cafkafk
Copy link
Member

cafkafk commented Oct 26, 2024

Is there a place for me to add this documentation to the Morph repo? I don't mind adding a readme to help others do the same.

There currently isn't to my knowledge, but I'll make sure to ask the team if this is something we can add, I'll get back to you!

@adamtulinius
Copy link
Contributor

As I said earlier, I found my workflows to help me a lot in my CI/CD efforts when using github actions and Morph. Is there a place for me to add this documentation to the Morph repo? I don't mind adding a readme to help others do the same.

Hi there. Sorry you're running into trouble. :(

Maybe my brain is just fried from all this NixCon'ing, but to me it looks like your workflow is fairly standard from what Morph is expected to be able to do. What is it I'm missing? :)

Thank you for looking into what might be causing your problem!

@bdkiran
Copy link
Author

bdkiran commented Oct 27, 2024

Yes it is standard usage of Nix and may not be very relevant to Morph itself. I guess as a noob trying to get this to work it was not clear to me how to use Morph to even try it out. I understand that Nix has a large learning curve and my knowledge was lacking there.

I was thinking of a quick start section with how to use Morph within a nix shell environment would be useful to others wanting to see how they could quickly try it out?

Its a great tool and helped me a ton with my own CD workflows. Just from my own experience, others could be turned away by not having a quick way to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants