Skip to content

Commit c082f97

Browse files
committed
Fixing aws-session-manager-plugin.
1 parent b4d7f21 commit c082f97

File tree

5 files changed

+209
-20
lines changed

5 files changed

+209
-20
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
# This workflow uses actions that are not certified by GitHub. They are provided
3+
# by a third-party and are governed by separate terms of service, privacy
4+
# policy, and support documentation.
5+
6+
name: "🎯 Step: Build and cache (prebuilt)"
7+
on:
8+
workflow_call:
9+
inputs:
10+
package-name:
11+
required: true
12+
type: string
13+
package-version:
14+
required: true
15+
type: string
16+
clone-repository:
17+
required: true
18+
type: string
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}-build-and-cache-prebuilt
22+
cancel-in-progress: true
23+
24+
# Variables available to all jobs defined in this file
25+
env:
26+
DOCKER_BUILDKIT: 1
27+
REGISTRY: ${{ vars.REGISTRY }}
28+
29+
# Declare default permissions as read only.
30+
permissions: read-all
31+
32+
jobs:
33+
generate:
34+
runs-on: ubuntu-latest
35+
name: "📦 Build and cache (prebuilt)"
36+
strategy:
37+
fail-fast: false
38+
39+
container:
40+
image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest
41+
credentials:
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
options: --privileged
45+
46+
steps:
47+
- name: Git clone
48+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
49+
with:
50+
ref: ${{ github.base_ref }}
51+
52+
- name: "📦 Build the package"
53+
working-directory: packages/${{ inputs.package-name }}
54+
env:
55+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
56+
PKG_VER: "${{ inputs.package-version }}"
57+
PKG_NAME: "${{ inputs.package-name }}"
58+
run: |
59+
# We're pulling already-built packages.
60+
mkdir -p packages/${{ inputs.package-name }}/dist
61+
bash ./download.sh
62+
63+
- name: Cache the packages
64+
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
65+
id: cache-packages
66+
with:
67+
key: "${{ inputs.package-name }}-${{ inputs.package-version }}"
68+
path: packages/${{ inputs.package-name }}/dist
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
# This workflow uses actions that are not certified by GitHub. They are provided
3+
# by a third-party and are governed by separate terms of service, privacy
4+
# policy, and support documentation.
5+
6+
################################################################################
7+
# DO NOT EDIT THIS FILE!
8+
#
9+
# 1. Edit the *.gotmpl.yml files instead.
10+
# 2. go run generate-workflow.go -t _download-and-package.gotmpl.yml -p amazon-ssm-agent -r 'aws/amazon-ssm-agent' -c '30 0 * * *'
11+
################################################################################
12+
13+
name: "📦 Build amazon-ssm-agent"
14+
on:
15+
workflow_dispatch:
16+
push:
17+
branches: [main]
18+
paths:
19+
- ".github/workflows/build-amazon-ssm-agent.yml"
20+
- "packages/amazon-ssm-agent/**"
21+
pull_request:
22+
branches: [main]
23+
paths:
24+
- ".github/workflows/build-amazon-ssm-agent.yml"
25+
- "packages/amazon-ssm-agent/**"
26+
schedule:
27+
- cron: "30 0 * * *"
28+
29+
defaults:
30+
run:
31+
shell: bash
32+
33+
env:
34+
DOCKER_BUILDKIT: 1
35+
REGISTRY: ${{ vars.REGISTRY }}
36+
37+
permissions: read-all
38+
39+
jobs:
40+
lookup:
41+
runs-on: ubuntu-latest
42+
name: Lookup current version
43+
permissions:
44+
packages: write
45+
contents: read
46+
strategy:
47+
fail-fast: false
48+
49+
container:
50+
image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest
51+
credentials:
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
outputs:
56+
cache_hit: ${{ steps.check.outputs.cache-hit }}
57+
package_version: ${{ steps.lookup_version.outputs.package_version }}
58+
59+
steps:
60+
- name: Lookup latest version of package
61+
id: lookup_version
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
echo "package_version=$(download-asset latest-tag -r 'aws/amazon-ssm-agent' -s)" >> $GITHUB_OUTPUT
66+
67+
- name: Check to see if we've already built this version
68+
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
69+
id: check
70+
with:
71+
key: "amazon-ssm-agent-${{ steps.lookup_version.outputs.package_version }}"
72+
path: "packages/amazon-ssm-agent/dist"
73+
lookup-only: true
74+
75+
build:
76+
if: needs.lookup.outputs.cache_hit != 'true'
77+
needs: lookup
78+
name: "📦 Build and cache"
79+
uses: northwood-labs/package-building/.github/workflows/_build-and-cache-prebuilt.yml@main
80+
secrets: inherit
81+
with:
82+
package-name: "amazon-ssm-agent"
83+
package-version: ${{ needs.lookup.outputs.package_version }}
84+
clone-repository: https://github.com/aws/amazon-ssm-agent
85+
86+
upload:
87+
if: needs.lookup.outputs.cache_hit != 'true'
88+
needs: build
89+
name: Upload to S3
90+
uses: northwood-labs/package-building/.github/workflows/upload-to-s3.yml@main
91+
secrets: inherit
92+
with:
93+
package-name: "amazon-ssm-agent"
94+
package-version: ${{ needs.lookup.outputs.package_version }}
95+
96+
metadata_rpm:
97+
if: needs.lookup.outputs.cache_hit != 'true'
98+
needs: upload
99+
name: RPM metadata
100+
uses: northwood-labs/package-building/.github/workflows/generate-rpm-meta.yml@main
101+
secrets: inherit
102+
103+
metadata_deb:
104+
if: needs.lookup.outputs.cache_hit != 'true'
105+
needs: upload
106+
name: DEB metadata
107+
uses: northwood-labs/package-building/.github/workflows/generate-deb-meta.yml@main
108+
secrets: inherit
109+
110+
metadata_apk:
111+
if: needs.lookup.outputs.cache_hit != 'true'
112+
needs: upload
113+
name: APK metadata
114+
uses: northwood-labs/package-building/.github/workflows/generate-apk-meta.yml@main
115+
secrets: inherit

