forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (115 loc) · 5.49 KB
/
deploy-manual.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: deploy-manual
on:
workflow_dispatch:
inputs:
ansible_operator_base_tag:
description: ansible-operator-base image tag, ex. "6e1b47e6ca7c507b8ecf197a8edcd412dd64d85d"
required: false
ansible_operator_base_tag_211:
description: ansible-operator-2.11-preview-base image tag, ex. "6e1b47e6ca7c507b8ecf197a8edcd412dd64d85d"
required: false
jobs:
# Build the ansible-operator-base image.
ansible-operator-base:
runs-on: ubuntu-22.04
environment: deploy
steps:
- name: set up qemu
uses: docker/setup-qemu-action@v2
- name: set up buildx
uses: docker/setup-buildx-action@v2
- name: quay.io login
uses: docker/login-action@v2
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
# Copied this for 2.11 rather than use a matrix because eventually 2.11 will be default and this will be removed.
- name: create 2.9-base tag
id: base_tag_29
run: |
set -e
IMG=quay.io/${{ github.repository_owner }}/ansible-operator-base
TAG="${{ github.event.inputs.ansible_operator_base_tag }}"
GIT_COMMIT=$(git rev-parse HEAD)
if [[ "$TAG" == "" ]]; then
TAG="$(git branch --show-current)-${GIT_COMMIT}"
fi
echo "tag=${IMG}:${TAG}" >> $GITHUB_OUTPUT
echo "git_commit=${GIT_COMMIT}" >> $GITHUB_OUTPUT
- name: create 2.11-base tag
id: base_tag_211
run: |
set -e
IMG=quay.io/${{ github.repository_owner }}/ansible-operator-2.11-preview-base
TAG="${{ github.event.inputs.ansible_operator_base_tag_211 }}"
GIT_COMMIT=$(git rev-parse HEAD)
if [[ "$TAG" == "" ]]; then
TAG="$(git branch --show-current)-${GIT_COMMIT}"
fi
echo "tag=${IMG}:${TAG}" >> $GITHUB_OUTPUT
echo "git_commit=${GIT_COMMIT}" >> $GITHUB_OUTPUT
- name: build and push ansible 2.9 dep image
uses: docker/build-push-action@v3
with:
file: ./images/ansible-operator/base.Dockerfile
context: ./images/ansible-operator
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: ${{ steps.base_tag_29.outputs.tag }}
build-args: |
GIT_COMMIT=${{ steps.base_tag_29.outputs.git_commit }}
- name: build and push ansible 2.11 dep image
uses: docker/build-push-action@v3
with:
file: ./images/ansible-operator-2.11-preview/base.Dockerfile
context: ./images/ansible-operator-2.11-preview
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: ${{ steps.base_tag_211.outputs.tag }}
build-args: |
GIT_COMMIT=${{ steps.base_tag_211.outputs.git_commit }}
# This change will be staged and committed in the PR pushed below.
# The script below will fail if no change was made.
- name: update base of ansible-operator 2.9
id: update_29
run: |
set -ex
sed -i -E 's|FROM quay\.io/operator-framework/ansible-operator-base:.+|FROM ${{ steps.base_tag_29.outputs.tag }}|g' images/ansible-operator/Dockerfile
git diff --exit-code --quiet && echo "Failed to update images/ansible-operator/Dockerfile" && exit 1
REF="${{ github.event.ref }}"
echo "branch_name=${REF##*/}" >> $GITHUB_OUTPUT
- name: create PR for ansible-operator 2.9 Dockerfile
uses: peter-evans/create-pull-request@v3
with:
title: "[${{ steps.update_29.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag_29.outputs.tag }}"
commit-message: |
[${{ steps.update_29.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag_29.outputs.tag }}
Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: "New ansible-operator-base image built by https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
delete-branch: true
branch-suffix: short-commit-hash
# This change will be staged and committed in the PR pushed below.
# The script below will fail if no change was made.
- name: update base of ansible-operator-2.11-preview
id: update_211
run: |
set -ex
sed -i -E 's|FROM quay\.io/operator-framework/ansible-operator-2.11-preview-base:.+|FROM ${{ steps.base_tag_211.outputs.tag }}|g' images/ansible-operator-2.11-preview/Dockerfile
git diff --exit-code --quiet && echo "Failed to update images/ansible-operator-11-preview-base/Dockerfile" && exit 1
REF="${{ github.event.ref }}"
echo "branch_name=${REF##*/}" >> $GITHUB_OUTPUT
- name: create PR for ansible-operator-2.11-preview Dockerfile
uses: peter-evans/create-pull-request@v3
with:
title: "[${{ steps.update_211.outputs.branch_name }}] image(ansible-operator-2.11-preview): bump base to ${{ steps.base_tag_211.outputs.tag }}"
commit-message: |
[${{ steps.update_211.outputs.branch_name }}] image(ansible-operator-2.11-preview): bump base to ${{ steps.base_tag_211.outputs.tag }}
Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: "New ansible-operator-2.11-preview-base image built by https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
delete-branch: true
branch-suffix: short-commit-hash