@atomist/sdm-pack-clojure
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

@atomist/sdm-pack-clojure

atomist sdm goals npm version

Atomist software delivery machine (SDM) extension pack providing automated creation, building, and delivery of [Spring][spring] and [Spring Boot][spring-boot] applications.

See the Atomist documentation for more information on what SDMs are and what they can do for you using the Atomist API for software.

Usage

Install the dependency in your SDM project.

$ npm install @atomist/sdm-pack-clojure

Then use its exported method to add the functionality to your SDM in your machine definition.

import {
    SoftwareDeliveryMachine,
    SoftwareDeliveryMachineConfiguration,
} from "@atomist/sdm";
import {
    createSoftwareDeliveryMachine,
} from "@atomist/sdm-core";
import { LeinSupport } from "@atomist/sdm-pack-clojure";

export function machine(configuration: SoftwareDeliveryMachineConfiguration): SoftwareDeliveryMachine {

    const sdm = createSoftwareDeliveryMachine(
        {
            name: "My Software Delivery Machine",
            configuration,
        },
        whenPushSatisfies(IsLein)
            .itMeans("fingerprint a clojure project")
            .setGoals(LeinDefaultBranchBuildGoals));

    sdm.addExtensionPacks(LeinSupport);
            
    return sdm;
};

Goals

goal long name clojure project best practice
leinBuild Lein build run leiningen build and return AppInfo according to leiningen project/version
autofix cljformat run the cljformat tool on all .clj files
version lein-version extract leiningen version, remove any "-SNAPSHOT", add branch-timestamp suffix, and update leiningen project version
dockerBuild lein-docker-build docker files are located at docker/Dockerfile, image name extracted from project.clj, and current version
publish deploy-jar run lein deploy, ensuring that the versioning policy is consistent and project.clj version is in sync with build. Goal includes
                     a project listener to run our metajar preparation specific to how we construct docker images |

Secrets

Secrets required during the build can be baked into each Repo or shared across all of the Repos.

    node node_modules/\@atomist/clj-editors/vault.js create key
    node node_modules/\@atomist/clj-editors/vault.js merge --data '{"CLOJARS_USERNAME": "xxxxx", "CLOJARS_PASSWORD": "xxxxxxx"}'
    node node_modules/\@atomist/clj-editors/vault.js read

The content of the key.txt is made available to running SDMs using the TEAM_CRED environment variable.

Deploying to Clojars

For releases, we add repositories to our leiningen project.clj file

:repositories [["releases" {:url "https://clojars.org/repo"
                              :username :env/clojars_username
                              :password :env/clojars_password
                              :sign-releases false}]]

And encrypt Clojars username/password into our vault.

Deploying Clojure service Docker container to Artifactory

This pack is configured to pick up and use any docker registry referenced in the atomist.config.ts file at sdm.docker.jfrog

{
    "sdm": {
        "docker": {
            "jfrog": {
                "registry": "",
                "user": "",
                "password": ""
            }
        }
    }
}

Support

General support questions should be discussed in the #support channel in the Atomist community Slack workspace.

If you find a problem, please create an issue.

Development

You will need to install Node.js to build and test this project.

Build and test

Install dependencies.

$ npm install

Use the build package script to compile, test, lint, and build the documentation.

$ npm run build

Release

Releases are handled via the Atomist SDM. Just press the 'Approve' button in the Atomist dashboard or Slack.


Created by Atomist. Need Help? Join our Slack workspace.

Package Sidebar

Install

npm i @atomist/sdm-pack-clojure

Weekly Downloads

14

Version

2.0.2

License

Apache-2.0

Unpacked Size

206 kB

Total Files

47

Last publish

Collaborators

  • neilprosser
  • atomist-bot
  • cdupuis
  • slimslenderslacks