Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d2c1ac0
update dependencies for compatibility
jackdpeterson Jul 26, 2024
926335b
update facts from global ::osfamily to $facts['os']['name']
jackdpeterson Jul 29, 2024
527bf8a
update facts from global ::osfamily to $facts['os']['name']
jackdpeterson Jul 29, 2024
a717f5a
group debian and ubuntu together
jackdpeterson Jul 29, 2024
89a4380
get rid of proxy_uri
jackdpeterson Jul 30, 2024
4b8a079
fix install script
jackdpeterson Jul 30, 2024
afb0332
remove package dependency and instead rely on ```File['/usr/local/bin…
jackdpeterson Aug 5, 2024
231487a
support /usr/bin/aws and /usr/local/bin/aws possible executable paths
jackdpeterson Aug 5, 2024
a3a8862
CodeDeploy agent doesn't install on ubuntu 26.04 by default because o…
jackdpeterson May 5, 2026
0e32bfd
add github actions to validate.
jackdpeterson May 5, 2026
3d04f7a
align conventions with voxpupuli team's approach to puppet module lin…
jackdpeterson May 5, 2026
f04ba55
update name; upstream not taking merges.
jackdpeterson May 5, 2026
696f5fe
make the PDK
jackdpeterson May 5, 2026
32564d7
more PDK release fun
jackdpeterson May 5, 2026
ff53cd9
Automate release: set version from tag, attach tarball to GitHub Release
jackdpeterson May 5, 2026
4dad411
workaround the absence of ruby 3.2 on ubuntu 26.04 for installing cod…
jackdpeterson May 5, 2026
af2688e
Use system Ruby on all Ubuntu versions; agent verified compatible wit…
jackdpeterson May 5, 2026
0c730b8
Hold codedeploy-agent package to prevent apt broken dependency errors
jackdpeterson May 5, 2026
d49a562
Repack codedeploy-agent .deb to add ruby3.3 dependency
jackdpeterson May 5, 2026
9a3a4e9
Extract deb repack logic to idempotent shell script
jackdpeterson May 5, 2026
ac5ca8b
Only patch deb when system Ruby is 3.3+
jackdpeterson May 5, 2026
c8d200e
Fix: use OS version instead of ruby fact for patch condition
jackdpeterson May 5, 2026
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
9 changes: 6 additions & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
codedeploy: "#{source_dir}"
stdlib:
repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "v9.7.0"
archive:
repo: "https://github.com/voxpupuli/puppet-archive.git"
ref: "v7.1.0"
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Build & Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install PDK
run: gem install pdk
- name: Set version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" metadata.json
- name: Build module tarball
run: pdk build --force
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create ${{ github.ref_name }} pkg/*.tar.gz --generate-notes
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test CodeDeploy Module

on:
push:
branches: [master, main]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: Lint & Unit Tests
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run lint
run: bundle exec rake lint
- name: Run spec
run: bundle exec rake spec
- name: Validate metadata
run: bundle exec metadata-json-lint metadata.json

integration:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
include:
- base_image: ubuntu:24.04
package_manager: apt
name: Ubuntu 24.04
- base_image: ubuntu:26.04
package_manager: apt
name: Ubuntu 26.04
- base_image: amazonlinux:2023
package_manager: yum
name: Amazon Linux 2023
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v5
- name: Build and test
run: |
docker build -f Dockerfile.test \
--build-arg BASE_IMAGE=${{ matrix.base_image }} \
--build-arg PACKAGE_MANAGER=${{ matrix.package_manager }} \
-t puppet-codedeploy:test .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
/log
.yardoc
coverage
/.idea
/extracted_deb
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--format documentation
--color
--format documentation
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

33 changes: 33 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ARG BASE_IMAGE=ubuntu:24.04
FROM ${BASE_IMAGE}

ARG PACKAGE_MANAGER=apt
ENV DEBIAN_FRONTEND=noninteractive

# Install puppet
RUN if [ "$PACKAGE_MANAGER" = "apt" ]; then \
apt-get update && apt-get install -y puppet && apt-get clean; \
else \
rpm -Uvh https://yum.puppet.com/puppet8-release-el-9.noarch.rpm && \
yum install -y puppet-agent procps && yum clean all; \
fi

ENV PATH="/opt/puppetlabs/bin:${PATH}"
RUN puppet module install puppet-archive --version 7.1.0

COPY . /etc/puppet/code/modules/codedeploy

# Apply module (service may fail in Docker - that's expected)
RUN puppet apply -e "include codedeploy" --modulepath=/etc/puppet/code/modules || true

# Validate package is installed
RUN if [ "$PACKAGE_MANAGER" = "apt" ]; then \
dpkg -s codedeploy-agent | grep "Status: install ok installed"; \
else \
rpm -q codedeploy-agent; \
fi

# Validate expected binaries exist
RUN test -x /opt/codedeploy-agent/bin/codedeploy-agent && \
test -x /opt/codedeploy-agent/bin/codedeploy-local && \
test -x /opt/codedeploy-agent/bin/install
26 changes: 4 additions & 22 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
source "https://rubygems.org"

group :test do
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.0'
gem "rspec", '< 3.2.0'
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem "puppetlabs_spec_helper"
gem "metadata-json-lint"
gem "rspec-puppet-facts"
end

group :development do
gem "travis"
gem "travis-lint"
gem "vagrant-wrapper"
gem "puppet-blacksmith"
gem "guard-rake"
end

group :system_tests do
gem "beaker"
gem "beaker-rspec"
end
gem "puppet", ENV['PUPPET_VERSION'] || '~> 8.0'
gem "rake"
gem "voxpupuli-test", "~> 14.0"
gem "metadata-json-lint"
5 changes: 0 additions & 5 deletions Guardfile

This file was deleted.

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.PHONY: test

test:
docker build -f Dockerfile.test --build-arg BASE_IMAGE=ubuntu:24.04 --build-arg PACKAGE_MANAGER=apt -t puppet-codedeploy:ubuntu-24.04 .
docker build -f Dockerfile.test --build-arg BASE_IMAGE=ubuntu:26.04 --build-arg PACKAGE_MANAGER=apt -t puppet-codedeploy:ubuntu-26.04 .
docker build -f Dockerfile.test --build-arg BASE_IMAGE=amazonlinux:2023 --build-arg PACKAGE_MANAGER=yum -t puppet-codedeploy:al2023 .
68 changes: 54 additions & 14 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,40 +1,80 @@
# AWS CodeDeploy Puppet Module

[![Build Status](https://travis-ci.org/walkamongus/puppet-codedeploy.svg?branch=master)](https://travis-ci.org/walkamongus/puppet-codedeploy)
[![Test](https://github.com/jackdpeterson/puppet-codedeploy/actions/workflows/test.yml/badge.svg)](https://github.com/jackdpeterson/puppet-codedeploy/actions/workflows/test.yml)

#### Table of Contents
## Build Status

1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Setup - The basics of getting started with codedeploy](#setup)
* [What codedeploy affects](#what-codedeploy-affects)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Limitations - OS compatibility, etc.](#limitations)
- [x] Ubuntu 24.04
- [x] Ubuntu 26.04
- [x] Amazon Linux 2023

## Overview

This module installs and enables the AWS CodeDeploy agent.

## Module Description

The AWS Codedeploy allows you to automatically deploy applications to AWS instances from S3 or GitHub. This module installs any required packages followed by the CodeDeploy agent. It then enables the codedeploy-agent service and ensures that it is running.
The AWS CodeDeploy service allows you to automatically deploy applications to AWS instances from S3 or GitHub. This module downloads and installs the CodeDeploy agent package directly from the regional S3 bucket, configures the agent, and ensures the service is running.

## Setup

### What codedeploy affects

* Packages
* codedeploy-agent
* awscli (Debian)
* ruby-full (Debian/Ubuntu)
* Services
* codedeploy-agent daemon

### Dependencies

* [puppetlabs/stdlib](https://forge.puppet.com/modules/puppetlabs/stdlib)
* [puppet/archive](https://forge.puppet.com/modules/puppet/archive)

## Usage

The codedeploy-agent package requires a version of Ruby > 2.0.x to be installed under /usr/bin/ruby. This dependency must be satisfied prior to installing the codedeploy-agent package. The recommended way of doing this is via the [puppetlabs/ruby](https://forge.puppetlabs.com/puppetlabs/ruby) module.
```puppet
include codedeploy
```

To specify a different AWS region:

```puppet
class { 'codedeploy':
aws_region => 'eu-west-1',
}
```

## Parameters

| Parameter | Default | Description |
|-----------|---------|-------------|
| `aws_region` | `us-west-1` | AWS region for the CodeDeploy S3 bucket |
| `service_name` | `codedeploy-agent` | Name of the service |
| `package_name` | `codedeploy-agent` | Name of the package |

## Limitations

Supported operating systems:

* Ubuntu 24.04, 26.04
* Debian 12, 13
* Red Hat / Amazon Linux 8, 9, 10

Requires Puppet 8.

### Ruby Compatibility

The `codedeploy-agent` `.deb` package declares dependencies on Ruby <= 3.2.
However, analysis of the agent's Ruby source code confirms it is fully
compatible with Ruby 3.3 (shipped with Ubuntu 26.04). This module uses
`dpkg --force-depends` to bypass the packaging constraint on all
Debian/Ubuntu versions.

Install the AWS CodeDeploy agent and ensure the agent is running
## Testing

include '::ruby'
include '::codedeploy'
```bash
make test
```

Runs the module in Docker containers for each supported platform and verifies the package installs successfully.
55 changes: 1 addition & 54 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet/version'
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'voxpupuli/test/rake'

# These gems aren't always present, for instance
# on Travis with --without development
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError
end

Rake::Task[:lint].clear

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')

exclude_paths = [
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc "Populate CONTRIBUTORS file"
task :contributors do
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
end

task :metadata do
sh "metadata-json-lint metadata.json"
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
:metadata,
]
29 changes: 29 additions & 0 deletions files/patch_codedeploy_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
# Repack codedeploy-agent .deb to add ruby3.3 as a dependency alternative.
# Idempotent: exits 0 if ruby3.3 is already present in the control file.
set -e

DEB="/tmp/codedeploy-agent.deb"
PATCHED="/tmp/codedeploy-agent-patched.deb"
WORKDIR="/tmp/codedeploy-repack"

# Check if already patched
if [ -f "$PATCHED" ]; then
if dpkg-deb -I "$PATCHED" | grep -q "ruby3.3"; then
exit 0
fi
fi

# Check if upstream already includes ruby3.3
if dpkg-deb -I "$DEB" | grep -q "ruby3.3"; then
cp "$DEB" "$PATCHED"
exit 0
fi

# Repack with ruby3.3 added
rm -rf "$WORKDIR"
mkdir -p "$WORKDIR"
dpkg-deb -R "$DEB" "$WORKDIR"
sed -i 's/ruby3\.2/ruby3.2 | ruby3.3/' "$WORKDIR/DEBIAN/control"
dpkg-deb -b "$WORKDIR" "$PATCHED"
rm -rf "$WORKDIR"
Loading