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

Ansible project for all ublue tasks #13

Closed
2 of 5 tasks
tepene opened this issue May 1, 2023 · 8 comments
Closed
2 of 5 tasks

Ansible project for all ublue tasks #13

tepene opened this issue May 1, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@tepene
Copy link
Collaborator

tepene commented May 1, 2023

An ansible project which can be included in the semaphore container https://github.com/ublue-os/forge/tree/main/semaphore is needed.

There should be playbooks for the following "tasks" (list is not compltee...)

  • Clone "ublue-os" repo of choice
  • Build and Upload images to registry.ublue.local
  • Create Test VM
  • Rebase Test VM to us locally built image
  • ....
@tepene tepene added the enhancement New feature or request label May 1, 2023
@tepene
Copy link
Collaborator Author

tepene commented May 1, 2023

the semaphore container has the following ansible version installed:

$ ansible --version
ansible [core 2.13.6]
  config file = None
  configured module search path = ['/home/semaphore/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/semaphore/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.11 (main, Apr  6 2023, 01:17:26) [GCC 11.2.1 20220219]
  jinja version = 3.0.3
  libyaml = True

If another version is needed we need to update the container or build our own.

@tepene tepene self-assigned this May 1, 2023
tepene added a commit that referenced this issue May 8, 2023
use custom ansible version and install ansible collections during
build process
@tepene
Copy link
Collaborator Author

tepene commented Apr 29, 2024

I'm ditching semaphore for the moment. The ansible setup is ready. Will focus on the tasks and not on the GUI.

@castrojo
Copy link
Member

Thanks for your latest pushes! We have a forum now, if you wouldn't mind posting there there then we can get some eyeballs on this part of the project since we have way more people around than when you started: https://universal-blue.discourse.group/

Thanks!

@tepene
Copy link
Collaborator Author

tepene commented Apr 29, 2024

Thanks for your latest pushes! We have a forum now, if you wouldn't mind posting there there then we can get some eyeballs on this part of the project since we have way more people around than when you started: https://universal-blue.discourse.group/

Thanks!

Yeah sure, will do that soon

@castrojo
Copy link
Member

castrojo commented May 1, 2024

I can take a stab at it too if you want, let me know! Thanks for your help on this, lots of people ask for this but few contribute, I appreciate your help!

tepene added a commit that referenced this issue May 1, 2024
feat: ansible playbooks for clone, build & push (#13)
@tepene
Copy link
Collaborator Author

tepene commented May 1, 2024

@castrojo, i just added two examples. I still need to document things. The ./forge.sh setup should give some feedback on dependencies. Once things are up and running you can run two commands from the cli:

  • just -f forge.just forge_clone-repository this will clone the bluefin repository to $HOME/ublue-os/forge/bluefin
  • just -f forge.just forge_build-image should build the image and upload it to registry.ublue.local

I will add a way on how to handle stuff with variables and input parameters. For now things are more or less hard coded.

Example

❯ just -f forge.just forge_build-image
podman exec ublue-os_forge-anvil-ansible.ublue.local ansible-playbook playbooks/project_build.yml

PLAY [Build project] ***********************************************************
Wednesday 01 May 2024  18:53:38 +0000 (0:00:00.041)       0:00:00.041 ********* 

TASK [Gathering Facts] *********************************************************
ok: [host.ublue.local]
Wednesday 01 May 2024  18:53:40 +0000 (0:00:01.331)       0:00:01.372 ********* 

TASK [Build and push an image to registry] *************************************
fatal: [host.ublue.local]: FAILED! => changed=false 
  msg: |-
    Failed to build image bluefin:latest: [1/2] STEP 1/16: FROM ghcr.io/ublue-os/silverblue-main:40 AS base
    [1/2] STEP 2/16: ARG IMAGE_NAME="${IMAGE_NAME}"
    --> Using cache 529d3704f1f76dab99b48ccab7717a5207ee6d69022d21eba9f4feaf413dedcb
    --> 529d3704f1f7
    [1/2] STEP 3/16: ARG IMAGE_VENDOR="${IMAGE_VENDOR}"
    --> Using cache a8cb854716201447afcca088ad7a7e9aef96db69fea766592b9b16beeed99489
    --> a8cb85471620
    [1/2] STEP 4/16: ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
    --> Using cache ff9a3aa0cd72645c565f19d8a9ff468e1a0858809a47d3f2aa9866350ed8edd7
    --> ff9a3aa0cd72
    [1/2] STEP 5/16: ARG AKMODS_FLAVOR="${AKMODS_FLAVOR}"
    --> Using cache 315847276b5b92f3e7897a0c5ddfdaf16cf6d0ef080f9eeed326749ffedd5e41
    --> 315847276b5b
    [1/2] STEP 6/16: ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
    --> Using cache d0aa0b6b50dc381316bb4ea8e2b40adebc5c713f7e6e209d89f23bdf81f6036a
    --> d0aa0b6b50dc
    [1/2] STEP 7/16: ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
    --> Using cache 4b0691c7bea20027dd287059a2eed1110e3781a47741d0153f1b244a77297708
    --> 4b0691c7bea2
    [1/2] STEP 8/16: COPY build_files/base build_files/shared /tmp/build/
    --> Using cache f4be9ab00d2c5510e6dac3a3ec4b468f6a9c01b84ebda526c4c83c4e066dc726
    --> f4be9ab00d2c
    [1/2] STEP 9/16: COPY system_files/shared system_files/${BASE_IMAGE_NAME} /
    --> Using cache f5fa3597e5378d33f5d048c7b3f5aa1afa6d1022ff2328701ccd394a184573f7
    --> f5fa3597e537
    [1/2] STEP 10/16: COPY just /tmp/just
    --> Using cache 4643bfd6328c996cbb8bda92d411293bb9831da29201f8e8fbdb80c9d79df2d4
    --> 4643bfd6328c
    [1/2] STEP 11/16: COPY packages.json /tmp/packages.json
    --> Using cache a3b4709a077ed16444acd3d50dacfe0864f1463c3848f291e3fe85c5f071ca5d
    --> a3b4709a077e
    [1/2] STEP 12/16: COPY /system_files/shared/usr/etc/ublue-update/ublue-update.toml /tmp/ublue-update.toml
    --> Using cache 52bfc328bed8540df8a41a9033243438d536f0562e490455eef51d05e4357d9c
    --> 52bfc328bed8
    [1/2] STEP 13/16: COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/bin/atuin /usr/bin/atuin
    --> Using cache 25216c1af6219a7b1110b9685745869b8b64c6d015267143a0d86a9533f317e3
    --> 25216c1af621
    [1/2] STEP 14/16: COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/share/bash-prexec /usr/share/bash-prexec
    --> Using cache deb6abbd53b0499d3616bc774ac8fc179dbb1b5e32251066b7d3f506b5f1d972
    --> deb6abbd53b0
    [1/2] STEP 15/16: COPY --from=ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
     Error: COPY --from=ghcr.io/ublue-os/akmods:-: no stage or image found with that name

PLAY RECAP *********************************************************************
host.ublue.local           : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Now, as you can see the job fails with Error: COPY --from=ghcr.io/ublue-os/akmods:-: no stage or image found with that name Haven't found out whats exactly missing. It's been a while since I last built the bluefin image.

Maybe you can help me out with this. Feel free to add more tasks or ideas. I will write to the forum asap or if you have some spare time.... I'd love to have the "variable" thing ready before shouting it out, what do you think?

@tepene
Copy link
Collaborator Author

tepene commented May 3, 2024

@castrojo with my latest MR #31 I added a way to load configuration files from the host system. I also addes some documentation on usage. I hope things are clear. Would be great if you could test this. I will post to the forum once someone else has at least tested this. I don't want to embarrass myself 😉

Suggestions for improvements are welcome

@tepene
Copy link
Collaborator Author

tepene commented May 4, 2024

I'm closing here since the ansible project setup is ready. I've created a dedicated feature request #35 for the "test VM" case. I think from now on everything should be tracked in it's own dedicated issue

@tepene tepene closed this as completed May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants