DEV Community

Cover image for GitHub Actions Hackathon'21 - Samba Compiler
Zeki Ahmet Bayar for Açıklab

Posted on

GitHub Actions Hackathon'21 - Samba Compiler

What is Samba ?

We know that when you think of samba, you immediately think of happy Brazilians dancing.

But.. We are so sorry because situation here is not quite what you think. (We know that you are trying to hide your bewilderment because we experienced the same at the beginning.)

So it always happens like this...

Now let's come to our main topic, what is the real samba we are talking about?

SAMBA is a project developed in 1991 by re-adapting the SMB network protocol as free software with reverse engineering methods.

However, it is also worth mentioning that the difference from the default SMB protocol to which it is implemented progresses in a path and version map.

For example, SAMBA 3 released in 2003, enabled the integration of file and printer services between GNU/Linux systems and Windows systems.

Of course, it didn't aim to be an MS Active Directory competitor yet in this version.

But we all knew that one day it would be like this... or not... Well, don't be fooled by how precise I am. Because I was 4 years old then and I didn't even have the slightest idea about samba. I'm talking about the dance.

Years later, with the Samba4 version, which started in 2009 and was announced in 2012, a Domain Controller role similar to MS Active Directory can be added.

And Windows, Mac and GNU/Linux systems can access this Domain Controller with the same configuration. Currently, there is version 4.15.2 and a new version is released approximately every 6 months.

As such, it is a very active free software project.

To summarize briefly, nowadays samba can be used as an alternative to MS Active directory with various configurations. I emphasize certain configurations.

↪️ Samba Compiler

As it is known, the latest version of Samba packages in the most popular GNU/Linux disturbitions repositories does not contain the domain controller role.

If you want to configure samba as a latest version of domain controller, you have to recompile Samba from the source code with various instructions found in Samba Wiki.

This causes instructions to be re-executed in each version (every 6 months). In addition, package dependencies that change in each version can cause Samba to not work properly.

Image description

For these reasons, we designed the Samba Compiler Actions structure.

Structural privileges

  • Thanks to its generic structure, Samba Compiler Actions can easily adapt to that version whenever a new version is released.

  • Since we are aware that Samba can be compiled on many platforms, we have prepared the repository to release each distribution separately, such as centos/debian/ubuntu.

    • Although, it's only available for debian at the moment. All open source supporters are welcome to support this issue in the future!

Image description

  • If you want, you can also create your own .deb and .rpm packages by using this source code compiled with the necessary configurations. In this way, you can easily create or migrate samba domain in all distributions.

Submission Category

The category of these actions is of course 'Maintainer Must-Haves'!

Yaml File or Link to Code

As an example of our logically easy-to-understand actions structure:

- name: Get Samba From Docker
        id: get_samba
        run: |
          docker create -ti --name tar_container generate_tar bash
          docker cp tar_container:/opt/samba.tar.gz ./
          package_name="samba-${{steps.prepare.outputs.os_name}}${{steps.prepare.outputs.os_version}}-${{steps.prepare.outputs.samba_version}}-${{steps.date.outputs.date}}.tar.gz"
          mv samba.tar.gz $package_name
          mkdir samba_directory
          cp $package_name samba_directory

          echo ::set-output name=path::$(pwd)/"$package_name"
          echo ::set-output name=filename::"$package_name"

      - name: Create Release
        id: create_release
        uses: actions/create-release@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: source-${{steps.prepare.outputs.os_name}}-${{steps.prepare.outputs.os_version}}-${{steps.prepare.outputs.samba_version}}-${{steps.date.outputs.date}}
          release_name: source-${{steps.prepare.outputs.os_name}}-${{steps.prepare.outputs.os_version}}-${{steps.prepare.outputs.samba_version}}-${{steps.date.outputs.date}}
          body: |
            Changes in this Release
              - Will be add.
          draft: false
          prerelease: false

      - name: Upload the Samba Source Tar to Release Assets
        id: upload-release-asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ${{ steps.get_samba.outputs.path }}
          asset_name: ${{ steps.get_samba.outputs.filename }}
          asset_content_type: application/tar+gzip
Enter fullscreen mode Exit fullscreen mode

If you want to review all the code Samba Source Code generator is here! ⬇️

GitHub logo aciklab / samba_source

Samba source code generator.

samba

Samba Compiler

As it is known, the Samba package in the GNU&Linux repositories does not contain the domain controller role.

If you want to configure samba as a domain controller, you have to recompile Samba from the source code with various instructions found in Samba Wiki.

This causes instructions to be re-executed in each version (every 6 months). In addition, package dependencies that change in each version can cause Samba to not work properly.

For these reasons, we designed the Samba Compiler Actions structure.

Usage

This repo currently pushes its releases by default at Samba Debian Package Generator. If you do not want to send the releases to another repository, please clean the following files first - Dockerfile - actions.yml - entrypoint.sh - .github/workflows/generate.yml 's 'Pushes to another repository' block

If you want to publish your releases elsewhere, change the values ​​in the .github/workflows/generate.yml 's 'Pushes to another repository'…

Additional Resources / Info

Of course we used some resources to develop this actions.

Our Team

Discussion (0)