packages/aws-session-manager-plugin/.goreleaser.yml renamed to packages/amazon-ssm-agent/.goreleaser.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# https://goreleaser.com/customization/project/
3-
project_name: aws-session-manager-plugin
3+
project_name: amazon-ssm-agent
44

55
variables:
6-
Vendor: aws-session-manager-plugin authors
7-
VendorHomepage: https://github.com/aws/session-manager-plugin
6+
Vendor: amazon-ssm-agent authors
7+
VendorHomepage: https://aws.amazon.com/systems-manager/
88
License: Apache-2.0
99
Description: |-
10-
This plugin helps you to use the AWS Command Line Interface (AWS CLI) to
11-
start and end sessions to your managed instances.
10+
An agent to enable remote management of your EC2 instances, on-premises
11+
servers, or virtual machines (VMs).
1212
1313
# https://goreleaser.com/customization/includes/
1414
includes:

packages/amazon-ssm-agent/download.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# linux/amd64 (Intel64)
5+
6+
# linux/arm64 (ARM64)
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
echo "================================================================================"
5-
echo "Clone repo: ${CLONE_REPO} @ ${PKG_VER} to /tmp/__BUILD__"
6-
echo "================================================================================"
7-
4+
# linux/amd64 (Intel64) RPM
85
# shellcheck disable=2154
9-
git clone "${CLONE_REPO}" --branch "${PKG_VER}.0" --single-branch /tmp/__BUILD__
10-
cd /tmp/__BUILD__
6+
wget "https://s3.amazonaws.com/session-manager-downloads/plugin/${PKG_VER}/linux_64bit/session-manager-plugin.rpm" \
7+
--output-document "${GITHUB_WORKSPACE}/packages/${PKG_NAME}/dist/${PKG_NAME}-${PKG_VER}-1.x86_64.rpm"
118

12-
go mod init session-manager-plugin
13-
go mod tidy
14-
go get github.com/twinj/uuid@990eabe
9+
# linux/arm64 (ARM64) RPM
10+
# shellcheck disable=2154
11+
wget "https://s3.amazonaws.com/session-manager-downloads/plugin/${PKG_VER}/linux_arm64/session-manager-plugin.rpm" \
12+
--output-document "${GITHUB_WORKSPACE}/packages/${PKG_NAME}/dist/${PKG_NAME}-${PKG_VER}-1.aarch64.rpm"
1513

16-
# linux/amd64 (Intel64)
17-
# https://github.com/aws/session-manager-plugin/blob/e12e3d7a44af6321f3c12d156df7f60b596f6628/makefile#L87-L88
18-
GOARCH=amd64 go build -mod=readonly -ldflags "-s -w" -o /usr/local/bin/session-manager-plugin_amd64 -v src/sessionmanagerplugin-main/main.go
14+
# linux/amd64 (Intel64) DEB
15+
# shellcheck disable=2154
16+
wget "https://s3.amazonaws.com/session-manager-downloads/plugin/${PKG_VER}/ubuntu_64bit/session-manager-plugin.deb" \
17+
--output-document "${GITHUB_WORKSPACE}/packages/${PKG_NAME}/dist/${PKG_NAME}_${PKG_VER}-1_amd64.deb"
1918

20-
# linux/arm64 (ARM64)
21-
# https://github.com/aws/session-manager-plugin/blob/e12e3d7a44af6321f3c12d156df7f60b596f6628/makefile#L109-L110
22-
GOARCH=arm64 go build -mod=readonly -ldflags "-s -w -extldflags=-Wl,-z,now,-z,relro,-z,defs" -o /usr/local/bin/session-manager-plugin_arm64 -v src/sessionmanagerplugin-main/main.go
19+
# linux/arm64 (ARM64) DEB
20+
# shellcheck disable=2154
21+
wget "https://s3.amazonaws.com/session-manager-downloads/plugin/${PKG_VER}/ubuntu_arm64/session-manager-plugin.deb" \
22+
--output-document "${GITHUB_WORKSPACE}/packages/${PKG_NAME}/dist/${PKG_NAME}_${PKG_VER}-1_arm64.deb"

0 commit comments

Comments
 (0)