-
Notifications
You must be signed in to change notification settings - Fork 147
150 lines (129 loc) · 7.99 KB
/
update_components.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Update rover components
on:
schedule:
- cron: '0 18 * * 0' # 6:00 PM UTC every Sunday (2:00 AM Singapore Time)
workflow_dispatch:
jobs:
update-rover-components:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Get Latest Docker Compose
id: get-latest-docker-compose-version
run: |
version=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionDockerCompose=$version" >> $GITHUB_OUTPUT
- name: Get Latest Golang Version
id: get-latest-golang-version
run: |
version=$(curl -sSL https://golang.org/VERSION?m=text | grep go | cut -c 3-)
echo "versionGolang=$version" >> $GITHUB_OUTPUT
- name: Get Latest Kubectl Version
id: get-latest-versionKubectl-version
run: |
version=$(curl -sL https://storage.googleapis.com/kubernetes-release/release/stable.txt | cut -c 2-)
echo "versionKubectl=$version" >> $GITHUB_OUTPUT
- name: Get Latest Kubelogin Version
id: get-latest-kubelogin-version
run: |
version=$(curl -s https://api.github.com/repos/Azure/kubelogin/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionKubelogin=$version" >> $GITHUB_OUTPUT
- name: Get Latest Packer Version
id: get-latest-packer-version
run: |
version=$(curl -sL https://api.github.com/repos/hashicorp/packer/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionPacker=$version" >> $GITHUB_OUTPUT
- name: Get Latest PowerShell Version
id: get-latest-powershell-version
run: |
version=$(curl -sL https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionPowershell=$version" >> $GITHUB_OUTPUT
- name: Get Latest Ansible Version
id: get-latest-ansible-version
run: |
version=$(curl --silent "https://api.github.com/repos/ansible/ansible/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
echo "versionAnsible=$version" >> $GITHUB_OUTPUT
- name: Get Latest Vault Version
id: get-latest-vault-version
run: |
version=$(curl -s https://api.github.com/repos/hashicorp/vault/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionVault=$version" >> $GITHUB_OUTPUT
- name: Get Latest Terrascan Version
id: get-latest-terrascan-version
run: |
version=$(curl -s https://api.github.com/repos/tenable/terrascan/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionTerrascan=$version" >> $GITHUB_OUTPUT
- name: Get Latest Azure DevOps Agent Version
id: get-latest-azdo-version
run: |
version=$(curl -s "https://api.github.com/repos/microsoft/azure-pipelines-agent/releases/latest" | jq -r '.tag_name' | sed 's/^v//')
echo "versionAzdo=$version" >> $GITHUB_OUTPUT
- name: Get Latest GitHub Runner Version
id: get-latest-github-runner-version
run: |
version=$(curl -sL https://api.github.com/repos/actions/runner/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionGithubRunner=$version" >> $GITHUB_OUTPUT
- name: Get Latest Gitlab Runner Version
id: get-latest-gitlab-runner-version
run: |
version=$(curl -s "https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases" | jq -r '.[].tag_name | select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$";""))' | sort -rV | head -n1 | sed 's/^v//')
echo "versionGitlab=$version" >> $GITHUB_OUTPUT
- name: Get Latest tfupdate Version
id: get-latest-tfupdate-version
run: |
version=$(curl -s https://api.github.com/repos/minamijoyo/tfupdate/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionTfupdate=$version" >> $GITHUB_OUTPUT
- name: Get Latest Terraform Cloud Agent Version
id: get-latest-tfc-agent-version
run: |
version=$(curl -s https://api.github.com/repos/hashicorp/terraform-docs-agents/releases/latest | jq -r '.tag_name' | cut -c 2-)
echo "versionTfc=$version" >> $GITHUB_OUTPUT
- name: Update latest Terraform Versions
id: get-latest-terraform-versions
run: |
versionsTerraform=$(curl -s https://api.github.com/repos/hashicorp/terraform/releases | jq -r '.[] | select(.draft == false) | .tag_name' | sort -rV | awk -F. '!a[$1"."$2]++{print substr($0,2)}')
echo "${versionsTerraform}" > .env.terraform
sed -i '$a\' .env.terraform
- name: Update other components
run: |
versionDockerCompose=${{ steps.get-latest-docker-compose-version.outputs.versionDockerCompose }}
versionGolang=${{ steps.get-latest-golang-version.outputs.versionGolang }}
versionKubectl=${{ steps.get-latest-kubectl-version.outputs.versionKubectl }}
versionKubelogin=${{ steps.get-latest-kubelogin-version.outputs.versionKubelogin }}
versionPacker=${{ steps.get-latest-packer-version.outputs.versionPacker }}
versionPowershell=${{ steps.get-latest-powershell-version.outputs.versionPowershell }}
versionVault=${{ steps.get-latest-vault-version.outputs.versionVault }}
versionAnsible=${{ steps.get-latest-ansible-version.outputs.versionAnsible }}
versionTerrascan=${{ steps.get-latest-terrascan-version.outputs.versionTerrascan }}
versionTfupdate=${{ steps.get-latest-tfupdate-version.outputs.versionTfupdate }}
versionAzdo=${{ steps.get-latest-azdo-version.outputs.versionAzdo }}
versionGithubRunner=${{ steps.get-latest-github-runner-version.outputs.versionGithubRunner }}
versionTfc=${{ steps.get-latest-tfc-agent-version.outputs.versionTfc }}
versionGitlab=${{ steps.get-latest-gitlab-runner-version.outputs.versionGitlab }}
sed -i "s/versionDockerCompose=\"[^\"]*\"/versionDockerCompose=\"$versionDockerCompose\"/g" docker-bake.override.hcl
sed -i "s/versionGolang=\"[^\"]*\"/versionGolang=\"$versionGolang\"/g" docker-bake.override.hcl
sed -i "s/versionKubectl=\"[^\"]*\"/versionKubectl=\"$versionKubectl\"/g" docker-bake.override.hcl
sed -i "s/versionKubelogin=\"[^\"]*\"/versionKubelogin=\"$versionKubelogin\"/g" docker-bake.override.hcl
sed -i "s/versionPacker=\"[^\"]*\"/versionPacker=\"$versionPacker\"/g" docker-bake.override.hcl
sed -i "s/versionPowershell=\"[^\"]*\"/versionPowershell=\"$versionPowershell\"/g" docker-bake.override.hcl
sed -i "s/versionVault=\"[^\"]*\"/versionVault=\"$versionVault\"/g" docker-bake.override.hcl
sed -i "s/versionAnsible=\"[^\"]*\"/versionAnsible=\"$versionAnsible\"/g" docker-bake.override.hcl
sed -i "s/versionAzdo=\"[^\"]*\"/versionAzdo=\"$versionAzdo\"/g" docker-bake.override.hcl
sed -i "s/versionGithubRunner=\"[^\"]*\"/versionGithubRunner=\"$versionGithubRunner\"/g" docker-bake.override.hcl
sed -i "s/versionTfc=\"[^\"]*\"/versionTfc=\"$versionTfc\"/g" docker-bake.override.hcl
sed -i "s/versionGitlab=\"[^\"]*\"/versionGitlab=\"$versionGitlab\"/g" docker-bake.override.hcl
sed -i "s/versionTerrascan=\"[^\"]*\"/versionTerrascan=\"$versionTerrascan\"/g" docker-bake.override.hcl
sed -i "s/versionTfupdate=\"[^\"]*\"/versionTfupdate=\"$versionTfupdate\"/g" docker-bake.override.hcl
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update components versions
branch: components-update
title: Update rover components
body: This pull request updates the ```docker-bake.override.hcl``` and ```.env.terraform``` with latest available versions.