Blog

  • Trudeau’s Resignation: India-Canada Relations and Political Fallout – Study Notes

    Trudeau’s Resignation: India-Canada Relations and Political Fallout – Study Notes

    The text speculates on Canadian Prime Minister Justin Trudeau’s resignation, focusing on strained relations with India stemming from Canada’s handling of Sikh separatist issues. It highlights accusations of Canadian support for Sikh extremism, leading to diplomatic tensions and potential retaliatory actions from India. The piece also mentions Trudeau’s past political successes and challenges, including coalition governments and a difficult relationship with former US President Trump. The author suggests that these factors, along with pressure from within his own party, may have contributed to Trudeau’s decision to step down. Finally, the article contrasts Canada-India relations unfavorably with the Canada-US relationship, offering a hypothetical scenario where Canada becomes a US state to resolve conflict.

    The Trudeau Resignation Study Guide

    Quiz

    1. What is Justin Trudeau’s family connection to Canadian politics, and how does it affect his legacy?
    2. Describe Trudeau’s initial electoral success in 2015 and how his party’s performance changed in subsequent elections.
    3. What specific issue led to a major deterioration in relations between Canada and India under Justin Trudeau’s leadership?
    4. What specific incident in June of 2023 fueled the conflict between Canada and India?
    5. What is Khalistan Tehreek, and how does it contribute to the political tension between India and Canada?
    6. How have Western intelligence reports played a role in Canada’s investigation into the killing of Hardeep Singh Najjar?
    7. What is the significance of the Washington Post report regarding RAW and killings in Pakistan and elsewhere?
    8. What is the main demand put forth by India regarding their relationship with Canada and Justin Trudeau?
    9. How did Donald Trump’s comments and actions during his presidency affect his relationship with Canada and Trudeau?
    10. How does the author use the historical example of Pakistan’s founder Muhammad Ali Jinnah, to comment on the current state of Canada-India relations?

    Quiz Answer Key

    1. Justin Trudeau is the son of former Prime Minister Pierre Trudeau, giving him a political legacy that both elevates and burdens him by way of his family’s political tradition. He is only the second Canadian politician to follow in his father’s footsteps.
    2. Trudeau’s Liberal Party achieved a major victory in the 2015 elections, but failed to achieve the same level of success in 2019 and 2021, which lead to a coalition with the New Democratic Party.
    3. The main issue leading to deteriorated relations between Canada and India was Canada’s perceived harboring of Sikh separatists, particularly those connected to the Khalistan movement, and the murder of Hardeep Singh Najjar.
    4. The killing of Sikh leader Hardeep Singh Najjar outside a Gurdwara in British Columbia in June 2023, and Trudeau’s subsequent accusations against India’s government, increased tension between the two countries.
    5. The Khalistan Tehreek is a Sikh separatist movement advocating for an independent Sikh state, which has caused conflict between India and Canada due to the perceived support for its members within Canada.
    6. Western intelligence reports, specifically from the United States and the United Kingdom, have been crucial in Canada’s investigation into the murder of Hardeep Singh Najjar and supported the accusations against India.
    7. The Washington Post reported that RAW, India’s intelligence agency, has been implicated in targeted killings of individuals in Pakistan and Afghanistan, adding complexity to the India-Canada tensions.
    8. India has effectively demanded that Justin Trudeau step down from the position of Prime Minister for relations to be restored.
    9. During his presidency, Donald Trump’s rhetoric and actions, like calling Trudeau “Governor” and threatening tariffs and annexation of Canada, strained relations with Canada, showing a lack of respect for his position.
    10. The author references Muhammad Ali Jinnah’s hope for Pakistan and India relations to be like Canada and America, to show the historic lack of success of such relationships and to note that a resolution to the problems between India and Canada may resolve other issues.

    Essay Questions

    1. Analyze the various factors that contributed to the deterioration of relations between Canada and India under Justin Trudeau’s leadership. Consider both domestic and international political factors.
    2. Compare and contrast the roles of domestic and international influences on Justin Trudeau’s political career, including both his rise to power and recent challenges.
    3. Evaluate the significance of the Khalistan movement in shaping the dynamics between India and Canada. How has the past influenced current political tensions and challenges?
    4. Explore the implications of the reported intelligence suggesting foreign involvement in the killings of Sikh figures in both Canada and abroad. How might this situation impact diplomatic relations and international norms?
    5. Discuss the author’s use of historical examples, such as the relationship between Pakistan and India, and the role of Muhammad Ali Jinnah, to make sense of the current situation involving Justin Trudeau.

    Glossary of Key Terms

    • Khalistan Tehreek: A Sikh separatist movement advocating for the creation of an independent Sikh state, primarily located within the Punjab region of India.
    • RAW: India’s primary foreign intelligence agency, the Research and Analysis Wing. It is accused of being involved in targeted killings in Pakistan.
    • Coalition Government: A government formed when no single party achieves a majority in an election, requiring multiple parties to work together to govern.
    • G20 Conference: An international forum bringing together the world’s major developed and developing economies to discuss financial and socioeconomic issues.
    • Sikhs for Justice: An organization advocating for an independent Sikh state and is the target of actions for allegedly encouraging separatist movements.
    • Sovereignty: The supreme authority within a territory; the right of a country to govern itself and its citizens without outside interference.
    • Gurdwara: A Sikh place of worship and community gathering.
    • Tariffs: Taxes or duties imposed on imported or exported goods.
    • Freedom of expression: The right to share opinions and ideas, a core tenet of liberal democracy.
    • Prime Minister: The head of the cabinet and the leader of the executive branch of a government, usually in a parliamentary or semi-presidential system.

    Trudeau, India, and Canada’s Perilous Path

    Okay, here’s a briefing document summarizing the key themes and ideas from the provided text, focusing on the situation surrounding Justin Trudeau’s political standing and Canada’s international relations.

    Briefing Document: Analysis of Political Pressures on Justin Trudeau

    Date: October 26, 2023 (Based on context)

    Subject: Analysis of Political Turmoil surrounding Justin Trudeau and Canada’s International Relations

    Sources: Excerpts from provided “Pasted Text”

    Executive Summary:

    This document analyzes the political pressures faced by Canadian Prime Minister Justin Trudeau, as described in the provided text. The text suggests that Trudeau’s political difficulties are a result of strained international relations, particularly with India, coupled with internal dissent within his own party. The document also touches upon the influence of the United States and historical parallels. The core issues involve accusations of harboring terrorists and a perceived lack of resolve on Canada’s part in dealing with the Khalistan movement, which has soured relations with India.

    Key Themes and Ideas:

    1. Strained Relations with India:
    • Khalistan Movement: The text highlights the central role of the Khalistan movement in escalating tensions between India and Canada. The presence of Sikh communities in Canada, some of whom are associated with the Khalistan movement, is presented as a major source of conflict. The article states “In Canada, since the Sikh community is inhabited in a special number, including there is no shortage of people affiliated with Khalistan Tehreek, whose roots are in Indian Punjab. Or not, in Canada, they propagate their separatistism very well.”
    • Allegations of Harboring Terrorists: India accuses Canada of harboring individuals involved in terrorist activities, linked to the Khalistan movement, and harboring anti-India elements. “Indian officials warned him. Ignoring it was making you realize that you refrain from providing shelter to our terrorists while Justin Trudeau made it his responsibility to protect them as Canadian citizens by linking it to freedom of expression and human rights.”
    • Assassination of Hardeep Singh Najjar: The killing of Sikh leader Hardeep Singh Najjar in British Columbia is a pivotal event, with Justin Trudeau accusing the Indian government of involvement. This accusation has severely damaged relations between the two countries, “Justin Trudeau stood inside the parliament and supported Modi government. Meet the Indian ambassador and agent accused. This led to a lot of problems in India-Canada relations.”
    • Cold Reception at G20: The author notes the strained interaction between Trudeau and Modi at the G20 summit in Delhi, with India allegedly taking a “cold-hearted attitude” towards Trudeau.
    1. Internal Dissent and Instability within the Liberal Party:
    • Speculation about Resignations: The text questions whether recent difficulties and apparent resignations within the Liberal party leadership, including the Deputy Prime Minister and Finance Minister, are linked to the issues surrounding India. This highlights potential divisions and a lack of unity within Trudeau’s own party. “Why are there such contradictory voices from within their Liberal Party that their own Deputy Prime Minister and Finance Minister Christia Freeland also resigned?”
    • “Cursed by Modi”: The author suggests, rather speculatively, that Trudeau’s political woes are so serious that he might be seen as “cursed by Modi,” suggesting a belief that the conflict with India is the root of many of Trudeau’s problems.
    1. US Influence and Trump’s Approach:
    • Disrespectful Interaction: The text highlights former US President Donald Trump’s disrespectful treatment of Trudeau, referring to him as a “governor” instead of Prime Minister and suggesting Canada should become the 51st state. “Trump instead of calling him Prime Minister, Governor. Addressed after saying why should we give illegal facilities to Canada?”
    • Economic Threat: Trump’s threat of implementing a 25% tariff due to economic losses is another element of external pressure, emphasizing the US’s influence over Canada.
    1. Historical Parallels and Perspective:
    • Indira Gandhi and Khalistan: The text references Indira Gandhi’s suppression of the Khalistan movement in India in the 1980s, and the subsequent violence against an Air India flight. This underscores the historical depth of the tensions and the seriousness of the security concerns. The author notes “Shrimati Indra Gandhi crushed Khalistani Movement to a great extent from Punjab in 1984, due to which she herself sacrificed her life…Sikhs blew up an Air India plane carrying 329 passengers from Montreal to Mumbai via a time bomb on 23 June 1985 in the airspace of Ireland.”
    • Jinnah’s Vision: The text alludes to Muhammad Ali Jinnah’s hope for India-Pakistan relations mirroring Canada-US ties, which failed to materialize. This highlights an aspiration for peaceful and productive international relations, in stark contrast with the current geopolitical complexities.
    1. Accusations Against India (RAW):
    • The Washington Post report is cited which accuses India’s spy agency, RAW, of carrying out targeted assassinations in Pakistan and elsewhere, with specific mentions of “mercenary killers and Afghans.” The report suggests “Indian media offers an example of Israel against general terrorism” implying a comparison with Israel’s tactics against terrorists. The author questions why, if these countries have evidence of such state-sponsored violence, the information has not been shared with its allies.

    Analysis:

    The text presents a picture of a Prime Minister facing immense political pressure from both internal and external sources. His foreign policy decisions, particularly regarding India and the Khalistan issue, have been the focal point of criticism and controversy. The text further emphasizes that the current political climate has led to the deterioration of relationships with key nations, in addition to internal strife in Trudeau’s government.

    Conclusion:

    The excerpt illustrates a complex situation where Trudeau’s government is facing significant challenges due to international disputes, accusations of harboring terrorism, and potential internal dissent. The provided document implies that resolution to these issues will require diplomatic dexterity and a clear shift in approaches to international relations. The document raises concern over the stability of Trudeau’s leadership position and indicates significant obstacles to overcome.

    Trudeau, Modi, and the Crisis in Canada-India Relations

    Frequently Asked Questions:

    1. Why has Justin Trudeau’s leadership faced significant challenges recently, as suggested by the text?
    2. The text implies that Justin Trudeau’s leadership has been significantly challenged due to a deterioration in relations with India, primarily stemming from Canada’s perceived support of Sikh separatists, including those affiliated with the Khalistan movement. This has led to accusations from India of harboring terrorists. Further, the text suggests internal discord within his own Liberal party and strained relations with the US under President Trump have contributed to his difficulties.
    3. What role has the Khalistan movement played in the strained relations between Canada and India?
    4. The Khalistan movement, which advocates for a separate Sikh state, has become a major point of contention between Canada and India. The text suggests that Canada is perceived to be harboring Khalistani activists, which India views as a security threat. The assassination of Sikh leader Hardeep Singh Nijjar in Canada, and the subsequent accusations against the Indian government, have exacerbated these tensions. The 1985 Air India bombing, linked to Khalistani groups, also casts a long shadow on this issue.
    5. How has India’s Prime Minister Narendra Modi responded to Canada’s stance on Sikh separatism?
    6. According to the text, Narendra Modi’s government has adopted a cold and stern attitude towards Justin Trudeau. There are suggestions of a deliberate snub during Trudeau’s visit to India for the G20 summit, including warnings about harboring terrorists and Indian officials avoiding engagement with him. The text implies that India might view Trudeau’s departure as a prerequisite for restoring amicable relations.
    7. What international incidents have fueled the tensions between India and Canada?
    8. The assassination of Hardeep Singh Nijjar in Canada, an individual considered by India to be a terrorist, is a key incident. There have also been allegations of Indian government involvement in attacks on Sikh leaders in other countries, including the US and UK. This has led to diplomatic pressure on India from several countries, including the US.
    9. What are the alleged actions by India’s RAW (Research and Analysis Wing) described in the text?

    The text mentions a report from The Washington Post suggesting that RAW has been involved in the targeted killing of mercenaries and Afghans in Pakistan. Additionally, it mentions alleged attacks in other countries on figures deemed as threats by India. These actions are presented in the context of India acting like Israel, targeting their enemies abroad.

    1. What is the significance of US President Donald Trump’s attitude towards Justin Trudeau, according to the source?

    The text indicates that Donald Trump treated Trudeau with disrespect, allegedly referring to him as a “governor” instead of a “prime minister.” Further, Trump reportedly suggested the U.S. might impose trade tariffs unless Canada became a U.S. state, showcasing a strained and potentially hostile relationship.

    1. How are internal divisions within Trudeau’s Liberal Party portrayed in the text?
    2. The text implies that there are significant divisions within Trudeau’s Liberal Party, symbolized by the alleged resignations of Deputy Prime Minister and Finance Minister Chrystia Freeland. These events suggest internal instability and a lack of confidence in Trudeau’s leadership.
    3. What comparison does the text make between Pakistan-India relations and Canada-US relations, and what is its conclusion?
    4. The text recalls Muhammad Ali Jinnah’s aspiration for Pakistan-India relations to mirror Canada-US ties. However, it concludes that despite decades, this hasn’t materialized. The author suggests that if Pakistan and India had relations similar to those of Canada and the US, their current issues would be resolved, which implies that strained India-Canada relations are a point of tension and comparison.

    Trudeau, Modi, and the Sikh Crisis

    Okay, here is a detailed timeline and cast of characters based on the provided text:

    Timeline of Events

    • December 25, 1971: Justin Trudeau is born in Ottawa, Canada.
    • 1958: A typo, it states Justin Trudeau graduated from the University of British Columbia in 1958, this cannot be the correct year because it predates his birth. The text implies Justin Trudeau received an Education degree from the University of British Columbia, and spent some time teaching.
    • 2013: Justin Trudeau is elected leader of the Liberal Party of Canada.
    • 2015: Justin Trudeau leads the Liberal Party to victory, becoming the 23rd Prime Minister of Canada.
    • 2019 & 2021: Justin Trudeau’s Liberal Party does not achieve the same success as in 2015, and he forms a coalition with the New Democratic Party, led by Jagmeet Singh.
    • June 23, 1985: An Air India plane is blown up over Ireland by Khalistani Sikh terrorists, killing 329 people. This event is referenced as a historical event contributing to ongoing tensions.
    • 1984: Indira Gandhi takes action to suppress the Khalistani movement in Punjab and is killed as a consequence.
    • May 2023: Parmjeet Singh Panjwara is killed in Lahore, Pakistan.
    • June 2023: Hardeep Singh Nijjar, a Sikh leader, is killed outside a Gurdwara in British Columbia, Canada. This event exacerbates tensions between India and Canada.
    • 2023 (G20 Conference): Justin Trudeau attends the G20 summit in Delhi. His meeting with Narendra Modi is not amicable, and he experiences plane issues that keep him in India for an additional two days. Indian officials reportedly warned Trudeau to stop providing shelter to terrorists.
    • Post-June 2023: Justin Trudeau publicly accuses India of involvement in the Nijjar killing, which is supported by intelligence from the U.S. and UK. There are protests against the Nijjar killing in several major cities, including Toronto, London, Melbourne, and San Francisco.
    • Post-Nijjar Killing: The head of “Sikh for Justice” in America survives an attack. US President Joe Biden presents evidence of Indian involvement to Narendra Modi.
    • Unspecified Time: A report in the Washington Post alleges that RAW has killed mercenary killers and Afghans in Pakistan, with six people targeted, including a man named ‘copper of Kling.’
    • Unspecified time: Donald Trump, US President, referred to Canadian Prime Minister Justin Trudeau as a governor, offered to make Canada a US state, and threatened to impose tariffs on Canadian goods.
    • Recent: The text notes speculation about Trudeau’s resignation and the possibility of him being “cursed” by Modi, leading to issues within the Liberal Party and strained relationships with both the US and India.

    Cast of Characters

    • Justin Trudeau: The current Prime Minister of Canada. Son of former Prime Minister Pierre Trudeau. He is described as a two-time elected Prime Minister who initially had considerable success, but later encountered challenges. The text indicates his relationship with India has significantly deteriorated.
    • Pierre Trudeau: Justin Trudeau’s father. He served as the Prime Minister of Canada twice and led the Liberal Party five times.
    • Narendra Modi: The current Prime Minister of India. He is portrayed as having a strained relationship with Justin Trudeau, fueled by accusations of Indian involvement in the killing of Hardeep Singh Nijjar.
    • Jagmeet Singh: Leader of the New Democratic Party (NDP) in Canada, which has formed a coalition government with the Liberal Party.
    • Christia Freeland: The Deputy Prime Minister and Finance Minister of Canada, is mentioned as having resigned which may be associated with the pressures felt by the Prime Minister.
    • Indira Gandhi: Former Prime Minister of India, who took steps to suppress the Khalistani movement and was subsequently assassinated.
    • Rajiv Gandhi: Former Prime Minister of India who had an alliance with Ms. Benazir Bhutto, Prime Minister of Pakistan to deal with terrorism in India
    • Benazir Bhutto: Prime Minister of Pakistan who had an alliance with Rajiv Gandhi to deal with terrorism in India.
    • Hardeep Singh Nijjar: A Sikh leader who was killed in British Columbia in June 2023. His death is a major point of contention between Canada and India.
    • Parmjeet Singh Panjwara: Killed in Lahore, Pakistan in May 2023.
    • Avtar Singh Khanda: Was targeted in the UK.
    • Joe Biden: The President of the United States. Presented evidence to Narendra Modi relating to the killing of a Sikh leader from the organization “Sikhs for Justice”.
    • Donald Trump: Former President of the United States. Is noted to have treated Trudeau disrespectfully, having called him a governor rather than a Prime Minister.
    • Muhammad Ali Jinnah: Founder of Pakistan, whose quote is mentioned about the desired relationship between India and Pakistan.

    Notes:

    • The text appears to be biased toward the idea that India is targeting Sikh separatists, and that there is a negative impact on Trudeau’s political position.
    • There is speculation that Modi cursed Trudeau.
    • The text mentions events that are not well-dated and are presented as background information. For example, the Air India bombing from 1985.
    • The text includes some inconsistencies like the date of Justin Trudeau’s graduation from university.

    I hope this detailed timeline and cast of characters is helpful!

    Trudeau’s Political Vulnerability

    The sources discuss the circumstances surrounding the idea of Justin Trudeau’s resignation, though they do not explicitly state that he has resigned. Here’s a breakdown of the information provided:

    • Speculation about resignation: The sources suggest that Justin Trudeau’s position as Prime Minister is in jeopardy due to strained relations with India and the U.S. [1, 2]. The deterioration of relations between Trudeau and the Modi administration has led some to believe that the only way to restore relations is for Trudeau to step down [2].
    • Contradictory voices within the Liberal Party: The sources suggest internal conflict within the Liberal Party. The text specifically mentions that Trudeau’s Deputy Prime Minister and Finance Minister, Christia Freeland, also resigned [1].
    • Strained relations with India:The sources indicate that relations between Canada and India have been damaged [1].
    • The issue seems to stem from Canada’s stance on Sikh separatists and the Khalistan movement, which has roots in Indian Punjab [1].
    • Specifically, the assassination of Sikh leader Hardeep Singh Najjar in Canada and Trudeau’s subsequent accusations against the Indian government further escalated the conflict [1].
    • The sources mention that Trudeau’s visit to India for the G20 summit was not pleasant and that Indian officials have warned Canada against sheltering terrorists [1].
    • The Indian government’s perspective is that Canada is providing shelter to terrorists and that Trudeau is protecting them under the guise of freedom of expression and human rights [1].
    • Tensions with the United States:The sources also mention strained relations with the U.S. under the Trump administration [2].
    • President Trump, instead of referring to Trudeau as “Prime Minister,” called him “Governor” and questioned why the US should provide “illegal facilities to Canada” [2, 3].
    • Trump suggested imposing a 25% tariff and even proposed that Canada become the 51st state of the US to resolve these issues [3].
    • Internal Political Challenges: Trudeau’s Liberal Party has not achieved the same success it did in 2015, and in recent elections, he had to form a coalition with the New Democratic Party [1]. This is due to a split vote with the Conservative party.
    • Allegations of Indian Involvement in Killings: The sources discuss allegations of Indian involvement in the killings of Sikh leaders, including the killing of Hardeep Singh Najjar in Canada. They also mention similar incidents in other countries such as the UK and Pakistan [1]. There are also reports of India targeting “mercenary killers and Afghans” in Pakistan [1].

    It is important to note that the sources present a complex political situation. They suggest that Trudeau’s position has become vulnerable due to international relations and internal political conflicts. However, the sources do not state definitively that he has resigned but instead speculate about the possibility of him being forced to do so.

    India-Canada Relations: Crisis of Trust

    The sources detail a significant deterioration in India-Canada relations, primarily stemming from Canada’s stance on Sikh separatism and the Khalistan movement [1, 2]. Here’s a breakdown of the key points:

    • Root of the conflict: The core issue appears to be the presence of Sikh separatists and those affiliated with the Khalistan movement in Canada, which has roots in the Indian state of Punjab [1].
    • Canada’s position: Canada has been accused of providing shelter to these individuals, with Prime Minister Justin Trudeau defending them under the umbrella of freedom of expression and human rights [1].
    • Indian perspective: India views these individuals as terrorists and has warned Canada against harboring them [1].
    • Escalating tensions: The situation escalated after the killing of Sikh leader Hardeep Singh Najjar in British Columbia in June 2023. Trudeau publicly accused the Indian government of involvement, which further strained relations [1].
    • G20 Summit: The 2023 G20 summit in Delhi was marked by a cold attitude from Indian officials towards Trudeau, and he was seemingly ignored by Indian officials [1].
    • Allegations of Indian involvement: There are allegations that the Indian intelligence agency RAW has been involved in the killings of Sikh leaders not only in Canada, but also in Pakistan and the UK [1]. There are also allegations of RAW targeting “mercenary killers and Afghans” in Pakistan [1].
    • Impact on relations: The strained relationship has led to speculation that the only way to restore relations is for Justin Trudeau to step down as Prime Minister of Canada [2].
    • Historical context: The Khalistan movement is not new. It was largely suppressed in India in 1984, though it has continued to operate in Canada [1]. The bombing of an Air India plane in 1985 by Sikh separatists is also cited as a major incident in the history of this movement [1].
    • Comparison to US-Canada Relations: The sources also make a point of comparing the strained India-Canada relationship to the ideal relationship between the US and Canada, which was envisioned by Muhammad Ali Jinnah [3].

    In summary, the sources suggest that the India-Canada relationship has been severely damaged by Canada’s perceived support for Sikh separatists, and by allegations of India’s involvement in the killing of Sikh leaders on Canadian soil [1, 2].

    Khalistan Movement and India-Canada Relations

    The sources discuss the Khalistan movement primarily in the context of its impact on India-Canada relations [1, 2]. Here’s a breakdown of the key information:

    • Origins and goals: The Khalistan movement is a Sikh separatist movement with roots in the Indian state of Punjab [1]. The movement seeks to create an independent Sikh state called Khalistan [1].
    • Suppression in India: The movement was largely suppressed in India in 1984 by Indira Gandhi, who was assassinated as a result [1].
    • Presence in Canada: Despite being suppressed in India, the movement has continued to exist and operate in Canada [1]. The sources note that a significant number of people in the Canadian Sikh community are affiliated with the Khalistan movement [1].
    • Terrorist activities: The sources mention that Khalistani Sikhs were responsible for the 1985 bombing of an Air India flight, which killed 329 passengers [1].
    • Canada’s Stance: The Canadian government, under Prime Minister Justin Trudeau, has been criticized for allegedly providing shelter to members of the Khalistan movement [1]. Trudeau has defended these individuals by linking their presence in Canada to freedom of expression and human rights [1]. This stance is a major point of contention in the current India-Canada relationship [1, 2].
    • Tensions with India: India views the Khalistan movement as a terrorist threat and has warned Canada against harboring these individuals [1]. India’s perspective is that Canada is providing a safe haven for terrorists who are actively trying to destabilize India [1].
    • Impact on India-Canada relations: The Khalistan movement is a central cause of the deteriorated relations between India and Canada [1, 2]. The Indian government believes that Canada’s support for the Khalistan movement is unacceptable [1, 2]. The sources suggest that the strained relationship has led to speculation that the only way to restore relations is for Justin Trudeau to step down as Prime Minister of Canada [2].
    • Recent incidents: The assassination of Sikh leader Hardeep Singh Najjar in Canada is tied to the Khalistan movement and has further escalated tensions between India and Canada [1]. There are also allegations of Indian involvement in killings of other Khalistani leaders in the UK and Pakistan [1].

    In summary, the Khalistan movement is a separatist movement that has caused significant tension between India and Canada. Canada’s stance on the movement, and its perceived support for members of the Khalistan movement, is a primary cause of the deteriorating relations between the two countries [1, 2].

    Modi-Trudeau Conflict: Khalistan and India-Canada Relations

    The sources detail a significant conflict between Indian Prime Minister Narendra Modi and Canadian Prime Minister Justin Trudeau, primarily stemming from Canada’s stance on Sikh separatism and the Khalistan movement [1, 2]. Here’s a breakdown of the key aspects of this conflict:

    • Root of the Conflict: The core issue is the presence of Sikh separatists and those affiliated with the Khalistan movement in Canada [1]. This movement, which seeks to create an independent Sikh state, has roots in the Indian state of Punjab [1, 3].
    • Divergent Views on Sikh Separatists: Canada, under Trudeau, is seen as providing shelter to these individuals, defending them under the guise of freedom of expression and human rights [1]. India, under Modi, views these individuals as terrorists and has warned Canada against harboring them [1, 3].
    • Escalation of Tensions:The conflict escalated significantly after the killing of Sikh leader Hardeep Singh Najjar in British Columbia in June 2023 [1].
    • Trudeau publicly accused the Indian government of involvement in the assassination, further straining relations [1].
    • G20 Summit: The 2023 G20 summit in Delhi was marked by a cold attitude from Indian officials towards Trudeau [1]. The sources suggest he was seemingly ignored by Indian officials, and his plane experienced a malfunction forcing him to stay in India for two extra days [1].
    • Allegations of Indian Involvement in Killings: There are allegations that the Indian intelligence agency RAW has been involved in the killings of Sikh leaders not only in Canada, but also in Pakistan and the UK [1]. There are also allegations of RAW targeting “mercenary killers and Afghans” in Pakistan [1].
    • Impact on Relations: The sources suggest that the strained relationship has led to speculation that the only way to restore relations is for Justin Trudeau to step down as Prime Minister of Canada [2].
    • India’s Perspective: India views the Khalistan movement as a terrorist threat and believes Canada is providing a safe haven for those who are actively trying to destabilize India [1, 3].
    • Comparison to US-Canada Relations: The sources make a point of comparing the strained India-Canada relationship to the ideal relationship between the US and Canada, which was envisioned by Muhammad Ali Jinnah, suggesting the current state of relations between India and Canada is far from ideal [3].
    • Modi’s alleged curse: One source even suggests that Modi may have cursed Trudeau which is causing problems for Trudeau within his own party [2].
    • Trudeau’s Internal Political Challenges: The sources indicate that Trudeau’s Liberal Party has not achieved the same success it did in 2015, and in recent elections, he had to form a coalition with the New Democratic Party [1]. This is due to a split vote with the Conservative party.

    In summary, the Modi-Trudeau conflict is deeply rooted in differing views on the Khalistan movement and Canada’s perceived support for Sikh separatists. This has led to a severe deterioration in India-Canada relations, with accusations of Indian involvement in the killings of Sikh leaders and speculation about Trudeau’s political future.

    Trump and Trudeau: A Strained Relationship

    The sources indicate a strained relationship between the U.S. and Canada, particularly during the Trump administration [1, 2]. Here’s a breakdown of the key points:

    • Trump’s attitude towards Trudeau: Instead of referring to Justin Trudeau as “Prime Minister,” President Trump called him “Governor” [2]. This is indicative of a lack of respect and a strained relationship between the two leaders.
    • Questioning of “illegal facilities”: Trump questioned why the U.S. should provide “illegal facilities to Canada” [1]. This suggests that the U.S. under Trump did not view the relationship with Canada as mutually beneficial.
    • Threat of economic action: Trump threatened to impose a 25% tariff on Canada [1]. This was presented as a potential consequence if the issues between the two countries were not resolved to Trump’s satisfaction.
    • Proposal for Canada to become the 51st state: Trump proposed that Canada become the 51st state of the U.S. as a way to resolve the issues between the two countries [1]. This proposal reflects a dismissive and potentially hostile attitude towards Canada’s sovereignty.
    • Comparison to India-Canada relations: The source makes a comparison to the relations between India and Canada, noting that the relationship between Canada and America was supposed to be the model for relations between Pakistan and India, and that the current relations between India and Canada are not ideal [3].

    In summary, the sources suggest that during the Trump administration, the U.S.-Canada relationship was fraught with tension, characterized by a lack of respect from the U.S. president, threats of economic action, and even a proposal that Canada become part of the United States [1, 2]. The sources highlight that Trump’s approach was confrontational and did not treat Canada as an equal partner [1-3].

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Riyadh Newspaper, March 27, 2025: MBS Leadership, Vision 2030, Economic Development, Regional Issues

    Riyadh Newspaper, March 27, 2025: MBS Leadership, Vision 2030, Economic Development, Regional Issues

    These Saudi Arabian news articles from March 2025 cover a range of topics, with a significant focus on the Kingdom’s Vision 2030 and its progress in economic diversification and development, including investments in technology, renewable energy, and tourism. Several articles highlight Crown Prince Mohammed bin Salman’s leadership in driving these reforms and achieving national goals. Other pieces address regional issues, such as the condemnation of Israeli actions in Syria and Gaza, as well as domestic news concerning consumer protection, cultural initiatives, and local developments in cities like Riyadh and Medina.

    Saudi Arabia: Vision 2030 and Current Developments

    Study Guide

    I. Core Themes of Vision 2030:

    • Diversifying the Economy: Reducing reliance on oil revenues by developing new sectors like tourism, technology, and manufacturing.
    • A Vibrant Society: Enhancing the quality of life for citizens and residents through cultural enrichment, entertainment, and improved public services.
    • An Ambitious Nation: Strengthening Saudi Arabia’s global standing through economic leadership, strategic partnerships, and a commitment to international security and stability.
    • Investment Powerhouse: Transforming the Kingdom into a global investment hub, attracting both domestic and foreign capital.
    • National Security and Self-Sufficiency: Developing indigenous defense industries to enhance military capabilities and reduce dependence on foreign suppliers.

    II. Key Initiatives and Developments:

    • The National Investment Strategy (NIS): A comprehensive framework to boost investment across various sectors, aiming for 12.4 trillion SAR by 2030.
    • Developing Strategic Sectors: Significant investments in renewable energy (solar and wind), artificial intelligence, healthcare, biotechnology, and logistics.
    • Localization of Defense Industries: Actively working to manufacture military equipment and systems domestically, aiming for 50% localization by 2030.
    • Diplomatic Efforts: Playing a key role in de-escalating regional conflicts and promoting international peace and security, including hosting talks related to the Ukraine crisis.
    • Cultural Transformation: A significant push to develop and promote Saudi Arabia’s rich cultural heritage through the establishment of dedicated cultural authorities and initiatives.
    • Empowerment of Women: Implementing reforms to enhance women’s rights and increase their participation in the workforce.
    • Infrastructure Development: Investing heavily in transportation (roads, railways, airports, ports) and digital infrastructure to support economic growth and connectivity.

    III. Challenges and Considerations:

    • Technological Independence: Achieving full technological self-sufficiency in the defense sector requires sustained investment in research and development.
    • Global Competition: Enhancing Saudi Arabia’s competitive position in the global investment landscape requires continuous improvement of the business environment.
    • Economic Fluctuations: While diversification efforts are underway, the economy remains susceptible to global economic trends.
    • Regional Instability: Ongoing regional conflicts and tensions can pose challenges to stability and development.

    Quiz

    1. Describe two key goals of Saudi Arabia’s Vision 2030 initiative and explain why they are important for the Kingdom’s future.
    2. What is the National Investment Strategy (NIS)? Mention two of its primary objectives and the key sectors it aims to develop.
    3. Explain Saudi Arabia’s strategy for localizing its defense industries. What are the intended benefits of this localization effort?
    4. Describe Saudi Arabia’s recent diplomatic efforts in the context of international conflicts. Provide a specific example from the provided text.
    5. How has Saudi Arabia’s cultural landscape evolved under Vision 2030? Mention one specific initiative or development in this area.
    6. According to the text, what progress has been made in empowering women in Saudi Arabia? Provide one specific statistic or example.
    7. Discuss the importance of infrastructure development for achieving the goals of Vision 2030. Give an example of a major infrastructure project mentioned in the text.
    8. What challenges does Saudi Arabia face in its pursuit of technological independence in the defense sector?
    9. How is Saudi Arabia working to diversify its economy away from oil dependence? Mention two non-oil sectors receiving significant attention.
    10. What was the significance of the establishment of specialized cultural authorities in 2018, according to the provided text?

    Answer Key

    1. Two key goals of Vision 2030 are diversifying the economy to reduce reliance on oil and creating a vibrant society with an enhanced quality of life. These are important for long-term economic sustainability and the well-being of citizens as global energy demands evolve.
    2. The National Investment Strategy (NIS) is a comprehensive framework to significantly increase investment in Saudi Arabia. Two primary objectives are to increase the size and balance of the economy and to enhance the Kingdom’s competitive position globally. It aims to develop key sectors like renewable energy and technology.
    3. Saudi Arabia’s strategy for localizing defense industries involves building domestic capabilities in designing and manufacturing military equipment and systems. The intended benefits include reducing military spending on foreign procurement and achieving greater national defense independence.
    4. Saudi Arabia has been actively involved in diplomatic efforts to resolve international conflicts and promote peace. For example, it recently hosted talks in Jeddah aimed at finding a solution to the Ukraine crisis, demonstrating its commitment to global security.
    5. Saudi Arabia’s cultural landscape has undergone a significant transformation with a focus on redefining culture and integrating it into daily life. The establishment of the Ministry of Culture in 2018 marked a pivotal point, leading to numerous initiatives to promote heritage and the arts.
    6. The text indicates significant progress in women’s empowerment, with Saudi Arabia advancing to the 13th global rank in the equal pay for equal work indicator in 2024. Furthermore, the rate of Saudi women’s participation in the labor market has increased.
    7. Infrastructure development is crucial for Vision 2030 as it provides the foundation for economic diversification and attracts investment. A major project mentioned is the Saudi Land Bridge, which aims to connect the Arabian Gulf and the Red Sea, facilitating trade.
    8. Saudi Arabia faces the challenge of developing indigenous technological capabilities and acquiring necessary technologies and intellectual property to achieve full technological independence in its defense industries.
    9. Saudi Arabia is diversifying its economy by focusing on and investing in strategic non-oil sectors. Two such sectors highlighted in the text are tourism, with a target of 100 million annual visitors, and the technology sector, with a national AI strategy.
    10. The establishment of specialized cultural authorities in 2018 was significant because it represented more than just administrative reorganization; it was part of a comprehensive national project to redefine culture and integrate it into the daily lives of citizens, driving a broader cultural transformation.

    Essay Format Questions

    1. Analyze the interconnectedness of the “vibrant society” and “diversifying the economy” pillars of Saudi Arabia’s Vision 2030. How do cultural development and economic diversification mutually reinforce each other in the Kingdom’s long-term goals?
    2. Evaluate the potential impact of Saudi Arabia’s National Investment Strategy on its transformation into a global investment powerhouse. What are the key strengths and potential challenges in achieving its ambitious investment targets by 2030?
    3. Discuss the strategic implications of Saudi Arabia’s push for self-sufficiency in its defense industries. How might increased localization of military production affect the Kingdom’s regional security role and its relationships with global arms suppliers?
    4. Examine the role of Saudi Arabia’s diplomatic initiatives in the context of its Vision 2030. How does the Kingdom’s engagement in international peace and security efforts align with its domestic development goals and its ambition to become a leading global nation?
    5. Critically assess the progress and future prospects of Saudi Arabia’s cultural transformation under Vision 2030. What are the key achievements so far, and what are the potential long-term impacts on national identity and international perceptions of the Kingdom?

    Glossary of Key Terms

    • Vision 2030: Saudi Arabia’s ambitious long-term plan launched in 2016, aimed at diversifying the economy, developing public services, and enhancing the Kingdom’s global standing.
    • Diversification (of Economy): The process of shifting an economy away from a single or limited number of revenue sources (primarily oil in Saudi Arabia) towards a wider range of sectors.
    • National Investment Strategy (NIS): A comprehensive plan designed to significantly increase both domestic and foreign investment in Saudi Arabia across various strategic sectors.
    • Localization (of Industries): The effort to develop domestic capabilities and manufacturing within a country, reducing reliance on imports. In the context of the text, primarily refers to the defense industry.
    • Sovereign Wealth Fund (Public Investment Fund – PIF): A state-owned investment fund that manages a nation’s savings. The PIF plays a significant role in driving Vision 2030 projects and investments.
    • Geopolitical: Relating to the influence of geography on politics and international relations, often concerning strategic locations and resources.
    • Soft Power: The ability to influence the behavior or thinking of other states or non-state actors through attraction and persuasion rather than coercion or payment. Cultural initiatives can be a tool of soft power.
    • Economic Sustainability: The capacity of an economy to maintain its performance over time without depleting resources or causing irreversible damage.
    • Foreign Direct Investment (FDI): An investment made by a firm or individual in one country into business interests located in another country.
    • Gross Domestic Product (GDP): The total monetary or market value of all the finished goods and services produced within a country’s borders in a specific time period.

    Detailed Briefing Document: Analysis of Provided Sources

    This briefing document analyzes the provided Arabic language sources, identifying key themes, important ideas, and significant facts. Quotes from the original texts are included where relevant (translated for clarity).

    Main Themes Across Sources:

    Several overarching themes emerge from the collection of articles:

    • Saudi Arabia’s Vision 2030 and its Implementation: A central theme is the ongoing execution and impact of Saudi Arabia’s Vision 2030, encompassing economic diversification, social reforms, and enhanced international standing.
    • Economic Diversification and Investment: A significant focus is placed on efforts to diversify the Saudi economy away from oil dependence through strategic investments in various sectors, including technology, tourism, renewable energy, and defense industries.
    • Strengthening National Capabilities: The sources highlight initiatives aimed at bolstering Saudi Arabia’s national capabilities in key areas such as defense manufacturing and technological advancement, aiming for self-sufficiency and global competitiveness.
    • Regional and International Role: Saudi Arabia’s active role in promoting regional stability, resolving conflicts, and fostering international cooperation is emphasized, particularly concerning the Ukraine crisis.
    • Cultural and Social Transformation: The documents touch upon the cultural renaissance and social reforms taking place in Saudi Arabia, including women’s empowerment and the preservation of national heritage.
    • Commemoration and Leadership: Several articles celebrate the anniversary of Crown Prince Mohammed bin Salman’s appointment, underscoring his leadership and the progress achieved under his guidance.
    • Condemnation of Violence and Calls for International Action: The sources include condemnation of Israeli actions in Syria and violations against civilians in Sudan, urging the international community to take responsibility.

    Important Ideas and Facts from Each Source:

    1. Excerpts from “20725.pdf” (Multiple Articles):

    • “Mohammed bin Salman.. An Active Role in Consolidating International Security and Stability” & “The Kingdom is a Leading Global Investment Power”:
    • Highlights the anniversary of Crown Prince Mohammed bin Salman’s pledge of allegiance and the pride in his leadership, which has reshaped the Saudi landscape.
    • Emphasizes the rapid development and transformation across various sectors driven by the ambitious Vision 2030.
    • Vision 2030 aims to leverage the Kingdom’s strengths, its distinguished strategic location, and its Arab and Islamic depth to achieve a thriving economy and a vibrant society.
    • Focuses on the second pillar of Vision 2030: diversifying the economy, reducing reliance on oil, and attracting local and foreign investments.
    • Mentions the National Investment Strategy launched in October 2020 as a key enabler for Vision 2030, aiming to develop investment opportunities, improve the business environment, and enhance the Kingdom’s competitive position on the global investment map.
    • “The Kingdom Condemns the Israeli Occupation’s Bombing of the Syrian Town of Kuwaya”:
    • Saudi Arabia strongly condemns the Israeli bombing of the Syrian town of Kuwaya, considering it a dangerous threat to the security and stability of Syria and the entire region.
    • Calls on the international community to assume its responsibilities to halt all military operations and violations by Israel in Palestinian and Syrian territories.
    • Reiterates solidarity with Syria and its people and calls for respect for Syria’s sovereignty and an end to all violations affecting its security and stability.
    • “Mohammed bin Salman.. An Active Role in Consolidating International Security and Stability” & “Saudi Diplomacy Succeeds in Halting Armed Conflicts” & “Symbol of Peace – Receiving the Ukrainian President”:
    • Highlights Saudi Arabia’s commitment to diplomacy and dialogue in establishing security and stability, drawing on its established legacy of wise political initiatives.
    • Mentions the American-Ukrainian meeting held in Jeddah as part of the Crown Prince’s continuous efforts to resolve the crisis in Ukraine and strengthen global peace and security.
    • Ukraine described the Jeddah talks as “very constructive” and discussions began on Kyiv’s proposal for a partial ceasefire with Russia.
    • The United States agreed to resume military and intelligence assistance to Ukraine.
    • The European Union aims to support Ukraine in achieving a comprehensive, just, and lasting peace based on the principles of the UN Charter and international law.
    • A 30-day ceasefire proposal, if accepted by Russia, would be an important step in this direction.
    • “Localization of Military Industries.. Vision 2030 Towards Self-Sufficiency” & “Strengthening National Capabilities and Achieving Defense Independence”:
    • Emphasizes the economic benefits of localizing defense industries, including reducing military spending, replacing foreign repairs with localized parts, attracting foreign capital, and creating job opportunities.
    • Highlights achievements in localization, such as building the first Saudi military naval combat system, localizing light and medium weapons, and establishing an advanced center for manufacturing aircraft engines (F110-129).
    • Points out the role of localization in creating job opportunities for Saudi youth and the collaboration between the Technical and Vocational Training Corporation and the General Authority for Military Industries (GAMI) to establish specialized academies.
    • Notes the establishment of the Saudi Arabian Military Industries (SAMI) and its role in developing local talent through training programs and partnerships with international companies.
    • Saudi universities have begun incorporating specialized academic curricula in military manufacturing, supporting innovation and localization.
    • Identifies key challenges in localizing military industries, including meeting the Kingdom’s long-term needs for advanced equipment and services, securing technology transfer and intellectual property, and developing qualified Saudi talent.
    • The Kingdom is determined to achieve a qualitative leap in localizing defense technologies, aiming to transform from an importing nation to a manufacturing one, contributing to national security and economic support.
    • Vision 2030 guides defense transformations, with the General Authority for Military Industries (GAMI) aiming to increase the localization of military spending from 4% in 2018 to a targeted 50% by 2030.
    • Since the appointment of Crown Prince Mohammed bin Salman as Deputy Crown Prince in 2017, the Kingdom has witnessed unprecedented strategic transformations that have strengthened its regional and international standing.
    • The General Authority for Military Industries (GAMI) has a strategic goal to increase the localization rate, reflecting the leadership’s vision to build a diversified and sustainable economy.
    • In 2017, the localization rate of military industries was only 3%, while the Kingdom was the third largest globally in terms of military spending.
    • “Investment Roadmap”:
    • Details the second pillar of Vision 2030, focusing on making the Saudi economy prosperous by diversifying it and reducing reliance on oil.
    • Highlights the National Investment Strategy launched in October 2020, aiming to enhance the future of investment in the Kingdom by developing opportunities, improving the business environment, and strengthening the Kingdom’s competitive position.
    • The National Investment Strategy aims to bring about a qualitative shift in the Saudi economy through four main pillars: investment opportunities, investors, financing, and competitiveness/enabling factors.
    • Targets strategic sectors such as green energy, technology, healthcare, biotechnology, and logistics.
    • In green energy, the Kingdom aims to produce 50% of its electricity needs from renewable sources by 2030, with projects like the Sakaka solar power plant and the Dumat Al-Jandal wind power project.
    • Saudi Arabia launched a project to produce green hydrogen in NEOM, aiming to be one of the largest globally.
    • In the technology sector, the Kingdom seeks to enhance digital infrastructure and develop AI technologies, with a national AI strategy aiming for a top 15 global ranking by 2030.
    • Significant investments are being made in developing a modern healthcare system, expanding digital health services like the “Sehhaty” application.
    • The Kingdom aims to become a global logistics hub by developing ports, airports, roads, and railways, including the Saudi Land Bridge project.
    • Diversifying the economy away from oil supports economic stability, with the National Investment Strategy focusing on sectors like tourism, technology, manufacturing, and renewable energy.
    • Foreign direct investment saw a 10% increase in 2023 compared to the previous year, contributing to the growth of non-oil sectors, which now constitute over 50% of the GDP.
    • The technology sector witnessed an annual growth of 7.5%, while the tourism sector’s contribution to GDP rose to 4.5%, targeting 100 million visitors annually by 2030.
    • Developing advanced infrastructure in line with global standards is a key pillar of the National Investment Strategy.
    • Over 1.5 trillion Riyals have been spent on infrastructure projects between 2016-2024, in addition to investments by the Public Investment Fund (PIF) targeting 5 trillion Riyals by 2030.
    • Developing infrastructure is strategically important for achieving Vision 2030 goals and attracting both local and foreign investments.
    • Improving the investment climate has a significant role in enhancing economic, social, and commercial activity.
    • The National Investment Strategy is a pivotal step in achieving Vision 2030, contributing to economic diversification, attracting investments, and strengthening the Kingdom’s position as a global investment power.
    • The leadership of Crown Prince Mohammed bin Salman and his ambitious vision underpin this strategy, aimed at building a prosperous and sustainable economic future for the Kingdom.
    • “On the Covenant and Loyalty”:
    • Celebrates the eighth anniversary of Crown Prince Mohammed bin Salman’s appointment as Deputy Crown Prince.
    • Highlights this anniversary as a historical milestone and a turning point towards greater progress and empowerment in all fields.
    • Under his leadership, an ambitious Vision 2030 was launched, focusing on a vibrant society, a thriving economy, and empowering youth, especially women.
    • The Kingdom continues its success with confident steps and precisely defined goals.
    • “Continuous Empowerment”:
    • Notes the significant progress and clear indicators of achieving Vision 2030, reflected in the Kingdom’s local, regional, and international role and standing.
    • Emphasizes the pivotal role of Vision 2030 in empowering women and achieving equality between genders in rights, duties, and work conditions.
    • Saudi Arabia advanced to 13th globally in the Gender Pay Gap Index for equal work in 2024.
    • The participation rate of Saudi women in the labor market reached 36.2% in 2024, an increase of 0.8 percentage points.
    • The employment rate of Saudi women rose to 31.3% of the population.

    2. Other Articles (Selected Highlights):

    • “The Ma’aqiliya Commercial Center… Between Authenticity and Modernity”: Describes the Ma’aqiliya center as a historic part of Riyadh, blending tradition and modernity.
    • “Firsts in Islamic Civilization” (Mentions psychological warfare during early Islamic battles).
    • “Sitting with the Prophet (PBUH) in Remembrance Gatherings and its Impact”: Discusses the social interactions and knowledge exchange in Mecca during the Prophet’s time.
    • “From Tree Diseases Comes Goodness”: Highlights the benefits of trees, including oxygen production and temperature regulation.
    • “Digital Marketing in Light of Vision 2030”: Emphasizes the importance of digital marketing in achieving the goals of Vision 2030 and positioning Saudi Arabia as a leading digital marketing hub in the region.
    • “Al-Abdulkarim: On the Anniversary of the Crown Prince’s Pledge of Allegiance, We Recall with Pride the Story of the Nation’s Renaissance”:
    • Highlights the pride in the developments the Kingdom has witnessed in recent years under the leadership of the Crown Prince and Vision 2030.
    • Cites international organizations’ recognition of the Kingdom’s progress.
    • Vision 2030 has impacted all aspects of the state, achieving significant economic growth and diversifying income sources beyond oil.
    • Crown Prince Mohammed bin Salman has fulfilled his promises in Vision 2030, empowering the nation’s youth towards prosperity and development.
    • Quotes the Crown Prince’s early statement emphasizing his role as one among millions, driven by the ambition and determination to elevate the nation.
    • “‘: Anniversary of the Pledge of Allegiance – Figures Document a Success Story’”:
    • Economic experts affirm the significant economic growth achieved under the leadership of King Salman and Crown Prince Mohammed bin Salman, driven by Vision 2030.
    • The Kingdom’s GDP grew by 2.8% in the third quarter of 2024 compared to the previous year.
    • Non-oil activities are the main driver of this growth, increasing by 4.3%, while government activities rose by 2.6%.
    • The unemployment rate among Saudi citizens decreased to 7.1% in the fourth quarter.
    • The Madlouh (businessman) states that Vision 2030 has placed the Kingdom on the global economic map as an attractive investment environment.
    • Dr. Abdullah Al-Nimr highlights the tremendous development in the healthcare and education sectors.
    • “The Kingdom Condemns Israeli Violations and Calls on the International Community to Shoulder its Responsibilities”:
    • Reiterates Saudi Arabia’s condemnation of Israeli violations and calls on the international community to take responsibility.
    • “In the Eighth Anniversary of the Pledge of Allegiance to the Crown Prince: The Cultural Renaissance in the Kingdom.. From Dream to Achievement” & “#A Vision Builds Them and a Culture Elevates Them”:
    • Marks the eighth anniversary of the Saudi people’s pledge of allegiance to Crown Prince Mohammed bin Salman.
    • Highlights the comprehensive transformation under his leadership, extending beyond economic development and administrative reform to encompass the essence of identity and culture.
    • In just eight years, Saudi culture has transformed from limited activity to a comprehensive national project rooted in heritage, ambition, and openness to the world.
    • The establishment of the Ministry of Culture in 2018 was a pivotal point, representing a strategic and intellectual project to redefine culture and integrate it into daily life.
    • Following this, eleven specialized cultural authorities were established, covering literature, publishing, translation, theater, performing arts, visual arts, museums, heritage, films, music, fashion, culinary arts, and libraries.
    • Examples of the cultural renaissance include Riyadh Season, the Diriyah Gate project, the Red Sea International Film Festival, and the JAX District for visual arts.
    • Saudi Arabia hosted the 45th session of the UNESCO World Heritage Committee in Riyadh.
    • The “Our Culture is Our Identity” program supports cultural development and local talents across the Kingdom.
    • Highlights the role of drama in reflecting social issues and influencing change, citing examples of how dramatic works can raise awareness and prompt societal discussions.
    • Emphasizes that drama is not just entertainment but a tool for analyzing and rebuilding reality.
    • Articles on Sports, Finance, and Local News (While present, these are less directly connected to the major themes of Vision 2030 and international relations but provide a broader context of current events in Saudi Arabia).

    Conclusion:

    The provided sources collectively paint a picture of a Saudi Arabia undergoing significant transformation driven by Vision 2030. The leadership of Crown Prince Mohammed bin Salman is consistently highlighted as the catalyst for these changes, encompassing economic diversification, strengthening national capabilities (especially in defense), an active role in regional and international affairs, and a cultural and social renaissance. The Kingdom’s condemnation of international conflicts and its efforts towards peaceful resolutions are also notable. The articles underscore the ambition and progress being made across various sectors, reflecting a nation striving for a prosperous and influential future on the global stage.

    Saudi Arabia’s Vision 2030: Key Pillars and Progress

    Frequently Asked Questions about the Provided Sources

    • What is the overarching vision driving Saudi Arabia’s development, as highlighted in the sources? The overarching vision is Saudi Vision 2030, spearheaded by Crown Prince Mohammed bin Salman. This ambitious plan aims to transform Saudi Arabia into a vibrant society with a thriving economy and an ambitious nation. Key aspects include diversifying the economy away from oil dependence, fostering a dynamic society, and positioning the Kingdom as a leading global investment power and an influential player on the international stage.
    • How is Saudi Arabia working towards economic diversification and reducing its reliance on oil? Saudi Arabia is actively pursuing economic diversification through the National Investment Strategy, launched in 2020. This strategy focuses on attracting both domestic and foreign investments into non-oil sectors such as tourism, technology, renewable energy, and manufacturing. The Kingdom is also developing its infrastructure, improving the business environment, and creating special economic zones to facilitate this transition. The goal is to create a more sustainable and resilient economy with diverse sources of income and employment opportunities for its citizens.
    • What role does Saudi Arabia see itself playing in international security and stability? Saudi Arabia, under the leadership of Crown Prince Mohammed bin Salman, actively seeks to play a significant role in fostering international security and stability. This is evident in its diplomatic efforts to mediate conflicts, such as the Ukraine crisis, and its strong condemnation of actions that threaten regional and global peace, like the Israeli shelling in Syria. The Kingdom emphasizes dialogue and peaceful resolutions, grounded in international law and respect for national sovereignty, as crucial for resolving global issues and promoting cooperation.
    • What are the key objectives and progress in localizing the defense industries in Saudi Arabia? The localization of defense industries is a strategic objective of Vision 2030, aiming to achieve self-sufficiency in defense capabilities, enhance national security, and support the local economy. Significant progress has been made, including the establishment of companies like SAMI and GAMI, the development of indigenous military systems (like the “Hazem” naval combat management system), and the localization of the manufacturing of various weapons and aircraft engines. The goal is to reach 50% localization of military spending by 2030, fostering technological independence, creating job opportunities for Saudi youth, and reinvesting defense spending within the Kingdom.
    • How has the status and role of women in Saudi Arabia evolved in recent years, according to the sources? The sources highlight a significant positive transformation in the status and role of women in Saudi Arabia, largely driven by Vision 2030. Women are increasingly empowered and have seen their rights and opportunities expanded across various sectors, including the economy and leadership positions. The Kingdom has made progress in the gender pay gap for equal work and has witnessed a notable increase in the participation rate of Saudi women in the workforce. Initiatives focus on achieving gender equality in rights, duties, and work environment conditions, enabling women to contribute more fully to the Kingdom’s development.
    • What is the significance of cultural development within Saudi Vision 2030? Cultural development is considered a fundamental pillar of Saudi Vision 2030, extending beyond mere economic or administrative reforms to encompass the core of national identity and human development. The establishment of the Ministry of Culture in 2018 and the subsequent creation of eleven specialized cultural authorities signify a comprehensive national project aimed at redefining and integrating culture into the daily lives of citizens. This initiative seeks to preserve heritage, nurture creativity across various art forms, and foster a vibrant cultural scene that connects with the Kingdom’s roots while opening doors to global engagement.
    • How is Saudi Arabia developing its infrastructure to support its economic and strategic goals? The development of advanced infrastructure is a crucial element of Saudi Arabia’s National Investment Strategy and Vision 2030. Massive investments are being made in transportation (ports, airports, roads, railways, including projects like the Saudi Land Bridge), digital infrastructure, and utilities to create an attractive and integrated investment environment. These developments aim to enhance connectivity, facilitate trade, reduce transportation costs, and support the growth of various strategic sectors, ultimately strengthening Saudi Arabia’s competitive position and driving sustainable economic growth.
    • What are Saudi Arabia’s key values and principles that underpin its domestic and foreign policies, as indicated in the texts? Saudi Arabia’s policies are underpinned by several key values and principles. Domestically, the focus is on unity, progress, empowerment (especially of youth and women), and sustainable development aligned with Vision 2030. In its foreign policy, the Kingdom emphasizes peace, dialogue, tolerance, mutual respect for sovereignty, and adherence to international law. It strives to be a reliable mediator in conflicts and a unifying force in the Arab and Islamic world, aiming for stability and prosperity for all people, regardless of their background or ideology.

    Saudi Arabia: Vision 2030 and Economic Diversification

    The sources highlight that economic diversification is a central objective for Saudi Arabia, primarily driven by Vision 2030, to reduce its historical dependence on oil. This strategic shift aims to build a more sustainable and resilient economic future for the Kingdom.

    Here are the key aspects of economic diversification discussed in the sources:

    • Goal of Reducing Oil Dependence: Saudi Arabia is actively seeking to diversify its economy away from its reliance on oil as the primary source of income.
    • National Investment Strategy: The National Investment Strategy plays a pivotal role in restructuring the Saudi economy towards greater diversity and sustainability by stimulating investments in non-traditional sectors. This strategy is considered a key enabler for achieving the targets of Vision 2030.
    • Focus on Strategic Sectors: The Kingdom is focusing on developing and supporting several strategic sectors as engines for economic diversification. These include:
    • Tourism
    • Technology
    • Manufacturing
    • Renewable Energy
    • Localization of Industries: The localization of military industries is another key initiative that aligns with Vision 2030 and contributes to economic diversification by reducing military expenditure, attracting foreign capital, and creating employment opportunities. This also aims to achieve self-sufficiency and reduce reliance on foreign imports in the defense sector.
    • Infrastructure Development: Developing advanced infrastructure that meets global standards is crucial for creating an attractive and integrated investment environment, which supports economic diversification efforts.
    • Progress and Impact: The sources indicate tangible progress in economic diversification. Non-oil sectors now constitute over 50% of the Gross Domestic Product (GDP), reflecting a significant shift. Foreign direct investment has also seen an increase. The continued implementation of diversification strategies is expected to strengthen the Kingdom’s global economic position and create new job opportunities, contributing to sustainable economic development.

    In essence, the sources consistently portray economic diversification as a fundamental and actively pursued goal for Saudi Arabia under Vision 2030, with the National Investment Strategy and the development of non-oil sectors playing crucial roles in achieving this transformation.

    Saudi Arabia’s Vision 2030: Transformation and Progress

    Vision 2030 is a comprehensive and ambitious strategic framework launched by Saudi Arabia, under the leadership of Crown Prince Mohammed bin Salman, with the overarching goal of transforming the Kingdom into a leading nation with a thriving economy, a vibrant society, and an ambitious homeland. This vision represents a pivotal moment in Saudi Arabia’s history, setting a clear roadmap for a diversified and sustainable future.

    Here are the key aspects of Vision 2030 as highlighted in the sources:

    • Overarching Goals: Vision 2030 aims to create a thriving economy by diversifying its sources of income away from oil, fostering growth in new sectors, and attracting investment. It seeks a vibrant society by enhancing the quality of life for its citizens and residents, promoting cultural heritage, and empowering various segments of society, including women. The vision also aims for an ambitious homeland by strengthening national capabilities and enhancing the Kingdom’s regional and international standing.
    • Leadership and Implementation: The vision was initiated and is being actively driven by Crown Prince Mohammed bin Salman, who is recognized as the “architect of the vision”. His leadership is seen as instrumental in pushing forward the reforms and initiatives under Vision 2030.
    • Key Pillars: While not explicitly divided into three pillars in all excerpts, the sources consistently emphasize the interconnectedness of economic, social, and national development goals. These can be broadly understood as:
    • A Thriving Economy: This pillar focuses on economic diversification, primarily by reducing the Kingdom’s reliance on oil revenues. The National Investment Strategy is a key enabler in this regard, aiming to stimulate investments in non-traditional sectors like tourism, technology, and renewable energy. Developing the manufacturing sector and localizing industries, particularly the military industry, to achieve self-sufficiency and create economic opportunities are also crucial aspects. Furthermore, attracting both local and foreign direct investment is a core objective. Developing advanced infrastructure is considered essential to support economic growth and attract investment.
    • A Vibrant Society: This pillar encompasses improving the quality of life, promoting cultural and entertainment activities (like Riyadh Season), empowering women, and fostering a strong sense of national identity. The establishment of the Ministry of Culture and related cultural authorities signifies a significant focus on cultural development and integrating culture into daily life.
    • An Ambitious Homeland: This involves enhancing national capabilities, particularly in the defense sector through the localization of military industries to achieve strategic independence. It also aims to strengthen Saudi Arabia’s role as an influential player on the regional and international stage.
    • Progress and Achievements: The sources highlight significant progress in various sectors under Vision 2030. Non-oil sectors now contribute to over 50% of the GDP, indicating a move towards economic diversification. Foreign direct investment has increased. The localization of military industries has seen progress, with the percentage of localized military expenditure increasing. There have also been advancements in women’s empowerment, with increased participation in the workforce and leadership roles. The Kingdom has also witnessed significant economic growth, particularly in non-oil activities.
    • Challenges: Despite the progress, the sources also acknowledge challenges. In the context of localizing military industries, challenges include meeting the Kingdom’s long-term needs for military equipment and services, securing technology transfer, and developing local industrial capabilities and expertise.

    In summary, Vision 2030 is a transformative plan for Saudi Arabia, driven by Crown Prince Mohammed bin Salman, aiming for a diversified and sustainable economy, a vibrant society, and an ambitious homeland. It involves significant investments and strategic initiatives across various sectors, with notable progress being made while also addressing existing challenges. Our previous discussion on economic diversification aligns directly with the core economic objectives of Vision 2030.

    Saudi Arabia’s National Investment Strategy: Vision 2030

    The sources highlight the National Investment Strategy as a fundamental pillar of Saudi Arabia’s Vision 2030, playing a pivotal role in achieving economic diversification and sustainable development.

    Here are the key aspects of the investment strategy discussed in the sources:

    • Core Objective: Economic Diversification The primary goal of the National Investment Strategy is to restructure the Saudi economy away from its dependence on oil by stimulating investments in diverse non-traditional sectors such as tourism, technology, manufacturing, and renewable energy. This is considered essential for building a more resilient and sustainable economic future.
    • Framework for Future Investment: The strategy serves as a comprehensive framework for directing future investments in the Kingdom, aiming to enhance its competitive position on the global investment map.
    • Attracting Investment: A key aim is to attract substantial investments, both domestic and foreign, to fuel growth in targeted sectors. The strategy aims to attract investments worth 12.4 trillion Riyals by 2030, including 5 trillion Riyals from the local private sector and 1.8 trillion Riyals in foreign direct investment (FDI). There is also a target of attracting 4 trillion Riyals in foreign investments.
    • Improving the Investment Environment: The strategy focuses on developing a more attractive and integrated investment environment by improving business regulations and enhancing the Kingdom’s competitiveness.
    • Strategic Sectors: The National Investment Strategy prioritizes investment in key sectors identified as having high growth potential and contributing to diversification. These include:
    • Tourism: Aiming for 100 million visitors annually by 2030.
    • Technology: With the technology sector experiencing significant annual growth.
    • Manufacturing: With a focus on localizing modern technologies.
    • Renewable Energy: Targeting 50% of electricity production from renewable sources by 2030.
    • Other sectors like healthcare are also seeing significant investment.
    • Role of Key Players:
    • The Government: Plays a crucial role in guiding the strategy, creating an enabling environment, and making significant investments in infrastructure.
    • The Private Sector: The strategy aims to stimulate the local private sector, targeting 5 trillion Riyals in investment by 2030.
    • Foreign Investors: Attracting FDI is a major component, with a target of 1.8 trillion Riyals by 2030 and an additional target to attract 4 trillion Riyals. The increase in investment licenses issued reflects the Kingdom’s growing attractiveness as an investment destination.
    • The Public Investment Fund (PIF): Manages substantial investments, with a targeted value of 5 trillion Riyals by 2030, and collaborates with the private sector on projects.
    • Impact and Progress: The sources indicate that the National Investment Strategy is already yielding tangible results:
    • Increased FDI: Foreign direct investment saw a 10% increase in 2023 compared to the previous year. Annual FDI flows have significantly increased, reaching 388 billion Saudi Riyals in 2030 (projected) from 17 billion Riyals in 2019.
    • Growth of Non-Oil Sectors: Non-oil sectors now constitute over 50% of the GDP, demonstrating a clear shift towards a more diversified economy.
    • Increased Investment Licenses: The number of investment licenses issued has seen substantial growth, indicating strong investor interest.
    • Rise in Gross Fixed Capital Formation: Data shows an annual growth of 5.3% in gross fixed capital formation for 2024, driven by a 7.9% increase in the non-governmental sector.
    • Localization of Military Industries: As discussed in our previous turn, the localization of military industries is a specific strategic initiative that aligns with the broader investment strategy. It aims to reduce military spending, attract foreign capital, create jobs, and enhance national defense capabilities. The goal is to reach 50% localization by 2030.

    In conclusion, the National Investment Strategy is a critical driver of Saudi Arabia’s economic transformation under Vision 2030. It focuses on attracting diverse investments, both local and foreign, into key non-oil sectors, supported by efforts to improve the investment climate and develop advanced infrastructure. The strategy is already demonstrating significant progress in diversifying the economy and increasing investment inflows.

    Saudi Defense Industry: Vision 2030 and Diversification

    The sources discuss the defense industry primarily in the context of Saudi Arabia’s Vision 2030 and its efforts towards economic diversification and achieving strategic independence.

    Here’s a breakdown of the key aspects related to the defense industry as mentioned in the sources:

    • Localization of Military Industries: The localization of military industries is a significant objective under Vision 2030. This initiative aims to reduce the Kingdom’s military expenditure by manufacturing more defense equipment and supplies domestically. It also seeks to replace reliance on external suppliers for repair and maintenance with locally produced and maintained parts.
    • Economic Benefits: The localization of the defense industry is expected to bring several economic benefits:
    • Attracting foreign capital to the Saudi economy through the opening of military factories.
    • Creating job opportunities, contributing to the Saudi job market.
    • Boosting the local market with increased investment.
    • Improving the efficiency of military supply and raising the readiness of military entities.
    • Technological Advancement: The development of the defense industry requires the integration of modern technologies, making electrical engineering and related fields crucial. Key technological areas include:
    • Smart weapon guidance and remote-controlled shooting.
    • Military drones and surveillance technologies.
    • Reliable and renewable energy sources for military applications.
    • Automatic control systems and artificial intelligence.
    • Advanced battery production and energy management systems.
    • Radars, electronic warfare systems, and directed energy weapons like laser weapons.
    • Role of Electrical Engineering: Electrical engineering plays a fundamental role in modern military technology, contributing to:
    • Developing and enhancing the efficiency of defense systems and equipment.
    • Improving command and control systems.
    • Enhancing the operational effectiveness of military equipment.
    • Designing and developing smart control systems for vehicles and aircraft.
    • Developing communication, vision, and sensing systems (including thermal imaging and radar).
    • Developing secure and reliable energy sources.
    • Protecting systems from jamming and cyberattacks.
    • Academia and Innovation: Saudi universities have a role to play in supporting innovation in the electrical engineering aspects of the defense industry through research, collaboration with industrial companies, developing specialized educational programs, establishing innovation incubators, and integrating military-focused graduation projects.
    • Job Opportunities and Skills: The defense industry offers diverse job opportunities across various specializations, requiring a skilled workforce in areas such as engineering, manufacturing, technical support, and administration. It emphasizes high quality standards and a well-structured production process. Technicians play a crucial role in ensuring production meets required specifications and quality standards.
    • Alignment with Vision 2030 and Investment Strategy: As we discussed previously, the localization of the defense industry directly supports the goals of Vision 2030 for economic diversification by creating a new sector, attracting investment, and generating employment. It also aligns with the National Investment Strategy by focusing on developing the manufacturing sector and enhancing national capabilities [our previous turn]. The goal of reaching 50% localization of military expenditure by 2030 reflects the ambitious targets set under these strategic frameworks [our previous turn].

    In summary, the development of a robust domestic defense industry is a key component of Saudi Arabia’s strategic vision. It is driven by the objectives of economic diversification, technological advancement, job creation, and achieving greater self-reliance in meeting the Kingdom’s defense needs.

    Regional Conflicts and Mediation Efforts

    The sources discuss several ongoing regional conflicts and tensions, highlighting their impact and the efforts being made to address them.

    The Russian-Ukrainian Conflict:

    The sources extensively cover the Russian-Ukrainian conflict and the role Saudi Arabia has played in attempting to mediate and facilitate peace. Notably:

    • There was an agreement to implement necessary measures regarding the cessation of targeting energy facilities in both Russia and Ukraine. This agreement was reportedly made between Presidents Trump and Putin, and also between Presidents Trump and Zelensky.
    • The United States and Russia affirmed their joint commitment to continue working towards achieving lasting and sustainable peace in the region. They also agreed to prevent the use of commercial ships in the Black Sea for military purposes, alongside Ukraine.
    • The United States reiterated its commitment to help reach an agreement on prisoner exchanges and the return of Ukrainian children transferred to Russia.
    • Saudi Arabia has been actively involved in facilitating and continuing negotiations for a peaceful resolution to the conflict, building on agreements made in Riyadh. The Kingdom is presented as a reliable global partner and a compass for international politics, chosen by world leaders as a trusted destination for discussing peaceful solutions to the Ukrainian crisis.
    • Crown Prince Mohammed bin Salman is highlighted for his high political standing and ability to bridge communication between the involved parties, facilitating constructive dialogue.
    • Ukraine confirmed that talks with the United States in Jeddah were “very constructive” and involved discussions on a ceasefire and the end of the war that began with the Russian invasion in 2022.
    • Ukraine hoped to persuade Washington to resume military aid and intelligence sharing, which were reportedly halted after a disagreement between Presidents Trump and Zelensky.
    • Ukrainian officials stated their readiness to do everything possible to achieve peace. An attack involving hundreds of drones on Moscow and other regions was aimed at pressuring President Putin to agree to an air and sea truce.
    • The French President Emmanuel Macron welcomed the progress made in the talks between the United States and Ukraine regarding the possibility of ending the ongoing Russian war.
    • The United Kingdom supported the peace process and the outcomes of the talks in Jeddah.
    • The Secretary-General of the Arab League and the Secretary-General of the Cooperation Council for the Arab States of the Gulf (GCC) praised Saudi Arabia’s hosting of these talks, emphasizing the Kingdom’s influential role and the international community’s confidence in its peace-making efforts.
    • The Jordanian government also welcomed Saudi Arabia’s hosting of the talks, hoping they would contribute to a solution to the war and enhance international peace and security.
    • The European Union welcomed the agreement between Ukraine and the United States, reached after their meeting in Saudi Arabia, which included proposed measures for a ceasefire, humanitarian efforts, and the exchange of security and intelligence information.
    • Crown Prince Mohammed bin Salman has made significant efforts to contribute to stopping the war, including mediating prisoner exchanges between Russia and Ukraine, which enhanced Saudi Arabia’s standing as an influential diplomatic mediator. The Kingdom was reportedly the main point of direct contact between the warring parties.

    The Israeli-Palestinian Conflict:

    The sources detail the escalation of the Israeli-Palestinian conflict, particularly in Gaza and the West Bank:

    • The “Israeli” occupation has continued its war of genocide against the Gaza Strip for the ninth consecutive day, resulting in hundreds of martyrs and thousands of injuries.
    • Intense Israeli shelling and airstrikes have targeted various areas in Gaza, including residential buildings, refugee camps, and agricultural land, causing widespread destruction and casualties.
    • There are reports of the “Israeli” forces using powerful and destructive bombs, including GBU-39 guided bombs.
    • The “Israeli” occupation has reportedly cut off water supplies to the residents of Gaza and prevented the entry of fuel.
    • The suffering of Palestinians in Gaza is exacerbated by a severe water crisis, with many lacking access to safe drinking water.
    • The “Israeli” forces have conducted raids and arrests in the West Bank, including in Jenin and Hebron, often accompanied by the destruction of property.
    • The Saudi Ministry of Foreign Affairs expressed the Kingdom’s strong condemnation and denunciation of the Israeli occupation forces’ bombing of the Syrian town of Koya, which resulted in deaths and injuries. Saudi Arabia reiterated its absolute rejection of the continued attempts by the Israeli occupation authorities to undermine the security and stability of Syria and the region through its flagrant and repeated violations of relevant international laws.
    • The Permanent Representative of Saudi Arabia to the United Nations in Geneva condemned the continued aggressions and violations committed by Israel against the Palestinian people, pointing to the systematic targeting of civilians. He also rejected the Israeli occupation’s plans to displace Palestinians from the Gaza Strip and the legalization of illegal settlements in the West Bank.
    • The Secretary-General of the GCC condemned the Israeli aggression on the Syrian town of Koya as a continuation of its aggressive approach to destabilize the region. He emphasized the importance of respecting Syria’s sovereignty and territorial integrity for the region’s security and stability.

    The Conflict in Sudan:

    The sources report on the ongoing conflict in Sudan between the Sudanese army and the Rapid Support Forces:

    • The Sudanese army announced that it had fully controlled Khartoum airport after two years of Rapid Support Forces’ presence inside.
    • The army was also reported to be besieging the Jabal Awliya area south of the capital, the last major stronghold of the Rapid Support Forces in the Khartoum region.
    • The Sudanese army launched a wide-scale operation to expel the Rapid Support Forces from the capital after the latter seized the Republican Palace and other vital facilities.
    • The “Hamamu al-Emergency” group, which documents violations in the Sudanese war, accused the army of carrying out a deadly bombing in northern Darfur, potentially one of the deadliest incidents since the conflict began two years prior. However, the army spokesperson denied these claims.
    • A military source reported that the army had taken control of the Al-Manshiya Bridge, one of the bridges crossing the Blue Nile east of Khartoum, leaving the Rapid Support Forces controlling only the Jabal Awliya Bridge to the south of the capital.
    • Witnesses reportedly saw Rapid Support Forces fighters withdrawing south of Khartoum, seemingly towards Jabal Awliya.

    Other Regional Tensions:

    • The Lebanese President demanded a halt to Israeli “hostile acts”.

    In summary, the sources depict a region marked by significant and interconnected conflicts. Saudi Arabia is presented as actively trying to mediate the Russian-Ukrainian conflict and strongly condemning Israeli actions in Palestine and Syria, which are seen as destabilizing the Middle East. The conflict in Sudan adds another layer of complexity to regional security concerns. Our previous discussions on Saudi Arabia’s focus on economic diversification and developing its own defense industry are indirectly relevant, as regional instability can impact economic development and the need for strong national defense capabilities.

    Mohammed bin Salman…an effective role in consolidating international security and stability

    US expresses gratitude to Crown Prince for hosting Russian-Ukrainian talks

    The Kingdom is a key mediator contributing to promoting peace and stability.

    The United States expressed its gratitude to His Royal Highness Prince Mohammed bin Salman bin Abdulaziz Al Saud, Crown Prince and Prime Minister, for his wise leadership and sponsorship of the bilateral talks with Russian and Ukrainian delegations in Riyadh from March 23 to 25, 2025. The talks took place in an atmosphere of constructive cooperation and mutual respect, resulting in a set of agreements that contribute to enhancing regional and international stability and security. A White House statement said: The talks once again demonstrated the role of the Kingdom of Saudi Arabia as a key mediator contributing to promoting peace and stability in the region. According to the statement, the United States and Russia agreed to ensure safe navigation in the Black Sea, with a commitment to avoid the use of force or directing military attacks, and to ensure that commercial vessels are not used for military purposes. It explained that America will work with Russia to facilitate the restoration of its ability to access the global market for exporting agricultural materials and fertilizers, by reducing marine insurance costs and enhancing access to ports and payment systems for export transactions. They also agreed to implement the necessary measures to achieve what was agreed upon between Presidents Trump and Putin regarding the ban on targeting energy facilities in both Russia and Ukraine. The two sides welcomed the good offices of a third country to support the implementation of agreements on energy and maritime navigation. The United States and Russia affirmed their shared commitment to continue working to achieve lasting and sustainable peace in the region. The United States and Ukraine agreed to ensure safe navigation in the Black Sea while avoiding the use of commercial vessels for military purposes. The United States affirmed its commitment to helping reach an agreement on the exchange of prisoners, the release of civilian detainees, and the return of Ukrainian children forcibly transferred to Russia. It was agreed to implement the necessary measures to implement the agreement between Presidents Trump and Zelenskyy prohibiting the targeting of energy facilities in both Russia and Ukraine. The United States and Ukraine welcomed the efforts of third countries to facilitate the implementation of agreements related to energy and maritime navigation, and affirmed their determination to continue working toward achieving sustainable peace in the region. The statement pointed to America’s commitment and continued efforts to facilitate negotiations and work towards a peaceful solution to the Russian-Ukrainian conflict, based on what was agreed upon in Riyadh, and within the framework of ongoing efforts to achieve lasting stability and security.

    The Kingdom is a leading global investment power.

    Riyadh – Razan Al-Otaibi

    On the anniversary of the pledge of allegiance to the sponsor of the vision, His Highness Prince Mohammed bin Salman, Crown Prince and Prime Minister, loyalty is renewed and pride increases for the leadership of the prince who reshaped the Saudi landscape through gigantic and rapid achievements that witnessed numerous reforms in all sectors. This is the most important historical phase the Kingdom has ever experienced, in which ambitions were transformed into a tangible reality from the ambitious vision of the Kingdom’s Vision 2030, which seeks to invest in the strengths that the Kingdom possesses, from its distinguished strategic position, its pioneering investment power, and its Arab and Islamic depth. Amidst clear future prospects, the Kingdom is making steady strides toward achieving the Kingdom’s Vision 2030, under the leadership of the vision’s sponsor, Prince Mohammed bin Salman. It is devoting most of its attention to providing a thriving economy for a vibrant society and an ambitious nation, so that the Kingdom can join the ranks of the world’s advanced countries. It also aims to build a diversified and sustainable economy, utilizing the most important resources and skills that constitute a source of strength possessed by the Kingdom. Based on the second axis of the nation’s ambitious vision, Vision 2030, which focuses on making the Kingdom’s economy prosperous, it also aims to focus on expanding the strategic objectives represented in diversifying the Kingdom’s economy and reducing dependence on oil as a primary economic resource, by attracting local and foreign investments and expanding the investment network in the Kingdom, to ensure economic stability and diversify its sources. This economic stability constitutes a fundamental pillar for the success of the National Investment Strategy, launched by Crown Prince Mohammed bin Salman – may God protect him – in October 2020, within the framework of the Kingdom’s Vision 2030. This strategy is one of the main enablers for achieving the Vision’s objectives, as it provides a general framework for enhancing the future of investment in the Kingdom by developing investment opportunities, improving the business environment, and strengthening the Kingdom’s competitive position on the global investment map.

    World Trust

    Abdullah Al-Hasani

    In all situations, even during crises and events, the Kingdom proves that it is a peacemaker, a beacon of justice in the balance of international politics, and the compass that holds the reins and balance of power. Reflecting the growing international confidence in the Kingdom, we find it has become a trusted destination for world leaders. It is not far from what the world stands on, and what observers can see, that the leaders of the United States and the Russian Federation have chosen the Kingdom to be the most effective and appropriate option for exploring a peaceful horizon for the Ukrainian crisis. Here, the luminous and striking presence and high political standing of His Highness the Crown Prince Mohammed bin Salman are evident, as is his ability to build bridges of communication between the parties, and his high reliability, which makes him the most capable and worthy of facilitating constructive dialogue to bring viewpoints closer together. The Kingdom of Saudi Arabia, based on its commitment to its regional and international responsibilities, views honest dialogue as the only way to find a peaceful solution to the crisis, and is keen to push towards international consensus on frameworks and mechanisms that enhance global security and stability, away from the language of escalation and closer to the spirit of understanding and cooperation. It is no wonder, in light of the Kingdom’s international presence and the confidence it enjoys, that our country’s efforts have been recognized and translated into widespread praise from world leaders, perhaps the most recent of which is the praise of the United States of America through the mediation and good efforts of His Highness the Crown Prince, and the appreciation and gratitude that the Kingdom’s efforts to enhance international security and stability have received from the leaders of major countries in the world. The United States’ appreciation for His Highness the Crown Prince comes within the framework of the American leadership’s appreciation for His Highness – may God protect him – and for the Kingdom’s political and economic standing, its weight, and its pivotal role at the international level, and the status that the Kingdom and its wise leadership – may God protect it – enjoy in the international community. Overall, the Kingdom’s efforts remain a significant and valuable feature at all levels, whether at the level of presence or influence, politically, economically, humanitarianly, or culturally, through its diverse efforts aimed at achieving prosperity, peace, and harmony, and expanding tolerance and cultural dialogue that is not based on narrow ideologies or biased calculations, whether in terms of race, identity, or otherwise, but rather aims for the good of humanity, its peace, and its well-being in all parts of the world.

    Lebanese President calls for halt to Israeli hostilities

    Lebanese President Joseph Aoun stressed on Wednesday the need for the sponsors of the ceasefire agreement with Israel to pressure it to abide by it, in order to preserve their credibility and halt hostilities. President Aoun said during his meeting with French presidential envoy Jean-Yves Le Drian: “Reforms are a priority, in parallel with the reconstruction of what was destroyed by Israel, and work will continue to restore confidence within Lebanon.” He added that the measures that will be taken at the administrative level carry a positive message to Lebanon both within and outside the country. According to a statement published by the Lebanese Presidency on its Facebook page, “The President of the Republic discussed with the French Presidential Envoy, Jean-Yves Le Drian, the atmosphere of his upcoming visit to France next Friday.” In addition, a visit scheduled for Wednesday by Lebanese Defense Minister Michel Menassa to Damascus to discuss border control between the two countries was postponed after clashes that resulted in deaths and injuries, according to a Lebanese official and a Syrian government source. The Lebanese official, who preferred to remain anonymous, confirmed, “We were informed that the Lebanese Defense Minister’s visit was postponed on Tuesday,” adding that the postponement came “based on coordination between the two sides and not because of a dispute or tension,” without specifying another date for the visit. A Syrian government source, for his part, said that the postponement was linked to “preparations in Syria to form a new government,” as Mansa Nazra was supposed to meet with the Syrian Minister of Defense, Murhaf Abu Qasra.

    The Kingdom condemns the Israeli occupation’s bombing of the Syrian town of Koya.

    The Ministry of Foreign Affairs expressed the Kingdom of Saudi Arabia’s strong condemnation and denunciation of the Israeli occupation forces’ bombing of the town of Koya in the sisterly Syrian Arab Republic, which resulted in the killing and wounding of dozens of innocent people. In a statement, it said: “The Kingdom reiterates its categorical rejection of the continued attempts by the Israeli occupation authorities to undermine the security and stability of Syria and the region through their blatant and repeated violations of relevant international laws. It expresses its solidarity with sisterly Syria in the face of this unjustified Israeli aggression, and stresses the need for the member states of the Security Council to play their role, stand firmly and seriously against these ongoing Israeli violations in Syria and the region, and activate international accountability mechanisms for them.”

    The Sudanese army takes control of Khartoum Airport and denies targeting civilians.

    A Sudanese military source said on Wednesday that the army had taken control of Khartoum Airport, which had been “fully secured,” two years after Rapid Support Forces were stationed there. The source, who requested anonymity, added that the army was besieging the Jebel Awliya area south of the capital from the north, south, and east. It is the last major stronghold of the Rapid Support Forces in the Khartoum area. This week, the Sudanese army launched a large-scale operation to expel the Rapid Support Forces, with whom it has been engaged in a devastating conflict since April 2023, from the government area in the center of the capital after seizing control of the Republican Palace and other vital facilities on Friday, including the Central Bank and the National Intelligence headquarters. On the other hand, the Emergency Lawyers group, which documents violations in the Sudanese war, accused the army on Tuesday of carrying out a bloody bombardment on northern Darfur, in a strike that may be among the deadliest since the conflict began two years ago. In a written message to Agence France-Presse via WhatsApp, army spokesman Nabil Abdullah described the claims as “incorrect.” He said, “We observe the rules of targeting in air strikes in accordance with international law, and we can never target innocent civilians.” Abdullah accused the Rapid Support Forces of targeting civilians “systematically and continuously… with artillery or missiles.”

    Gaza: A bloody massacre on the ninth day of the “genocide”

    Gaza – Nazir Taha

    For the ninth consecutive day, the Israeli occupation continues its war of genocide against the Gaza Strip, leaving hundreds of martyrs and thousands wounded after committing bloody massacres against them and violating the ceasefire agreement that entered into force on January 19. The death toll and injuries since March 18 have reached 730, and 1,367, according to a report by the Palestinian Ministry of Health. The death toll from the Israeli aggression has risen to 50,082 deaths and 113,408 injuries since October 7, 2023. The occupation continued its bombing and destruction of several areas in the Gaza Strip. At dawn on Wednesday, the occupation committed a bloody massacre after bombing a populated home belonging to the al-Najjar family on Old Gaza Street in Jabalia al-Balad, north of the Gaza Strip, resulting in the deaths of eight martyrs, including four children, and the injury of others. The occupation artillery shelled several locations in the Shuja’iyya neighborhood east of Gaza City, coinciding with the demolition of residential buildings in the village of Umm al-Nisr north of Gaza, and heavy gunfire from military vehicles stationed in the buffer zone. Over the past hours, the occupation has intensified gunfire towards citizens’ homes in the al-Zeitoun neighborhood southeast of Gaza City.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Surah Mai’da Tafseer by Syed Abu-al-Ala Maudoodi

    Surah Mai’da Tafseer by Syed Abu-al-Ala Maudoodi

    YouTube Link

    5-Surah Mai’da Tafseer
    https://www.youtube.com/watch?v=mmX–rt4Nok

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Surah Nisa Tafseer by Syed Abu-al-Ala Maudoodi

    Surah Nisa Tafseer by Syed Abu-al-Ala Maudoodi

    YouTube Link

    4-Surah Nisa Tafseer
    https://www.youtube.com/watch?v=-Mn48C_wTbg

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Surah Al-Imran Tafseer by Syed Abu-al-Ala Maudoodi

    Surah Al-Imran Tafseer by Syed Abu-al-Ala Maudoodi

    YouTube Link

    https://www.youtube.com/watch?v=XHbdbs5xeZg
    3-Surah Al-Imran Tafseer

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Surah Baqra Tafseer by Syed Abu-al-Ala Maudoodi

    Surah Baqra Tafseer by Syed Abu-al-Ala Maudoodi

    YouTube Video Link

    2-Surah Baqra Tafseer
    https://www.youtube.com/watch?v=L3btqFAHXlk

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Joseph The Prophet All Episodes

    Joseph The Prophet All Episodes

    Movie

    حضرت یوسف تمام ابواب | اردو ڈب | Urdu Dubbed | Joseph The Prophet All Episodes

    YouTube Movie Link

    https://www.youtube.com/watch?v=ZvBBKGKaaZE

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • How to Win Every Argument by Madsen Pirie

    How to Win Every Argument by Madsen Pirie

    This text is a table of contents and excerpts from Madsen Pirie’s book, “How to Win Every Argument.” The book provides a guide to winning arguments, including how to identify and use logical fallacies. It details numerous fallacies, offering explanations and examples of how each can be used to deceive or persuade. The excerpts showcase the diverse range of fallacies covered, illustrating their applications through various real-world scenarios. Pirie categorizes the fallacies and offers tips on their effective use. The book aims to be a practical guide for both identifying and deploying these fallacies in argumentation.

    Logical Fallacies Study Guide

    Quiz

    1. Explain the fallacy of accent and provide an example. The fallacy of accent occurs when the meaning of a statement is changed by emphasizing certain words or phrases. For example, “I didn’t say he stole the money,” changes the meaning depending on which word is accented, suggesting someone else may have said it, he did not steal the money, or he stole something else.
    2. Describe the fallacy of accident and why it is fallacious. The fallacy of accident assumes that the freak features of an exceptional case are enough to justify rejecting a general rule. This is fallacious because the exceptional features are not relevant to the general rule.
    3. What is the fallacy of affirming the consequent? Give an example. The fallacy of affirming the consequent occurs when one assumes the antecedent is true because the consequent is true. For instance: “If I drop an egg, it breaks. This egg is broken, so I must have dropped it,” which ignores other possibilities like someone else dropping it.
    4. Explain the fallacy of amphiboly and provide a sentence with this fallacy. Amphiboly is a fallacy of ambiguous construction where a statement can be interpreted in more than one way, usually due to careless grammar. An example would be, “The Duchess has a fine ship, but she has barnacles on her bottom.”
    5. What is the argumentum ad baculum and why is it a fallacy? The argumentum ad baculum is the fallacy of using force or threats, rather than reason, to persuade someone. It is a fallacy because it introduces irrelevant material, and force does not equate to truth.
    6. Describe the fallacy of bifurcation and provide an example. The fallacy of bifurcation falsely presents a situation as having only two options, when more possibilities exist. An example is: “Either we paint the door green, or we will be mocked and ridiculed,” which ignores other possible options.
    7. Explain the concept of a bogus dilemma. A bogus dilemma is a fallacy that presents a situation as a true dilemma when it is not. This occurs when one or both of the given consequences do not follow or when other choices are possible that were not included in the disjunct.
    8. What is a circulus in probando, and why is it a fallacy? A circulus in probando, or circular argument, is a fallacy in which the conclusion is assumed within the premise. This means that the argument provides no new information, and therefore, no new support for the conclusion.
    9. Describe the fallacy of complex question (plurium interrogationum) and provide an example. A complex question (plurium interrogationum) is a fallacy in which a question includes a hidden assumption that the answerer is forced to accept. An example would be, “Why did you make your wife alter her will in your favor?”, which assumes the will was altered in the first place.
    10. What is the conclusion that denies its premises and why is it fallacious? The conclusion that denies its premises occurs when an argument begins with certain premises but then reaches a conclusion that contradicts those original premises. This is fallacious because the conclusion is not consistent with the initial premises of the argument.

    Answer Key

    1. The fallacy of accent occurs when the meaning of a statement is changed by emphasizing certain words or phrases. For example, “I didn’t say he stole the money,” changes the meaning depending on which word is accented, suggesting someone else may have said it, he did not steal the money, or he stole something else.
    2. The fallacy of accident assumes that the freak features of an exceptional case are enough to justify rejecting a general rule. This is fallacious because the exceptional features are not relevant to the general rule.
    3. The fallacy of affirming the consequent occurs when one assumes the antecedent is true because the consequent is true. For instance: “If I drop an egg, it breaks. This egg is broken, so I must have dropped it,” which ignores other possibilities like someone else dropping it.
    4. Amphiboly is a fallacy of ambiguous construction where a statement can be interpreted in more than one way, usually due to careless grammar. An example would be, “The Duchess has a fine ship, but she has barnacles on her bottom.”
    5. The argumentum ad baculum is the fallacy of using force or threats, rather than reason, to persuade someone. It is a fallacy because it introduces irrelevant material, and force does not equate to truth.
    6. The fallacy of bifurcation falsely presents a situation as having only two options, when more possibilities exist. An example is: “Either we paint the door green, or we will be mocked and ridiculed,” which ignores other possible options.
    7. A bogus dilemma is a fallacy that presents a situation as a true dilemma when it is not. This occurs when one or both of the given consequences do not follow or when other choices are possible that were not included in the disjunct.
    8. A circulus in probando, or circular argument, is a fallacy in which the conclusion is assumed within the premise. This means that the argument provides no new information, and therefore, no new support for the conclusion.
    9. A complex question (plurium interrogationum) is a fallacy in which a question includes a hidden assumption that the answerer is forced to accept. An example would be, “Why did you make your wife alter her will in your favor?”, which assumes the will was altered in the first place.
    10. The conclusion that denies its premises occurs when an argument begins with certain premises but then reaches a conclusion that contradicts those original premises. This is fallacious because the conclusion is not consistent with the initial premises of the argument.

    Essay Questions

    1. Discuss the role of ambiguity in the commission of logical fallacies, drawing on examples from the text.
    2. Compare and contrast the various appeals to emotion in argumentation, such as argumentum ad misericordiam and argumentum ad populum, discussing their effectiveness and ethical implications.
    3. Analyze how fallacies of relevance, such as argumentum ad hominem and the genetic fallacy, can undermine constructive debate.
    4. Explain how a sophisticated understanding of logical fallacies can be utilized both to detect flawed reasoning and to construct more persuasive arguments.
    5. Discuss the relationship between logic and rhetoric and explain the ways in which logical fallacies are sometimes used to achieve rhetorical goals.

    Glossary of Key Terms

    • Fallacy: A flaw in reasoning or a mistaken belief that makes an argument invalid.
    • Accent (fallacy): Changing the meaning of a statement by emphasizing certain words or phrases.
    • Accident (fallacy): Applying a general rule to an exceptional case where it does not apply.
    • Affirming the Consequent: Assuming the antecedent is true because the consequent is true.
    • Amphiboly: Ambiguous construction of a statement due to faulty grammar.
    • Argumentum ad Baculum: Appealing to force or threats instead of reason.
    • Bifurcation: Falsely presenting a situation as having only two options.
    • Bogus Dilemma: Falsely presenting a situation as a true dilemma when it is not.
    • Circulus in Probando: Circular argument where the conclusion is assumed in the premise.
    • Complex Question (Plurium Interrogationum): A question that includes a hidden assumption.
    • Conclusion which Denies Premises: A conclusion that contradicts the initial premises of the argument.
    • Concealed Quantification: The ambiguity of expression which permits misunderstanding the quantity under discussion.
    • Contradictory Premises: Using statements as premises that are in direct contradiction of each other.
    • Dicto Simpliciter: Applying a general rule to a specific case without considering exceptions.
    • Division (fallacy): Assuming that what is true of a whole must be true of its parts.
    • Equivocation: Using a word in two different senses in the same argument.
    • Exclusive Premises: A syllogism with two negative premises.
    • Existential Fallacy: Assuming something exists based only on a general claim about a class of things.
    • Ex-Post-Facto Statistics: Drawing causal inferences based solely on the fact that events occur in sequence.
    • Extensional Pruning: retreating from the commonly accepted meaning of a word by insisting on a strictly literal definition.
    • False Conversion: Reversing the terms of a statement to arrive at a false conclusion.
    • False Precision: Using exact numbers for inexact concepts.
    • Genetic Fallacy: Judging the validity or truth of something solely based on its origin.
    • Half-Concealed Qualification: Minimizing limits within a claim.
    • Hedging: Using language that allows for a retreat in definitions later on.
    • Hominem (Circumstantial), Argumentum ad: Appealing to the specific circumstances of the person being argued with.
    • Ignorantiam, Argumentum ad: Arguing that something is true because it has not been proven false, or vice versa.
    • Lapidem, Argumentum ad: Ignoring the central claim of an argument altogether, refusing to discuss the main premise.
    • Loaded Words: Using biased or emotive language to sway opinion.
    • Misericordiam, Argumentum ad: Appealing to pity instead of reasoned discourse.
    • Modum, Argumentum ad: Appealing to gradualism or the desire for things to happen slowly.
    • Nauseam, Argumentum ad: Repeating a point of view without adding support or evidence.
    • Numeram, Argumentum ad: Appealing to the number of people who agree to a contention as justification.
    • Oversimplification: Only looking at one side of a complex issue when making a decision.
    • Petitio Principii: Assuming the conclusion in the premises (begging the question).
    • Poisoning the Well: Discrediting a person or source before they can make their argument.
    • Quaternio Terminorum: An argument with four terms when only three are needed for a valid syllogism.
    • Red Herring: Introducing an irrelevant issue to distract from the main point.
    • Reification: Treating an abstract concept as if it were a concrete thing.
    • Secundum Quid: Generalizing from a few instances or limited information.
    • Shifting Ground: Changing one’s position during an argument to avoid being defeated.
    • Slippery Slope: Assuming that a small action will inevitably lead to a series of increasingly worse consequences.
    • Straw Man: Misrepresenting an opponent’s argument to make it easier to refute.
    • Thatcher’s Blame: Blaming someone for all of the negative aspects of a situation.
    • Tu Quoque: Avoiding a point by pointing out hypocrisy in the arguer.
    • Unaccepted Enthymeme: An argument that is made with an unstated assumption that is not accepted.
    • Undistributed Middle: The middle term in a syllogism does not refer to the whole of its class.
    • Unobtainable Perfection: Rejecting a practical solution because it is not perfect.
    • Verecundiam, Argumentum ad: Appealing to false or irrelevant authority.
    • Wishful Thinking: Assuming that something is true because you want it to be true.

    How to Win Every Argument: A Guide to Logical Fallacies

    Okay, here’s a detailed briefing document based on the provided excerpts from “How to Win Every Argument,” focusing on the main themes, important ideas, and key quotes:

    Briefing Document: “How to Win Every Argument” by Madsen Pirie

    I. Core Theme: Recognizing and Utilizing Logical Fallacies

    The primary theme of this work is the identification and manipulation of logical fallacies in arguments. Pirie’s book serves as a guide to not only recognize flawed reasoning, but also to use these flaws for persuasive advantage. It’s a pragmatic, almost Machiavellian approach to argumentation, focusing on winning over truth or validity. This is not a book about logic per se, but rather how logic is commonly abused, and how to turn that abuse to one’s advantage.

    II. Key Concepts and Fallacies

    The document presents a broad range of logical fallacies, categorized for easier understanding and application. Here’s a breakdown of some of the most important ones with key ideas and quotes:

    • Accent: The meaning of a statement can be altered by emphasizing different words. This manipulation introduces unintended implications that are not part of the literal statement.
    • Quote: “Even with so simple a phrase, a changed accent can give a markedly changed meaning.”
    • Quote: “The fallacy lies with the additional implications introduced by emphasis. They form no part of the statement accepted, and have been brought in surreptitiously without supporting argument.”
    • Accident: An exceptional case is used to reject a general rule by supposing that a freak circumstance should invalidate the rule.
    • Quote: “The fallacy of accident supposes that the freak features of an exceptional case are enough to justify rejection of a general rule.”
    • Quote: “Almost every generalization could be objected to on the grounds that one could think of ‘accidental’ cases it did not cover.”
    • Affirming the Consequent: Assuming that if a consequence occurs, the antecedent must be true (an invalid form of modus ponens)
    • Quote: “If I drop an egg, it breaks. This egg is broken, so I must have dropped it.” (Fallacious)
    • Amphiboly: Ambiguous sentence construction resulting from careless grammar, where the meaning can be taken in more than one way.
    • Quote: “The Duchess has a fine ship, but she has barnacles on her bottom.”
    • Quote: “The fallacy is capable of infinite variation. Many excellent examples of amphiboly make use of the confused pronoun.”
    • Argumentum ad Baculum (Appeal to the Stick): Using force or threat to make people accept your conclusion instead of presenting logical reasoning.
    • Quote: “The fallacy of the argumentum ad baculum lies in its introduction of irrelevant material into the argument.”
    • Quote: “While force is undoubtedly effective sometimes in directing courteous attention to the speaker’s wishes, its use represents the breakdown and subversion of reason.”
    • Quote: “When Stalin says “dance!” a wise man dances.”
    • Bifurcation (False Dilemma): Presenting only two options when more exist, forcing a choice between unpleasant outcomes and your preferred one.
    • Quote: “The greatest use you can make of bifurcation is to offer a choice limited to something very unpleasant or the course you are advocating.”
    • Quote: “Either we paint the door green, or we will be mocked and ridiculed.”
    • Circulus in Demonstrando (Circular Argument): Using the conclusion as a premise to support the argument. The argument circles back on itself.
    • Quote: “It all comes down to saying that science gives us a consistent and useful look at the universe through the ring of a giant circulus.”
    • Quote: “‘I have the diamond, so I shall be leader.’ ‘Why should you get to keep the diamond?’ ‘Because I’m the leader, stupid.’ “
    • Complex Question (Plurium Interrogationum): Asking a question that assumes a fact not yet established, designed to trap the respondent.
    • Quote: “Even oldies such as ‘Who was the lady I saw you with last night?’ and ‘Why did the chicken cross the road?’ are, strictly speaking, examples of this fallacy. They preclude answers such as ‘There was none’, or ‘It didn’t.’ “
    • Concealed Quantification: Using ambiguous language to mislead about the quantity being discussed, often to make a weak case seem stronger.
    • Quote: “Very often the quantification is concealed because it sounds rather lame to make bold statements about some of a class. ‘All’ is generally preferred. “
    • Quote: “Garage mechanics are crooks.” (Without specifying all, some or most).
    • Conclusion Which Denies Premises: Contradicting your starting point with your conclusion.
    • Quote: “It starts by maintaining that certain things must be true, and ends up with a conclusion which flatly contradicts them.”
    • Quote: “He’s a real professional, but a bit of an amateur at times.”
    • Money as the Measure of Right: Asserting that wealth equates to correctness, which is not always true.
    • Quote: “Surely a man who can make £60 million in a year by recording four songs cannot be all wrong?”
    • Quote: “The customer is always right.” (Because they have money)
    • Redefinition: Changing the meaning of a word to suit one’s needs.
    • Quote: “When I use a word,’ Humpty Dumpty said in rather a scornful tone, ‘it means just what I choose it to mean – neither more nor less.”
    • Denying the Antecedent: Assuming that the non-occurrence of the antecedent means the non-occurrence of the consequent (invalid form of modus tollens).
    • Quote: “If I eat too much, I’ll be ill. Since I have not eaten too much, I will not be ill.”
    • Dicto Simpliciter (Sweeping Generalization): Applying a general rule to a specific situation without considering individual differences.
    • Quote: “Dicto simpliciter arises whenever individuals are made to conform to group patterns.”
    • Quote: “Spinach is good for growing children. Eat it up.”
    • Division: Assuming that what’s true of a whole is true of its parts.
    • Quote: “The Icelanders are the oldest nation on earth. This means that Bjork must be older than other pop stars.”
    • Quote: “The French are tops at rugby; Marcel is French; obviously he must be tops at rugby.”
    • Emotional Appeal: Using emotions rather than reason to persuade, such as appeals to pity or fear.
    • Quote: “Whether your appeal is to fear, envy, hatred, pride or superstition makes no difference.”
    • The Exception That Proves the Rule: Misunderstanding the original meaning of ‘prove’ as ‘test’, and incorrectly using an exception to strengthen the rule rather than weaken it.
    • Quote: “That’s the exception that proves the rule.” (Often used incorrectly).
    • Exclusive Premises: In a syllogism, using two negative premises which prevents drawing a valid conclusion.
    • Quote: “No handymen are bakers, and no bakers are fishermen, so no handymen are fishermen.”
    • Existential Fallacy: Incorrectly assuming the existence of things from a universal statement about them.
    • Quote: “Use of the existential fallacy is surprisingly easy. Most audiences will respect your modest claims if you move down from assertions about all things to claims made for only some of them.”
    • Ex-Post-Facto Statistics: Using statistics to create a causal relationship after the fact.
    • Quote: “I believe I was meant to get this job. I saw the advertisement for it in a paper the wind blew against my face in Oxford Street. I feel that something put me in that place at that time so that I would get this job.”
    • Extensional Pruning: Using words in their common usage, then retreating to a narrow definition when challenged.
    • Quote: “We are guilty of extensional pruning if we use words in their commonly accepted meaning, but retreat when challenged into a strictly literal definition.”
    • Quote: “/ said I’d get you another drink if I was wrong: water is another drink.”
    • False Conversion: Illegitimately reversing subject and predicate in a sentence, assuming “all As are B” implies “all Bs are A.”
    • Quote: “The claim that ‘Texas rabbits are animals which grow to more than a metre long’ is skilfully ambiguous. It is not clear whether it refers to some Texas rabbits or all of them. Your surreptitious false conversion would then leave your audience convinced that any animal in Texas more than a metre in length must be a rabbit.”
    • False Precision: Using exact numbers with inexact notions to create a false sense of accuracy.
    • Genetic Fallacy: Dismissing something based on its origins or associations, instead of the merits of the idea.
    • Quote: “The objections to the Council’s new bus timetable come only from private property developers, and can be ignored.”
    • Quote: “Tinkering with genes is fascist talk. That’s what Hitler tried to do.”
    • Half-Concealed Qualification: Minimizing limiting qualifications so they are not emphasized.
    • Quote: “Practically every single case of monetary expansion is followed within 16 months by an attendant general price rise of the same proportions.”
    • Hedging: Using ambiguous language to allow for a change in definition to avoid challenges.
    • Quote: “Hedging involves the advance preparation for a definitional retreat.”
    • Quote: “All I said was that I’d be home at a reasonable hour. I think that three o’clock in the morning is a reasonable hour in view of what I’ve been doing.”
    • Hominem (Circumstantial), Argumentum ad: Rejecting a claim based on the speaker’s specific circumstances and interests, rather than their arguments.
    • Quote: “You can’t accept the legitimacy of lending for profit. You are a Christian, and Christ drove the money-lenders from the temple.”
    • Quote: “Well he would say that, wouldn’t he?”
    • Ignorantiam, argumentum ad: Asserting something is true because it has not been proven false, and vice versa.
    • Illicit Process: Drawing conclusions that improperly extend beyond a specific group in a premise, by assuming that a term has been distributed when it has not.
    • Irrelevant Humour: Using jokes to divert attention and avoid addressing the core arguments.
    • Lapidem, Argumentum ad: Refusing to discuss an argument’s central claim, simply dismissing it without engaging with the evidence.
    • Quote: “He’s a friend of mine. I won’t hear a word spoken against him.”
    • Loaded Words: Using words with emotional connotations to influence an audience.
    • Quote: “HITLER SUMMONS WAR LORDS! M.DALADIER CONSULTS DEFENCE CHIEFS”
    • Miserkordiam, argumentum ad: Appealing to pity instead of reason.
    • Quote: “In asking yourself if this man is to be convicted, ask yourself what it will mean for him to be locked up in prison…”
    • Modum, Argumentum ad: Appealing to the audience’s desire for gradual change and rejecting sudden moves.
    • Nauseam, Argumentum ad: Trying to win an argument simply by repeating the claim.
    • Quote: “Just the place for a Snark! I have said it thrice; what I tell you three times is true.”
    • Numeram, argumentum ad: Appealing to popularity or consensus to claim that something is true.
    • Quote: “Everybody’s smoking Whifters, why don’t you?”
    • One-Sided Assessment: Looking only at one side of an issue, either the positives or the negatives, not both.
    • Petitio Principii (Begging the Question): Assuming the conclusion in the premises.
    • Poisoning the Well: Damaging an opponent’s credibility to make the audience reject their claims.
    • Quote: “They have been trying that in Sweden since 1955, and look what’s happened: suicides, moral degeneracy and drunks everywhere. Do we want that here?”
    • Quaternio Terminorum: Using a four-term argument, where a middle term changes and does not link the two premises.
    • Red Herring: Introducing irrelevant information to distract from the main argument.
    • Quote: “‘You never remember my birthday.’ ‘Did I ever tell you what beautiful eyes you have?’ “
    • Secundum Quid (Hasty Generalization): Drawing a conclusion from too few cases or unrepresentative examples.
    • Shifting Ground: Rapidly changing the subject or the definition of key terms in an argument to escape scrutiny.
    • Slippery Slope: Arguing that an initial action will inevitably lead to a series of negative consequences.
    • Special Pleading: Asserting exceptions for yourself that you would not grant to others.
    • Thatcher’s Blame: Blaming a prominent figure for problems in an argument.
    • Tu Quoque: Rejecting an argument because the person making it is inconsistent, hypocritical.
    • Quote: “Holier-than-thou.”
    • Unaccepted Enthymemes: Using an argument that depends on an unstated assumption that is not accepted by the other party.
    • Undistributed Middle: In a syllogism, using a middle term that is not universal or distributed.
    • Unobtainable Perfection: Rejecting a solution because it is not absolutely perfect.
    • Verecundiam, argumentum ad: Appealing to false authority to support your claim.
    • Quote: “The winning of an Oscar for excellence in motion pictures is widely recognized as a qualification to speak on such matters as world poverty and American foreign policy.”
    • Wishful Thinking: Basing beliefs on what one wishes were true rather than on evidence.

    III. Pragmatic Use of Fallacies

    Pirie isn’t just describing fallacies. He is showing you how to use them in your own arguments. His approach is cynical, suggesting that one can often win by manipulating logic rather than by being logically correct. The text provides numerous examples, not only of flawed reasoning but also of how these flaws can be employed to your advantage in various scenarios from public speaking to everyday conversations.

    IV. Implications and Application

    • Critical Thinking: The book serves as a practical guide to critical thinking, helping the reader become a more discerning evaluator of arguments.
    • Persuasion: The guide provides tools to not only dismantle poor arguments but to construct persuasive ones based on the flawed logic of others, a manipulative but potent tactic.
    • Rhetorical Skill: By identifying and understanding these fallacies, readers can become more persuasive and articulate speakers or writers.
    • Recognizing Manipulation: The book is a defense against being manipulated by others, as it highlights how fallacies are often used to sway opinions.

    V. Caveats

    While Pirie’s guide is insightful, it is important to note that the book’s focus is on winning rather than on seeking truth. This cynical stance may be considered unethical or manipulative by some. A responsible approach would use this knowledge to understand the flaws in others’ arguments, and in one’s own, but also to strive to engage in more logically sound and ethical debates.

    Let me know if you have any more questions!

    Logical Fallacies: Unveiling Faulty Arguments

    How can the way words are emphasized change their meaning in an argument?

    The fallacy of accent demonstrates how altering the stress on specific words or phrases can drastically shift a statement’s meaning. For example, “Light your cigarette” can be an instruction, a suggestion to light it instead of something else, a way to differentiate who lights their cigarette, or an admonition not to use it for another purpose, just by accenting different words. These shifts bring additional, unauthorized implications into the argument that aren’t supported by the original statement.

    What is the ‘fallacy of accident’ and how does it affect attempts to create general rules or definitions?

    The fallacy of accident occurs when the exceptional or freak features of a case are used to reject a general rule. It ignores the fact that some cases may be unusual and allowable exceptions, not invalidating the rule itself. The fallacy targets attempts at universality, where one tries to establish watertight definitions for things like ‘truth’ or ‘justice.’ Opponents exploit this by constantly presenting ‘accidental’ cases that are clearly exceptions, thereby undermining the general statement.

    What are some common errors people make with ‘if…then’ statements?

    The error with ‘if…then’ statements can occur when one affirms the consequent (the “then” part) or denies the antecedent (the “if” part). For example, the statement “If I drop an egg, it breaks” is valid if you say “I dropped the egg, so it broke” (affirming the antecedent). However, it is fallacious to say “The egg is broken, so I must have dropped it” (affirming the consequent) because there could be other reasons for the egg being broken. Similarly, “Since I have not eaten too much, I will not be ill” is fallacious because other things can cause illness.

    What are ‘amphiboly’ and ‘bifurcation’ and how are they used to create faulty arguments?

    Amphiboly is the fallacy of ambiguous construction, where the whole meaning of a statement is unclear, often due to poor grammar or pronoun use. For example, “I met the ambassador riding his horse. He was snorting and steaming…” it is not clear if ‘he’ refers to the ambassador or the horse. Bifurcation, on the other hand, is the presentation of only two options, as if they are the only possibilities. This “false dilemma” often ignores or conceals other viable options. For example “If we import goods, we send our jobs abroad; if we export goods, we send our property abroad.” ignoring that you can do both, or neither.

    What is ‘argumentum ad baculum’ and why is it considered a breakdown of reason?

    The argumentum ad baculum is a fallacy that uses force or threat instead of reason to persuade. Instead of providing evidence to support a claim, the arguer resorts to intimidation or coercion to force compliance. While it can be effective in achieving a desired action, it represents a complete breakdown of logical discussion and an abandonment of rational discourse, replacing it with power.

    How does the fallacy of ‘dicto simpliciter’ work, and how is it used to manipulate others?

    Dicto simpliciter arises when we apply a general rule or characteristic to an individual within a group, without accounting for individual differences. It’s a move to make individuals conform to group patterns, failing to permit for individual qualities. For instance, “All teenagers are rebellious. Since he’s a teenager, he must be rebellious too”, ignores that not all teenagers are rebellious. This fallacy is used to place people into stereotypical molds, using group membership to make assumptions about individuals.

    What is ‘petitio principii’, and what are some ways it can be disguised in an argument?

    Petitio principii, also known as “begging the question,” is the fallacy of assuming the conclusion in the premises of an argument. In other words, the argument uses the very point it’s trying to prove as evidence for itself, creating a circular and uninformative argument. It is often disguised through skillful word choice, using words with hidden assumptions built into them, like “purpose” or “promise”, giving the appearance of a valid argument when the core claim is just restating the conclusion.

    What is the role of emotional manipulation in fallacious arguments?

    Fallacious arguments often exploit emotions like pity, fear, or envy to bypass rational analysis. Appeals to emotion divert attention from the lack of evidence or logic. Instead of relying on reason, the arguer uses emotional manipulation to gain acceptance for their position. For example, an argumentum ad misericordiam appeals to pity, such as asking “how can we not hire Jeeves, imagine his wife and children this christmas?”. It is not a valid argument for hiring the groundskeeper if they are not the best candidate for the job. Other fallacies appeal to a desire for gradualism (ad modum), or the desire to support popular ideas (ad populum) all bypassing reason and making faulty arguments.

    How to Win Every Argument: Fallacies & Rhetoric

    Okay, here is the detailed timeline and cast of characters based on the provided text from “How to Win Every Argument”:

    Timeline of Main Events

    This source is not a historical text but rather a guide to logical fallacies and argumentation. Therefore, the “events” are primarily the examples of fallacies, illustrative scenarios, and the development of ideas about rhetoric and logic. Here’s a thematic breakdown of the “events” discussed:

    • Ancient Philosophers’ Pursuit of Truth & Justice: The text references Plato’s search for justice and his engagement with arguments that attempt to challenge universal truths. John Stuart Mill’s efforts to justify liberty are also mentioned, highlighting historical attempts to define these abstract concepts and the fallacies that can undermine those efforts.
    • The Development of Formal Logic & Argumentation: The text details various logical fallacies, such as Affirming the Consequent, Denying the Antecedent, Undistributed Middle, Exclusive Premises, and Quaternio Terminorum, which represent centuries of formalized study and thought on how people can misuse logic when making arguments.
    • Examples from History and Culture: The book is filled with examples of fallacies being employed:
    • Croesus and the Oracle’s ambiguous prophecy.
    • Lord Nelson’s famous cry “Westminster Abbey or victory” as an example of bifurcation.
    • Stalin’s use of the argumentum ad baculum, his question about the Pope’s divisions.
    • Sir William Browne’s accusation of political opponents using ad baculum diplomacy.
    • Examples of fallacious arguments from politics, marketing, and everyday life are used to illustrate the different kinds of fallacies.
    • Dr. Johnson’s argumentum ad lapidem, or refusal to discuss the merits of an argument.
    • George Bernard Shaw’s engagement with a woman in a discussion of principle and price.
    • Margaret Thatcher is discussed as an example of how people are blamed or targeted for any and all societal issues.
    • Fallacious Practices in Different Contexts: The book shows how fallacies occur in different areas like:
    • Politics and Diplomacy: Countries using threats (ad baculum), political arguments with misinterpretations of data, and politicians hedging their statements.
    • Marketing: Presenting statistical information that misleads, using loaded words, and appealing to popular opinion (ad populum)
    • Everyday Life: Misusing language through accent and ambiguity, using ad misericordiam or ad hominem arguments, committing hasty generalization or division, and using red herrings to distract.
    • Contemporary Language and Logical Confusion: The text also provides some examples that reference popular culture and recent history, implying a modern awareness of these types of arguments:
    • Examples using sports, pop culture, and technology to explain the fallacies.
    • Use of economic theory to discuss fallacious arguments used in economics, like the National Plan’s conclusions based on flawed aggregation of data, or how economists engage in hedging.
    • Examples of linguistic analysis are used to show how arguments can be undermined.
    • The text includes examples of how government can manipulate language for political purposes.

    Cast of Characters (with brief bios):

    Note: Most of these “characters” are either historical figures, hypothetical people used as examples, or types of people, rather than full biographical individuals.

    • Madsen Pirie: (Author) The author of “How to Win Every Argument.” A writer who has expertise in logic, argumentation, and the use of rhetoric. This is all that can be derived from the document itself.
    • Thomas, Samuel, and Rosalind: (Dedicatees) Named by Pirie as recipients of the book’s dedication.
    • Eamonn Butler and John O’Sullivan: (Acknowledgments) Acknowledged by Pirie for helpful suggestions related to his work, these appear to be colleagues, or friends, in the field of study.
    • Tom Lees, Steve Masty, Sam Nguyen, and Xander Stephenson: (Acknowledgments) Acknowledged for assistance with the book’s preparation. These appear to be editors, researchers, or assistants.
    • Plato: (Philosopher) Ancient Greek philosopher whose writings are referenced to illustrate the challenge of defining abstract concepts like justice. He appears here primarily to be discussed in the context of his failed attempts to do that.
    • John Stuart Mill: (Philosopher) 19th-century British philosopher and economist, mentioned in the text as an example of someone who struggled to justify liberty and frequently encountered objections.
    • Croesus: (Historical Figure) The King of Lydia who famously consulted the Oracle of Delphi; mentioned in the book as an example of the fallacy of amphiboly (ambiguous construction).
    • Lord Nelson: (Historical Figure) British Admiral remembered for his naval victories. He is referenced here as a maker of an example of the fallacy of bifurcation with his famous statement.
    • Joseph Stalin: (Historical Figure) The former dictator of the Soviet Union, used as an example of the use of argumentum ad baculum, or the appeal to force.
    • Nikita Krushchev: (Historical Figure) Former Soviet Premier who made an important observation on Stalin’s use of the ad baculum.
    • Pope: (Historical Figure) The Pope is referenced as a person who lacks military divisions when Stalin asked, “How many divisions has the Pope?”
    • Sir William Browne: (Historical Figure) Described as an idealist who accused his political opponents of using ad baculum diplomacy.
    • Lord Denning: (Legal Figure) A famous English judge mentioned in relation to the use of loaded words in legal settings. This is not directly attributed to Lord Denning, but only used as an example of a type of strategy.
    • Adolf Hitler: (Historical Figure) The dictator of Nazi Germany used as a symbol of evil who used genetic fallacies for nefarious purposes.
    • Genghis Khan & Attila the Hun: (Historical Figures) Both notorious for their brutality, these figures are mentioned as similar to Hitler for the purpose of the genetic fallacy.
    • Princess Diana: (Historical Figure) She is paired with Mary Poppins as an example of false appeal to sentiment.
    • Mary Poppins: (Fictional Character) Paired with Princess Diana as an example of false appeal to sentiment.
    • Humpty Dumpty: (Fictional Character) A character in Through the Looking-Glass by Lewis Carrol, quoted by Pirie as an example of a person redefining words to mean what they want.
    • Dr. Johnson: (Historical Figure) Well-known English writer and lexicographer; in this text, he’s cited as the originator of the argumentum ad lapidem.
    • George Bernard Shaw: (Historical Figure) The Irish playwright is mentioned in a dialogue designed to explain the fallacy of the slippery slope.
    • Margaret Thatcher: (Historical Figure) Former Prime Minister of the UK, used as an example of the “Thatcher’s blame” fallacy where people are blamed for everything.
    • Bill: (Hypothetical Person) Used in the example of the fallacy of unaccepted enthymeme.
    • Flight-Lieutenant Robinson: (Hypothetical Person) Used as an example in the fallacy of Division.
    • Various Hypothetical People: The text also includes many other hypothetical people used to illustrate the various fallacies, such as: the man who lends weapons, the duchess with barnacles, the person making a will, and various others. These people are more like “roles” within a hypothetical situation rather than fully-fleshed out characters, and there is no information available about them beyond that.

    This timeline and cast provide a framework for understanding the themes of argument and logic explored in the text. Let me know if you need any more information.

    Logical Fallacies: A Practical Guide

    Winning arguments is based on sound reasoning, which is undermined by logical fallacies [1]. Fallacies can be used to deceive, but identifying them can be a source of pleasure [1]. A practical guide to winning arguments involves learning how to recognize and use fallacies, and how to defend against them [2-4]. The book lists fallacies alphabetically, but they can be classified into five major types [5, 6]:

    • Formal Fallacies: These have errors in the structure of the logic [6].
    • Informal Fallacies of Relevance (Omission): These fallacies omit relevant material [7].
    • Informal Fallacies of Relevance (Intrusion): These fallacies bring in irrelevant material [8, 9].
    • Informal Fallacies of Relevance (Presumption): These fallacies rely on unwarranted assumptions [9, 10].

    Some Specific Fallacies

    • Abusive Analogy: This fallacy uses comparisons that are offensive or invite abuse [4, 11].
    • Accent: This fallacy changes the meaning of a phrase by emphasizing certain words [12-16].
    • Amphiboly: This fallacy uses ambiguous grammatical structures to create confusion [17].
    • Analogical Fallacy: This fallacy assumes that things similar in one respect are similar in others [18, 19].
    • Argumentum ad Antiquitam: This fallacy equates older with better [20, 21].
    • Apriorism: This fallacy uses a preconceived judgment against the evidence [22-25].
    • Argumentum ad Baculum: This fallacy uses force or threats to persuade [25-30].
    • Bifurcation: This fallacy limits choices, denying extra options [30-32].
    • Blinding with Science: This fallacy uses technical jargon to impress rather than clarify [33-35].
    • Bogus Dilemma: This fallacy presents a false choice between two alternatives [36-39].
    • Circulus in Probando: This fallacy uses circular reasoning [40-43].
    • Complex Question: This fallacy combines several questions into one [44].
    • Composition: This fallacy assumes that what is true of the parts is true of the whole [45, 46].
    • Concealed Quantification: This fallacy uses vague language to make a weak case stronger [46, 47].
    • Argumentum ad Crumenam: This fallacy assumes money is a measure of correctness [47-51].
    • Damning the Alternatives: This fallacy argues for one option by denigrating the others [52-56].
    • Definitional Retreat: This fallacy changes the meaning of a word to avoid refutation [57-59].
    • Denying the Antecedent: This fallacy rejects a conclusion because the premise is not met [60].
    • Dicto Simpliciter: This fallacy makes sweeping generalizations [60, 61].
    • Division: This fallacy assumes that what is true of the whole is true of the parts [61, 62].
    • Emotional Appeals: These fallacies use emotions instead of reason [63-68].
    • Equivocation: This fallacy uses a word with different meanings in an argument [68-72].
    • Every Schoolboy Knows: This fallacy assumes that a claim is true because it is supposedly common knowledge [72-75].
    • The Exception that Proves the Rule: This fallacy uses an exception to justify a rule [76-78].
    • Exclusive Premises: This fallacy draws a conclusion from two negative premises [78-80].
    • Existential Fallacy: This fallacy makes claims about all members of a class, without knowing if the class exists [80, 81].
    • Ex-post-facto Statistics: This fallacy uses statistics after the fact to support a claim [81, 82].
    • Extensional Pruning: This fallacy limits the meaning of a statement after the fact [82-84].
    • False Precision: This fallacy uses unjustified precision to give more confidence in assertions [84-86].
    • The Gambler’s Fallacy: This fallacy assumes past events influence future independent events [86, 87].
    • The Genetic Fallacy: This fallacy dismisses an argument based on its source [88-90].
    • Half-Concealed Qualification: This fallacy makes a restricted claim while discussing it as a general claim [90-92].
    • Hedging: This fallacy uses ambiguous language to change the meaning later [93-95].
    • Argumentum ad Hominem (Abusive): This fallacy attacks the arguer instead of the argument [95-102].
    • Argumentum ad Hominem (Circumstantial): This fallacy appeals to the arguer’s circumstances instead of evidence [102-106].
    • Ignorantiam, Argumentum ad: This fallacy argues a claim is true because it hasn’t been proven false [70, 73, 105, 107].
    • Ignoratio Elenchi: This fallacy proves a conclusion that is not relevant to the argument [106-109].
    • Illicit Process: This fallacy draws a conclusion that is not justified by the premises [107, 110-112].
    • Irrelevant Humor: This fallacy uses humor to divert attention from the argument [107, 112-117].
    • Argumentum ad Lapidem: This fallacy dismisses an argument without discussion [107, 117-121].
    • Argumentum ad Lazarum: This fallacy assumes the poor are more virtuous or correct [107, 121-123].
    • Loaded Words: This fallacy uses biased language to influence attitudes [107, 123-129].
    • Argumentum ad Misericordiam: This fallacy uses pity instead of reason [107, 129-133].
    • Argumentum ad Nauseam: This fallacy uses constant repetition to make a claim seem true [107, 133-137].
    • Non-Anticipation: This fallacy rejects a new idea because it hasn’t been anticipated [107, 137-140].
    • Argumentum ad Novitam: This fallacy assumes new is better [107, 140-146].
    • Argumentum ad Numeram: This fallacy equates popular support with correctness [107, 146-152].
    • One-Sided Assessment: This fallacy only considers one side of an issue [107, 152-157].
    • Petitio Principii: This fallacy assumes the conclusion in the premise [107, 157-162].
    • Poisoning the Well: This fallacy discredits the opposition before they speak [162-167].
    • Argumentum ad Populum: This fallacy appeals to popular attitudes instead of presenting evidence [163, 167-170].
    • Positive Conclusion from Negative Premise: This fallacy draws a positive conclusion from a negative premise [163].
    • Post Hoc Ergo Propter Hoc: This fallacy assumes that because one event follows another, the first caused the second [163, 170, 171].
    • Quaternio Terminorum: This fallacy is caused by using four terms in a three-line argument [163].
    • The Red Herring: This fallacy introduces irrelevant information to divert attention [163, 172-175].
    • Refuting the Example: This fallacy discredits an argument by discrediting the example [163, 175-180].
    • Reification: This fallacy treats abstract concepts as concrete things [163, 180-182].
    • The Runaway Train: This fallacy pushes a general argument to an absurd conclusion [163, 182-185].
    • Secundum Quid: This fallacy makes a hasty generalization [163, 185, 186].
    • Shifting Ground: This fallacy changes the substance of an argument while claiming continuity [163, 186-189].
    • Shifting the Burden of Proof: This fallacy requires the opponent to disprove a claim [163, 189, 190].
    • The Slippery Slope: This fallacy assumes an initial action will lead to a series of increasingly negative events [163].
    • Special Pleading: This fallacy makes an exception for a particular case without justification [163, 191-193].
    • The Straw Man: This fallacy misrepresents an opponent’s position to make it easier to attack [163, 193, 194].
    • Argumentum ad Temperantiam: This fallacy assumes the moderate view is always correct [163, 194-202].
    • Thatcher’s Blame: This fallacy blames an individual for any outcome, regardless of its nature [163, 203-205].
    • Trivial Objections: This fallacy opposes a claim based on minor aspects [163, 205-207].
    • Tu Quoque: This fallacy dismisses an argument because the arguer is inconsistent [207-211].
    • Unaccepted Enthymemes: This fallacy omits an important element of the argument [208, 211, 212].
    • The Undistributed Middle: This fallacy draws a conclusion that does not follow from the premises because the middle term is not distributed [208, 212-216].
    • Unobtainable Perfection: This fallacy rejects an option because it is not perfect [208, 216-218].
    • Argumentum ad Verecundiam: This fallacy uses false authority [208, 218-223].
    • Wishful Thinking: This fallacy accepts or rejects a claim based on what one wants to be true [6, 208, 223, 224].

    By understanding these fallacies, one can improve their ability to argue effectively and avoid being deceived [1, 3, 4].

    Logical Fallacies: A Compendium

    Logical fallacies are flaws in reasoning that can undermine arguments [1]. They can be used intentionally to deceive, or may be committed unintentionally due to ignorance of logical reasoning, the nature of evidence, or what counts as relevant material [2, 3]. Understanding fallacies is useful for both defending against them and using them effectively [1, 4].

    Types of Fallacies

    The sources categorize fallacies into five main types [5-7]:

    • Formal Fallacies: These involve errors in the structure of an argument [6, 7]. The logic itself is defective [8]. Examples include affirming the consequent, denying the antecedent, the undistributed middle, and quaternio terminorum [7, 9].
    • Informal Fallacies of Relevance (Omission): These occur when relevant information is left out [10]. Examples include the bogus dilemma, definitional retreat, and shifting the burden of proof [9, 10].
    • Informal Fallacies of Relevance (Intrusion): These involve the introduction of irrelevant material into an argument [11]. Examples include emotional appeals, argumentum ad hominem, and the red herring [9, 11].
    • Informal Fallacies of Relevance (Presumption): These fallacies are based on unwarranted assumptions [12]. Examples include the analogical fallacy, petitio principii, and post hoc ergo propter hoc [9, 12].
    • Informal Linguistic Fallacies: These use ambiguities of language to admit error [8, 10]. Examples include accent, amphiboly, and equivocation [9, 10].

    Specific Fallacies

    The sources provide an extensive list of specific fallacies, including:

    • Abusive Analogy: Using a comparison that is intended to be offensive or abusive [4, 13].
    • Accent: Changing the meaning of a statement by emphasizing different words [14, 15].
    • Accident: Applying a general rule to an exceptional case [16].
    • Affirming the Consequent: Assuming that if the consequent is true, the antecedent must also be true [17, 18].
    • Amphiboly: Using an ambiguous grammatical construction [19].
    • Analogical Fallacy: Assuming that things similar in one way are similar in other ways [20].
    • Argumentum ad Antiquitam: Assuming older is better [21, 22].
    • Apriorism: Using a preconceived judgment against the evidence [23].
    • Argumentum ad Baculum: Using force or threats to persuade [24].
    • Bifurcation: Presenting only two alternatives when more exist [25].
    • Blinding with Science: Using jargon to impress rather than clarify [26].
    • Bogus Dilemma: Presenting a false choice between two alternatives [27, 28].
    • Circulus in Probando: Using circular reasoning [29].
    • Complex Question (Plurium Interrogationum): Combining several questions into one [30].
    • Composition: Assuming that what is true of the parts is true of the whole [8, 9].
    • Concealed Quantification: Using vague language to make a weak case stronger [9, 31].
    • Argumentum ad Crumenam: Assuming money is a measure of correctness [9, 32].
    • Cum hoc ergo propter hoc: Assuming that because two events occur simultaneously, one causes the other [33].
    • Damning the Alternatives: Arguing for one option by denigrating the others [34].
    • Definitional Retreat: Changing the meaning of a word to avoid refutation [35].
    • Denying the Antecedent: Rejecting a conclusion because the premise is not met [36, 37].
    • Dicto Simpliciter: Making a sweeping generalization [38].
    • Division: Assuming that what is true of the whole is true of the parts [8, 9].
    • Emotional Appeals: Using emotions instead of reason [9, 39].
    • Equivocation: Using a word with different meanings in an argument [40].
    • Every Schoolboy Knows: Assuming a claim is true because it is supposedly common knowledge [41].
    • The Exception that Proves the Rule: Using an exception to justify a rule [42, 43].
    • Exclusive Premises: Drawing a conclusion from two negative premises [44].
    • Existential Fallacy: Making claims about all members of a class without knowing if the class exists [45].
    • Ex-post-facto Statistics: Applying probability laws to past events [46].
    • Extensional Pruning: Using a restricted definition after the fact to escape weakness in position [47, 48].
    • False Conversion: Invalidly converting a statement by exchanging the subject and predicate [49, 50].
    • False Precision: Using unjustified precision to give more confidence in assertions [51].
    • The Gambler’s Fallacy: Assuming past events influence future independent events [52].
    • The Genetic Fallacy: Dismissing an argument based on its source [53].
    • Half-Concealed Qualification: Making a restricted claim while discussing it as a general claim [31].
    • Hedging: Using ambiguous language to change the meaning later [54].
    • Argumentum ad Hominem (Abusive): Attacking the arguer instead of the argument [54].
    • Argumentum ad Hominem (Circumstantial): Appealing to the arguer’s circumstances instead of evidence [55].
    • Argumentum ad Ignorantiam: Arguing a claim is true because it hasn’t been proven false [56].
    • Ignoratio Elenchi: Proving a conclusion that is not relevant to the argument [57].
    • Illicit Process: Drawing a conclusion that is not justified by the premises [57, 58].
    • Irrelevant Humor: Using humor to divert attention from the argument [59, 60].
    • Argumentum ad Lapidem: Dismissing an argument without discussion [61].
    • Argumentum ad Lazarum: Assuming the poor are more virtuous or correct [62].
    • Loaded Words: Using biased language to influence attitudes [63].
    • Argumentum ad Misericordiam: Using pity instead of reason [64].
    • Argumentum ad Nauseam: Using constant repetition to make a claim seem true [65].
    • Non-Anticipation: Rejecting a new idea because it hasn’t been anticipated [66].
    • Argumentum ad Novitam: Assuming new is better [67].
    • Argumentum ad Numeram: Equating popular support with correctness [68].
    • One-Sided Assessment: Only considering one side of an issue [69].
    • Petitio Principii: Assuming the conclusion in the premise (begging the question) [70, 71].
    • Poisoning the Well: Discrediting the opposition before they speak [72].
    • Argumentum ad Populum: Appealing to popular attitudes instead of presenting evidence [73].
    • Positive Conclusion from Negative Premise: Drawing a positive conclusion from a negative premise [74].
    • Post Hoc Ergo Propter Hoc: Assuming that because one event follows another, the first caused the second [75].
    • Quaternio Terminorum: Using four terms in a three-line argument [76].
    • The Red Herring: Introducing irrelevant information to divert attention [77].
    • Refuting the Example: Discrediting an argument by discrediting the example [78].
    • Reification: Treating abstract concepts as concrete things [79].
    • The Runaway Train: Pushing a general argument to an absurd conclusion [80].
    • Secundum Quid: Making a hasty generalization [81].
    • Shifting Ground: Changing the substance of an argument while claiming continuity [82].
    • Shifting the Burden of Proof: Requiring the opponent to disprove a claim [83].
    • The Slippery Slope: Assuming an initial action will lead to a series of increasingly negative events [84].
    • Special Pleading: Making an exception for a particular case without justification [85].
    • The Straw Man: Misrepresenting an opponent’s position to make it easier to attack [86].
    • Argumentum ad Temperantiam: Assuming the moderate view is always correct [87].
    • Thatcher’s Blame: Blaming an individual for any outcome, regardless of its nature [88].
    • Trivial Objections: Opposing a claim based on minor aspects [89].
    • Tu Quoque: Dismissing an argument because the arguer is inconsistent [90].
    • Unaccepted Enthymemes: Omitting an important element of the argument [91].
    • The Undistributed Middle: Drawing a conclusion that does not follow from the premises because the middle term is not distributed [92].
    • Unobtainable Perfection: Rejecting an option because it is not perfect [93].
    • Argumentum ad Verecundiam: Using false authority [94].
    • Wishful Thinking: Accepting or rejecting a claim based on what one wants to be true [95].

    By recognizing these fallacies, you can enhance your ability to construct sound arguments and to identify weaknesses in the arguments of others [1, 4]. The sources emphasize that learning to use these fallacies can also help build an immunity to them [96].

    Sound Reasoning and Logical Fallacies

    The sources describe a variety of argument techniques, both sound and fallacious, that can be used to persuade others, and also to defend against manipulation. Many of these techniques involve the use of logical fallacies, which are flaws in reasoning that can undermine the validity of an argument [1].

    Here’s a breakdown of argument techniques, as discussed in the sources:

    1. Sound Reasoning:

    • The foundation of winning an argument is sound reasoning [1].
    • This involves constructing arguments that are logically valid and supported by relevant evidence [1].

    2. Logical Fallacies:

    • Logical fallacies are flaws in reasoning that can make an argument invalid [1]. They can be used to persuade or deceive, intentionally or unintentionally [1].
    • The sources categorize fallacies into five major types [2]:
    • Formal Fallacies: Errors in the structure of the argument itself [3].
    • Informal (Linguistic) Fallacies: Use ambiguities of language to deceive [3, 4].
    • Informal (Relevance – Omission) Fallacies: Relevant information is left out of the argument [4].
    • Informal (Relevance – Intrusion) Fallacies: Irrelevant material is introduced into an argument [5].
    • Informal (Relevance – Presumption) Fallacies: The argument is based on unwarranted assumptions [6].
    • The sources list many specific fallacies, providing examples of each [7-11]. For example:
    • Abusive Analogy: Using a comparison to bring someone into scorn or disrepute [12].
    • Accent: Changing the meaning of a statement by emphasizing different words [13].
    • Analogical Fallacy: Assuming that things similar in one respect are similar in others [14].
    • Argumentum ad Baculum: Using force or threats to persuade [15].
    • Bifurcation: Presenting only two alternatives when others exist [16].
    • Circulus in Probando: Using circular reasoning [17].
    • Complex Question: Combining several questions into one [18].
    • Emotional Appeals: Using emotions to sway an argument, rather than reason [19].
    • Equivocation: Using a word with different meanings in an argument [20].
    • Argumentum ad Hominem (Abusive): Attacking the arguer instead of the argument [21].
    • Argumentum ad Populum: Appealing to popular attitudes instead of presenting evidence [22].
    • The Red Herring: Introducing irrelevant information to divert attention [23].
    • The Straw Man: Misrepresenting an opponent’s position to make it easier to attack [24].
    • Tu Quoque: Undermining an argument by claiming its proponent is guilty of the same thing [25].
    • Argumentum ad Verecundiam: Appealing to false authority [26].

    3. Techniques for Using Fallacies

    • The sources suggest techniques for using fallacies to deceive:
    • Use Long Words: Use complex language or jargon to make arguments sound more impressive [27].
    • Use Loaded Words: Employ biased language to influence attitudes [28].
    • Repeat Claims: Use constant repetition to make a claim seem more true [29].
    • Shift the Ground: Change the substance of the argument while pretending to maintain consistency [30].
    • Poison the Well: Discredit the opposition before they have a chance to speak [31].
    • Create a Straw Man: Misrepresent the opponent’s position and then attack the misrepresentation [24].
    • Use Irrelevant Humor: Introduce jokes or anecdotes to distract from the main point [32].
    • Appeal to Emotions: Use emotional language to sway the audience, rather than logical arguments [19].
    • Shift the Burden of Proof: Insist that the opponent disprove a claim, instead of providing evidence to support it [33].

    4. Techniques for Defending Against Fallacies

    • The sources suggest several techniques to defend against the use of fallacies:
    • Recognize Fallacies: Learning to recognize common fallacies will help you identify when they are being used [1].
    • Challenge Assumptions: Examine the underlying assumptions of an argument and question whether they are valid [6].
    • Examine Evidence: Ensure that arguments are based on solid evidence [1].
    • Identify Irrelevance: Look for irrelevant material being introduced into the argument [34].
    • Focus on the Main Point: Stay focused on the central claim of the argument, rather than being distracted by side issues [35].
    • Avoid Emotional Manipulation: Be aware of attempts to use emotion instead of reason to persuade you [19].
    • Point out Inconsistencies: Identify when someone changes the substance of their argument or is inconsistent in their claims [36].

    5. Other Argument Tactics

    • Use Latin Tags: Using Latin names for fallacies can make the accuser appear more erudite [2].
    • Use Analogies: Analogies can be powerful communication tools [37]. However, do not assume that things similar in one way are similar in all ways [37].
    • Appeal to Authority: Citing authorities can be helpful, but ensure they are genuine experts on the topic [26].

    By understanding both sound and fallacious argument techniques, you can enhance your ability to engage in effective and honest discourse. The sources emphasize that knowledge of fallacies is crucial for both constructing compelling arguments and defending yourself against manipulation [38].

    Persuasive Language Techniques and Fallacies

    The sources discuss several aspects of persuasive language, often in the context of logical fallacies and how they are used to manipulate or influence an audience [1-3]. Here’s a breakdown of persuasive language techniques identified in the sources:

    • Loaded Words: The sources emphasize that using biased or prejudiced terms can influence the outcome of a judgment [4]. The goal is to create a more favorable or hostile attitude toward something than the plain facts would warrant [4, 5]. For instance, describing leaders as “war lords” versus “defense chiefs” conveys different attitudes [4]. Near synonyms can carry subtle nuances of meaning which can be used to influence attitudes to a statement [5].
    • Emotional Appeals: Using emotional appeals is a common tactic to bypass reason [6-8]. The sources identify several emotional appeals including appeals to fear (argumentum ad metum), envy (ad invidiam), hatred (ad odium), superstition (ad superstitionem), and pride (ad superbiam) [9].
    • Blinding with Science: This technique involves using technical or scientific jargon to give the impression of expertise, even when the content is not supported by evidence [10, 11]. The use of complex jargon can make it difficult for an audience to challenge what is being said [11, 12].
    • Repetition (Argumentum ad Nauseam): Repeating a point of view, even without additional evidence, can erode the critical faculty, making an audience more likely to accept it [13]. This tactic aims to wear down resistance or deceive people into thinking objections have been addressed [14]. Advertisers use this by repeating a claim, building up a habit of association [15].
    • Use of Humor: While humor can entertain, it can also be used to distract from the central argument [16]. The fallacy lies in using humor to divert attention from the rights and wrongs of an issue [16, 17].
    • Use of Analogies: Analogies are used as tools of communication, but it is fallacious to assume that things that are similar in one respect are similar in all respects [18, 19]. An analogy may suggest a line of inquiry but does not provide a basis for establishing discoveries [19].
    • Appeals to Tradition (Argumentum ad Antiquitam): This involves using the age or tradition of something as a reason to accept it, regardless of its merits [20]. This fallacy is often employed in advertising or in resistance to change [21].
    • Appeals to Novelty (Argumentum ad Novitam): Conversely, something new is not necessarily better, and to argue that it is simply because it’s new is a fallacy [22]. The sources note the advertising industry’s use of “new” to appeal to this fallacy [23].
    • Appeals to Popularity (Argumentum ad Populum): This fallacy involves appealing to popular attitudes or beliefs instead of presenting relevant material [24]. It often relies on emotional appeals and is used by mob orators to raise emotional temperature [25].
    • Use of “Every Schoolboy Knows”: This tactic involves assuring the audience that a claim is widely known (often by children), thereby discouraging questions and passing off dubious assertions unquestioned [26, 27].
    • Half-Concealed Qualification: This technique uses words to express a limited claim, but the stress and construction make the qualifications get overlooked [28]. The limits are stated, but the audience barely notices them when discussing a more general statement [28].

    The sources suggest that persuasive language often involves manipulating the audience’s emotions, associations, or preconceptions. The use of fallacies can make arguments seem convincing, even when they are logically flawed [2, 3]. Understanding these techniques is important for both constructing effective arguments and defending against manipulation.

    Deceptive Argumentation Tactics

    The sources detail a range of deceptive tactics employed in arguments, often through the use of logical fallacies and persuasive language techniques. These tactics can be used intentionally to mislead, or sometimes unintentionally due to a lack of understanding of sound reasoning [1, 2]. Here’s a breakdown of deceptive tactics from the sources:

    • Use of Logical Fallacies: The core of many deceptive tactics is the exploitation of logical fallacies [1]. These flaws in reasoning can make an argument seem valid when it is not. The sources provide numerous examples of such fallacies [3-6].
    • Formal fallacies involve errors in the structure of the argument itself [7, 8].
    • Informal fallacies are flaws in the content or context of an argument [7, 8].
    • Linguistic fallacies exploit ambiguities of language [8, 9].
    • Fallacies of relevance introduce irrelevant information to distract from the main point or omit important information [8-10].
    • Fallacies of presumption rely on unwarranted assumptions [8, 11].
    • Manipulation of Language:
    • Loaded words: Using biased or emotionally charged terms to sway an audience, creating a more favorable or hostile attitude than the facts would otherwise suggest [12, 13]. For example, calling leaders “war lords” instead of “defense chiefs” [12].
    • Equivocation: Using words with multiple meanings to confuse the issue [14]. This creates ambiguity, enabling a speaker to shift the meaning of their statements [15].
    • Half-concealed qualification: Using words to make a limited claim, but stressing the statement to make it sound like a general claim [16, 17]. The qualification is stated, but gets glossed over [17].
    • Extensional pruning: Using words in their commonly accepted meaning, but retreating to a strictly literal definition when challenged [18, 19]. The user makes a statement that permits one understanding but retreats to a limited definition to escape criticism [20].
    • Hedging: Using ambiguous language to allow for a change in definition later [21]. The language is carefully chosen to retain the option to switch definitions [22].
    • Distraction and Diversion:
    • The red herring: Introducing irrelevant material to divert attention from the main argument [23]. This tactic tries to change the subject and lead the discussion in a different direction [24].
    • Irrelevant humor: Using jokes or humorous stories to distract from the issue at hand [25, 26].
    • Shifting Ground: Changing the substance of the argument while pretending to maintain consistency [27]. This tactic is used to avoid criticism of the original stance by moving to a different one [28].
    • Emotional Manipulation:
    • Emotional appeals: Using emotional language or appeals to sway an audience instead of using logic or evidence [29]. This involves appealing to emotions such as fear, envy, hatred, superstition or pride [30].
    • Argumentum ad Misericordiam: Using pity to support an argument instead of using reasoned discourse [31].
    • Argumentum ad Populum: Appealing to popular attitudes and emotions instead of presenting evidence [32, 33].
    • Exploitation of Assumptions and Beliefs:
    • Every schoolboy knows: Presenting a claim as widely known to discourage questions [34, 35].
    • Argumentum ad Verecundiam: Appealing to false authority or expertise to support a claim [36].
    • Argumentum ad Lazarum: Claiming that a person’s poverty makes their argument more valid [37].
    • Argumentum ad Crumenam: Claiming that a person’s wealth makes their argument more valid [10].
    • Repetition:
    • Argumentum ad Nauseam: Repeating a point of view constantly in order to make it more likely to be accepted, even without new evidence [38]. This tactic attempts to erode critical thinking [38, 39].
    • Attacks on the Person:
    • Argumentum ad Hominem (Abusive): Attacking the person making the argument instead of addressing the argument itself [40]. This aims to undermine their credibility [41].
    • Argumentum ad Hominem (Circumstantial): Appealing to the special circumstances of the person to get them to accept an argument [42]. This tactic urges acceptance due to the position or interests of the person being addressed [42].
    • Poisoning the well: Discrediting an opponent before they have a chance to present their argument [43]. This tactic sets up an insult for anyone who might disagree [44].
    • Tu quoque: Undermining a case by pointing out that the proponent is guilty of the same thing [45].
    • Misrepresentation:
    • Straw man: Misrepresenting an opponent’s position to make it easier to attack [46]. This involves creating an easily refuted version of the argument and attacking that instead of the real argument [46, 47].
    • Refuting the example: Rejecting a general claim because of a bad example used to support it [48]. This tactic focuses on the example instead of the central claim [48].
    • Other Deceptive Tactics
    • Shifting the burden of proof: Insisting that the audience disprove a claim instead of providing evidence to support it [49].
    • Unaccepted Enthymemes: Presenting an argument with an unstated assumption that is not accepted by the other party [50]. This tactic omits important elements from the argument [51].
    • Trivial Objections: Opposing an argument based on minor or incidental aspects, rather than the main claim [52].
    • Blinding with science: Using technical jargon to make a weak argument seem more credible [53].

    By understanding these deceptive tactics, one can better identify attempts to manipulate and be more prepared to engage in honest and effective discourse [54].

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Al-Riyadh Daily Newspaper: March 26, 2025 Saudi Arabia: Reforms, Vision 2030, and MBS Global Leadership

    Al-Riyadh Daily Newspaper: March 26, 2025 Saudi Arabia: Reforms, Vision 2030, and MBS Global Leadership

    These excerpts from the Al Riyadh newspaper, dated March 26, 2025, primarily celebrate the eighth anniversary of Crown Prince Mohammed bin Salman’s pledge of allegiance. The articles highlight the Kingdom’s remarkable progress and development across various sectors under his leadership, aligning with Vision 2030. Several pieces also cover Saudi Arabia’s growing international role in economic, political, and diplomatic spheres, including energy markets and peace initiatives. Additionally, the newspaper reports on local developments and initiatives such as infrastructure projects, cultural events, and community services across different regions of the Kingdom.

    Vision 2030: A Comprehensive Study Guide

    Quiz

    Answer the following questions in 2-3 sentences each.

    1. What are some key aspects of the transformative changes brought about by Vision 2030 in Saudi Arabia?
    2. How has Saudi Arabia, under the leadership mentioned, emphasized the importance of education and training?
    3. What are the “Saudi Green Initiative” and “Middle East Green Initiative,” and what do they aim to achieve?
    4. In what ways has the foreign policy of Saudi Arabia shifted since the appointment of the Crown Prince in 2017?
    5. How does Vision 2030 aim to diversify the Saudi Arabian economy away from its reliance on oil?
    6. What role does Vision 2030 envision for the tourism sector in the Kingdom’s future economy?
    7. Describe some of the “giga-projects” associated with Vision 2030 and their intended impact.
    8. How has Vision 2030 contributed to the empowerment of women in Saudi Arabia?
    9. What efforts have been undertaken in Saudi Arabia, as highlighted in the text, to combat corruption?
    10. How does Vision 2030 aim to enhance the quality of life for citizens and residents in Saudi Arabia?

    Answer Key

    1. Vision 2030 encompasses a wide range of transformations, including smart cities, investments in clean energy, environmental conservation, and efforts to elevate the Kingdom’s international standing. It aims for comprehensive development across various aspects of life, moving beyond the historical reliance on oil.
    2. The leadership has focused on the critical role of education and training by establishing educational and vocational systems designed to prepare Saudi youth to be at the heart of global development. This initiative seeks to equip the next generation with the skills needed for a modern, competitive workforce.
    3. The “Saudi Green Initiative” and “Middle East Green Initiative” are key environmental programs focused on reducing carbon emissions, protecting the planet, increasing reliance on renewable energy, and planting billions of trees. These initiatives underscore the Kingdom’s commitment to environmental sustainability and combating climate change.
    4. Since 2017, Saudi foreign policy has adopted a more active and influential role in regional and international affairs. The Kingdom has worked to strengthen relationships with various global powers and has taken a leading stance on regional issues, including counter-terrorism efforts.
    5. Vision 2030 seeks to diversify the Saudi economy by promoting the development of non-oil sectors such as tourism, technology, and manufacturing. This includes investing in large-scale projects and creating a free market environment to reduce dependence on traditional oil revenues and foster a more sustainable economic future.
    6. Vision 2030 places a significant emphasis on developing the tourism sector as a key source of national income and economic growth. By investing in infrastructure, cultural and entertainment events, and streamlining visa processes, the Kingdom aims to become a leading global tourist destination.
    7. “Giga-projects” like NEOM, Al Qiddiya, and the Red Sea Project are ambitious developments aimed at creating new hubs for business, tourism, and innovation. These projects are intended to diversify the economy, attract foreign investment, and enhance Saudi Arabia’s global image.
    8. Vision 2030 has actively worked to empower women by granting them new rights and opening opportunities for participation in various sectors of the workforce and society. This includes leadership roles and aims to improve the overall quality of life and foster a more inclusive society.
    9. Saudi Arabia has undertaken significant efforts to combat corruption through legislative reforms, the establishment of anti-corruption bodies like “Nazaha,” and the implementation of transparent governance practices. These campaigns have involved holding high-profile figures accountable and aim to create a healthier institutional environment.
    10. Vision 2030 includes initiatives focused on improving the quality of life through the development of infrastructure, enhanced public services (including education and healthcare), and the promotion of cultural and recreational activities. The development of smart cities and sustainable infrastructure are also key components of this goal.

    Essay Format Questions

    1. Analyze the key pillars of Vision 2030 and discuss the extent to which the source material suggests progress towards achieving these goals.
    2. Evaluate the significance of Saudi Arabia’s shift in foreign policy under the current leadership, as portrayed in the excerpts, and its implications for regional stability and international relations.
    3. Discuss the strategies outlined in Vision 2030 for economic diversification, critically assessing the potential challenges and opportunities associated with moving away from oil dependence.
    4. Examine the social reforms and initiatives highlighted in the source material that are aimed at enhancing the quality of life for Saudi citizens and residents, and discuss their broader impact on Saudi society.
    5. Analyze the anti-corruption efforts described in the text and their role in the broader context of Vision 2030’s objectives for national development and international credibility.

    Glossary of Key Terms

    • Vision 2030: A strategic framework launched by Saudi Arabia with the goal of diversifying its economy, developing public service sectors such as health, education, infrastructure, recreation, and tourism, and strengthening governance.
    • Clean Energy: Energy generated from renewable sources that do not produce greenhouse gases or pollutants, such as solar, wind, and hydroelectric power.
    • Environmental Conservation: The practice of protecting and preserving natural resources and the environment.
    • Giga-projects: Large-scale, ambitious development projects initiated as part of Vision 2030, such as NEOM and the Red Sea Project.
    • Economic Diversification: The process of shifting an economy away from a single income source towards a wider variety of sectors to ensure stability and growth.
    • Sustainable Development: Development that meets the needs of the present without compromising the ability of future generations to meet their own needs, encompassing environmental, social, and economic aspects.
    • Foreign Policy: A government’s strategy in dealing with other nations, involving diplomacy, trade, defense, and other interactions.
    • Empowerment of Women: The process of increasing the social, economic, and political strength of women.
    • Anti-Corruption: Measures taken to prevent and combat bribery, fraud, and other illegal or unethical practices, especially by government officials or in business dealings.
    • Quality of Life: The general well-being of individuals and societies, encompassing health, happiness, comfort, and security.
    • Saudi Green Initiative: A national initiative focused on environmental sustainability, including reducing emissions and planting trees.
    • Middle East Green Initiative: A broader regional initiative aiming to coordinate efforts across the Middle East to address climate change and environmental challenges.
    • NEOM: A planned smart city in northwestern Saudi Arabia, envisioned as a hub for innovation, technology, and sustainable living.
    • Al Qiddiya: An entertainment city under development in Saudi Arabia, focusing on culture, sports, and leisure activities.
    • Red Sea Project: A luxury tourism development on Saudi Arabia’s Red Sea coast, emphasizing environmental sustainability.
    • Nazaha: The National Anti-Corruption Commission in Saudi Arabia, responsible for promoting integrity and combating corruption.
    • Public Investment Fund (PIF): Saudi Arabia’s sovereign wealth fund, playing a key role in funding Vision 2030 projects and diversifying the economy through strategic investments.

    Briefing Document: Saudi Arabia’s Vision 2030 and the Eighth Anniversary of the Crown Prince’s Allegiance

    Sources: Excerpts from “20724.pdf” (likely an Arabic newspaper or publication).

    Overview:

    This briefing document synthesizes the main themes and important ideas presented in the provided Arabic source, which focuses on the eighth anniversary of the allegiance ( البيعة الثامنة ) to His Royal Highness Prince Mohammed bin Salman as Crown Prince of Saudi Arabia. The excerpts overwhelmingly celebrate the achievements and ambitious goals of Vision 2030 under his leadership, highlighting progress across various sectors, including economic diversification, social reforms, environmental sustainability, and international relations. The document portrays the Crown Prince as a visionary and inspirational leader driving unprecedented development and positioning Saudi Arabia as a key global player.

    Main Themes and Important Ideas:

    1. Commemoration and Renewal of Allegiance:
    • The anniversary is seen as a significant occasion to reaffirm loyalty and appreciation for the Crown Prince’s leadership.
    • It’s a time to reflect on the progress achieved under Vision 2030 and to renew commitment towards its future goals.
    • The source emphasizes the deep-rooted allegiance to a leader who is dedicated to a bright future for the nation and its people: ” (Celebrating the eighth anniversary of the allegiance to His Highness the Crown Prince is a deep celebration and recollection of the national ambition, a redefinition of the Kingdom’s standing, and a confirmation of its path on the international stage, with its renewal every year of loyalty and fidelity to a leader who pledges a bright future for his country and his people).
    1. Vision 2030 as a Catalyst for Comprehensive Transformation:
    • Vision 2030 is presented as a comprehensive and ambitious roadmap for the Kingdom’s future, encompassing all aspects of life.
    • It is credited with initiating a new era of development and modernization, moving away from dependence on oil.
    • The vision is described as a “great strategic vision” and a “brilliant and ambitious roadmap” reaching for the heights ).
    • It’s a “developmental journey” ) marked by “unprecedented economic renaissance” ).
    1. Economic Diversification and Growth:
    • A key focus of Vision 2030 is diversifying the Saudi economy away from its reliance on oil revenues.
    • The establishment of mega-projects like NEOM, Al Qiddiya, and the Red Sea Project are highlighted as drivers of this diversification, aiming to attract investments and boost the Kingdom’s global standing.
    • The Public Investment Fund (PIF) is playing a crucial role in managing strategic investments to enhance income sources and reduce oil dependence.
    • The development of the tourism sector is specifically mentioned as a major avenue for economic diversification and revenue generation.
    1. Social Reforms and Quality of Life Enhancements:
    • The excerpts emphasize improvements in the quality of life for citizens and residents through various initiatives.
    • Developments in education, healthcare, and entertainment are noted.
    • The empowerment of youth and the increasing role of women in society are highlighted as significant achievements.
    • The “Quality of Life Program” is mentioned as aiming to improve living standards by developing infrastructure and services.
    1. Environmental Sustainability:
    • The importance of environmental preservation and addressing climate change is a prominent theme.
    • The Crown Prince is portrayed as one of the first leaders to recognize the significance of environmental change for humanity’s future.
    • Initiatives like the “Saudi Green Initiative” and the “Middle East Green Initiative,” as well as investments in clean and renewable energy projects, are showcased.
    • The goal of planting 10 billion trees across the Kingdom and protecting 30% of land and sea areas by 2030 is mentioned.
    1. Strengthening International Relations and Global Role:
    • Saudi Arabia, under the Crown Prince’s leadership, is actively working to strengthen its relations with various global powers in both the West and the East.
    • The Kingdom is playing a more pivotal role in addressing regional and international issues, aiming to enhance its global standing and expand its alliances.
    • The Saudi foreign policy under Vision 2030 is described as one of continuous engagement with challenges and a focus on regional stability.
    • The Kingdom’s role in counter-terrorism and the formation of military alliances for regional stability are mentioned.
    1. Combating Corruption and Promoting Transparency:
    • A significant aspect of the reforms under the Crown Prince is the strong campaign against corruption.
    • This is portrayed as a crucial step towards improving government performance, ensuring the proper use of public resources, and building trust between the citizens and the government.
    • The establishment of the National Anti-Corruption Authority (“Nazaha”) and legislative reforms aimed at strengthening accountability are highlighted.
    • The Crown Prince’s decisive leadership in holding even high-ranking individuals accountable for corruption is emphasized.
    1. Developing Human Capital through Education and Training:
    • The importance of education and training is underscored as essential for building a generation capable of contributing to global development.
    • The Kingdom is becoming a destination for ambitious youth striving to achieve their goals.
    • The Ministry of Education’s efforts to instill values of moderation, tolerance, and national belonging in students are highlighted.
    • The development of curricula and various educational programs and initiatives aimed at fostering critical thinking and combating extremism are mentioned.
    1. Hosting Global Events:
    • Saudi Arabia’s preparation to host major international events like “Expo 2030” in Riyadh and the “FIFA World Cup 2034” is presented as a testament to the Kingdom’s rising global prominence.
    • These events are expected to further enhance the Kingdom’s position as a cultural and commercial destination.
    1. Philanthropic and Humanitarian Efforts:
    • The Crown Prince’s initiatives in charitable and humanitarian work, both domestically and internationally, are acknowledged.
    • The establishment of the Mohammed bin Salman “Misk Al Khairia” Foundation and the support for charitable organizations are mentioned as contributing to social welfare and development.
    • King Salman Humanitarian Aid and Relief Centre is highlighted for its role in international humanitarian efforts.
    1. Embracing Modernization and Technology:
    • The excerpts indicate a strong push towards embracing modern technologies, including artificial intelligence, in various sectors.
    • The development of smart cities and the use of technology to enhance government services and monitor financial activities are mentioned.

    Quotes Highlighting Key Aspects:

    • (Visionary Leadership): “” (The present is being implemented by an inspiring and exceptional leader who is never satisfied with his dreams.)
    • (Education and Youth Empowerment): ” (He has worked to direct attention towards the importance of education and training, and established an educational and professional system that prepares a generation of Saudi youth to become at the heart of global development; hence, we find that under his leadership, the Kingdom has become a destination for ambitious youth who continue their pursuit of achieving aspirations for the future, whose seeds were sown by Vision 2030.)
    • (Environmental Focus): “” (The Kingdom was keen to make its role pivotal in preserving the environment and invested in projects of clean and renewable energy to reduce harmful emissions and protect planet Earth…)
    • (Global Standing): “” (In less than a decade, he has become a rising sun, and with him, a new pivotal force for the Kingdom in the world, a bright sun carrying within it ambitions…)
    • (Foreign Policy Transformation): ” (Since the allegiance of Crown Prince Prince Mohammed bin Salman in 2017, Saudi foreign policy has entered a new stage, shifting from a reactive role to a pivotal role in various regional and international issues.)
    • (Economic Diversification Goal): ” (…as he seeks to move the Kingdom away from dependence on the traditional oil economy to a free market-related trading economy.)
    • (Tourism as a Driver): “” (Also, Saudi Vision 2030 focuses significantly on developing the tourism sector as a primary source, thereby reducing dependence on oil revenue.)
    • (Mega-Projects’ Impact): ..” (Saudi Vision 2030 includes a set of ambitious projects aimed at achieving a comprehensive transformation in the Kingdom, among the most prominent of these projects: NEOM, a futuristic city based on technology and innovation, aiming to be a global center for business and tourism…)
    • (Combating Corruption as Strategic Goal): (Combating corruption was not just a security campaign, but part of a strategic vision aimed at improving government performance and ensuring that the Kingdom’s wealth and resources are directed towards achieving the interests of the people and developing the Kingdom in various fields.)
    • (Vision 2030’s Pillars): “” (The vision represents a plan for the life of citizens, it is a system of interconnected programs, and the vision of the Crown Prince relies on (3) axes to achieve the vision’s path: the vibrant society, the thriving economy, and the ambitious nation…)
    • (Youth as Real Wealth): “(…the largest segment of society, and the plans of His Royal Highness Prince Mohammed bin Salman aligned with the aspirations and dreams of the youth, the Kingdom’s true wealth.)
    • (Global Peacemaker Role): “” (Towards His Highness the Crown Prince, asking him – may God protect him – to mediate between them to resolve their political differences, and desiring his intervention to end the ongoing armed conflicts that have drained their societies and spilled their blood, and asking how to stop the wars and conflicts, given his wise opinion and sound judgment.)

    Conclusion:

    The provided excerpts paint a picture of a Saudi Arabia undergoing rapid and comprehensive transformation under the leadership of Crown Prince Mohammed bin Salman. Vision 2030 is portrayed as a resounding success, driving progress across various critical sectors. The eighth anniversary of the Crown Prince’s allegiance is celebrated as a testament to his visionary leadership, the strong national will to achieve ambitious goals, and the Kingdom’s growing prominence on the global stage. The document reflects a sense of optimism and confidence in Saudi Arabia’s future trajectory towards a diversified, sustainable, and influential global role.

    Saudi Vision 2030: Core Objectives and Strategies

    Frequently Asked Questions on the Provided Sources

    1. What is the central objective of Saudi Arabia’s Vision 2030, as highlighted in these sources?

    Vision 2030 aims for a comprehensive transformation of Saudi Arabia, encompassing economic diversification to reduce reliance on oil, modernization across various sectors like technology, tourism, and renewable energy, and an enhanced global standing. It emphasizes improving the quality of life for citizens and residents, fostering a vibrant society rooted in Islamic values and national heritage, and establishing the Kingdom as a leading global force in economics, politics, and culture.

    2. How does Vision 2030 intend to diversify the Saudi Arabian economy away from its dependence on oil?

    The vision seeks to diversify the economy through strategic investments in non-oil sectors such as tourism, technology, renewable energy, manufacturing, and the development of mega-projects like NEOM, the Red Sea Project, and Al Qiddiya. It focuses on attracting foreign investment, fostering entrepreneurship among Saudi youth, developing a robust free-market economy, and increasing the contribution of non-oil revenues to the national income.

    3. What role does the development of mega-projects play in achieving the goals of Vision 2030?

    Mega-projects like NEOM, the Red Sea Project, Al Qiddiya, and others are integral to Vision 2030 as they are designed to attract significant investments, create new job opportunities, drive economic growth in non-traditional sectors, and position Saudi Arabia as a global hub for business, tourism, and innovation. These projects aim to redefine urban living, promote sustainable development, and showcase the Kingdom’s ambition and potential.

    4. How has Saudi Arabia’s foreign policy evolved under the leadership mentioned in the sources, in alignment with Vision 2030?

    Saudi Arabia’s foreign policy has become more proactive and multi-faceted, aiming to strengthen its regional and international alliances, enhance its influence on global issues, and promote stability in the Middle East. It emphasizes building partnerships with various countries, playing a key role in regional mediation and conflict resolution (such as efforts towards stability in Syria and fostering unity among GCC nations), and actively combating terrorism and extremism. The foreign policy also supports the goals of Vision 2030 by attracting international collaborations and investments.

    5. What emphasis is placed on education and youth empowerment within the framework of Vision 2030?

    Education and youth empowerment are critical pillars of Vision 2030. The vision aims to create a modern and efficient education system that prepares Saudi youth to compete globally, meet the demands of the future job market, and contribute to the Kingdom’s development. Various initiatives focus on enhancing curricula, promoting critical thinking, fostering innovation, and providing opportunities for skills development and leadership roles for the younger generation in diverse sectors.

    6. How does Vision 2030 address the importance of sustainability and environmental conservation?

    Sustainability and environmental conservation are significant aspects of Vision 2030. The Kingdom has launched initiatives like the “Saudi Green Initiative” and the “Middle East Green Initiative” to reduce carbon emissions, increase reliance on clean energy sources, protect natural resources and biodiversity, and combat desertification. These efforts demonstrate a commitment to preserving the planet for future generations and align with global efforts to address climate change.

    7. What reforms and initiatives have been undertaken in Saudi Arabia to promote social development and improve the quality of life under Vision 2030?

    Significant social reforms have been implemented, including the empowerment of women through expanded rights and opportunities, development of the cultural and entertainment sectors, and initiatives to enhance healthcare, infrastructure, and public services. The “Quality of Life Program” specifically aims to improve the living standards of citizens and residents by providing better amenities, cultural experiences, and recreational activities, making Saudi Arabia a more attractive place to live and work.

    8. How has the fight against corruption been prioritized and addressed as part of Saudi Arabia’s Vision 2030?

    Combating corruption is a high priority within Vision 2030, viewed as essential for building a transparent, accountable, and prosperous nation. Significant efforts have been made to strengthen regulatory bodies (like “Nazaha”), implement legal reforms to deter and punish corruption, enhance transparency in government operations, and hold individuals accountable, regardless of their status. These measures aim to ensure that public resources are used effectively for national development and to build trust between the government and its citizens and investors.

    Saudi Arabia’s Vision 2030: A Kingdom’s Transformation

    Vision 2030 is presented in the sources as a comprehensive and ambitious strategic plan launched by Crown Prince Mohammed bin Salman. It is described as a roadmap for the Kingdom’s future development across various sectors.

    Key Objectives and Principles of Vision 2030:

    • Economic Diversification: A central goal is to reduce reliance on oil as the primary source of income and to develop diverse sources of revenue. This includes developing new sectors such as tourism, industry, technology, and renewable energy. The vision aims to create a knowledge-based economy.
    • Improving Quality of Life: Vision 2030 seeks to enhance the quality of life for citizens and residents. This involves initiatives to improve healthcare, education, recreation, culture, sports, and urban development.
    • Achieving Sustainable Development: The vision emphasizes sustainability in various aspects, including environmental protection and economic stability. Initiatives like the Saudi Green Initiative and the Middle East Green Initiative aim to combat desertification, plant billions of trees, and increase the contribution of renewable energy.
    • Enhancing the Kingdom’s Global Standing: Vision 2030 aims to strengthen the Kingdom’s position as a global leader. This includes attracting foreign investment, becoming a global hub for logistics and trade, and playing a key role in international diplomacy and conflict resolution. The Kingdom also aims to be a leading destination for international conferences.
    • Empowering Citizens: The vision focuses on empowering youth and women. It seeks to increase female participation in the workforce and provide opportunities for young Saudis in various fields.
    • Strengthening National Identity and Values: While embracing modernization, Vision 2030 emphasizes the importance of preserving the Kingdom’s religious and cultural heritage. It highlights the Kingdom’s role in serving Islam and Muslims worldwide. The vision also promotes values of moderation, tolerance, and coexistence.
    • Improving Governance and Efficiency: The plan includes efforts to enhance government performance, promote transparency and accountability, and combat corruption. The digital transformation is a key aspect of improving efficiency and delivering advanced services.

    Key Initiatives and Projects under Vision 2030:

    • NEOM: A futuristic city embodying innovation and sustainability.
    • Al Qiddiya: A global entertainment, sports, and cultural destination.
    • Red Sea Project: A luxury tourism destination focused on sustainability.
    • Saudi Green Initiative and Middle East Green Initiative: Ambitious environmental programs focused on afforestation, reducing emissions, and increasing reliance on renewable energy.
    • National Investment Strategy: Aims to increase the volume of domestic and foreign investment.
    • Fintech Sector Development: Efforts to transform the Kingdom into a leading financial technology hub.
    • Developing the Non-Profit Sector: Initiatives to empower and enhance the impact of charitable organizations.

    Progress and Impact:

    The sources indicate that Vision 2030 has already led to significant transformations and achievements across various sectors. These include:

    • Economic growth and diversification, with an increase in non-oil GDP.
    • Attraction of foreign investment and the establishment of regional headquarters for international companies.
    • Advancements in digital transformation, ranking highly in digital competitiveness.
    • Increased participation of women in the workforce.
    • Development of the tourism sector and the launch of mega-tourism projects.
    • Significant progress in the sports sector, including hosting major international events and increasing the value of the Saudi football league.
    • Improvements in healthcare and education.
    • Enhanced environmental awareness and the initiation of green projects.
    • Increased trust in the government.

    Leadership and Vision:

    The sources consistently highlight the pivotal role of Crown Prince Mohammed bin Salman in conceiving, launching, and driving the implementation of Vision 2030. His visionary leadership, determination, and continuous follow-up are credited with the progress achieved. The Crown Prince’s belief that “ambition knows no limit” and the “zeal has no end” is emphasized.

    Overall Significance:

    Vision 2030 is portrayed as more than just an economic plan; it is a national document that reflects the Kingdom’s commitment to a brighter and more prosperous future for its citizens and the world. It is a continuous journey of work that extends beyond 2030. The vision aims to transform the Kingdom into a global model of development and progress.

    Mohammed bin Salman: Vision 2030 and Saudi Arabia’s Transformation

    Based on the sources and our previous discussion, Crown Prince Mohammed bin Salman is a central figure in the transformation and development of the Kingdom of Saudi Arabia. He is consistently presented as the driving force behind Vision 2030, the ambitious strategic plan for the Kingdom’s future.

    Key Aspects of the Crown Prince’s Role and Vision:

    • Architect of Vision 2030: He is widely recognized as the initiator and the “real driving force” behind Vision 2030. The vision itself is described as his roadmap for transforming the Kingdom into a global model across various fields. His “bright thought and strong determination” are highlighted in the context of these reforms.
    • Economic Transformation: The Crown Prince has led the Kingdom in an “exceptional transformation journey”, marked by significant leaps in various sectors. A primary focus is on diversifying the economy and reducing reliance on oil through the development of sectors like tourism, technology, and renewable energy. Initiatives such as NEOM, Al Qiddiya, and the Red Sea Project are flagship projects reflecting this vision for a more diverse and sustainable economy. The launch of companies like the Public Transport Company for the manufacturing of machinery and equipment also aligns with this industrial diversification. His leadership aims to create a competitive business environment and attract investments.
    • Improving Quality of Life: The Crown Prince’s vision aims to improve the lives of citizens and residents by enhancing healthcare and education services, providing world-class entertainment and cultural options, and empowering youth through education and job creation. Projects focusing on urban beautification and improving the environment, such as those undertaken by the Al Muthnib Governorate Municipality, also contribute to this goal of enhancing the local scene and achieving quality of life.
    • Promoting Moderation and Combating Extremism: The Crown Prince is credited with spearheading efforts to promote moderation, coexistence, and tolerance while combating extremism and terrorism. He has emphasized the need to fight extremism to build stability and achieve economic development in the region. Measures taken include issuing clear legislation to define terrorist acts and intensifying penalties, as well as purging pulpits and platforms of extremist elements. Initiatives like the King Abdullah bin Abdulaziz International Centre for Interreligious and Intercultural Dialogue (KAICIID), established during his tenure as Crown Prince, demonstrate the Kingdom’s commitment to fostering dialogue and respecting diversity.
    • Enhancing Global Standing and International Relations: The Crown Prince has actively worked to strengthen the Kingdom’s international relations through diplomatic visits and strategic partnerships with major global powers like the United States and China. He has also led efforts to combat terrorism in cooperation with other nations. The Kingdom, under his leadership, has played a pivotal role in regional and international issues, striving to resolve conflicts and promote peace. The Crown Prince’s efforts in mediating between Russia and Ukraine have been recognized internationally. His vision aims to position the Kingdom as an influential political and economic power on the global stage.
    • Combating Corruption and Promoting Transparency: The Crown Prince has launched anti-corruption campaigns aimed at increasing transparency and accountability within the government. The government has taken serious measures to hold those involved in corruption accountable, sending a strong message to both the public and private sectors.
    • Specific Initiatives: Beyond the mega-projects, the Crown Prince has overseen the launch of numerous initiatives across various sectors, including the development of the fintech sector, the Saudi Green Initiative for environmental sustainability, and programs to support the non-profit sector and address social issues. The establishment of the Mohammed bin Salman Foundation “Misk” to empower youth and the Non-Profit City in Riyadh “Misk City” are examples of his focus on human capital development and innovation.
    • Leadership Style and Connection with Citizens: The sources suggest a leadership style characterized by closeness and direct interaction with citizens. This approach is seen as fostering national unity and trust between the leadership and the people.
    • International Recognition: The Crown Prince’s efforts in promoting peace and development have garnered international attention and praise, with some even suggesting him as a potential candidate for the Nobel Peace Prize. His role in facilitating talks and de-escalating conflicts has been acknowledged by global leaders.

    In conclusion, Crown Prince Mohammed bin Salman is depicted as a transformational leader with a clear and ambitious vision for the Kingdom of Saudi Arabia. His leadership is characterized by a focus on economic diversification, improving the quality of life, promoting moderation, enhancing the Kingdom’s global role, and driving large-scale development projects, all under the umbrella of Vision 2030.

    Saudi Arabia’s Economic Growth and Vision 2030

    Based on the sources and our previous discussion, the Kingdom of Saudi Arabia has witnessed significant economic growth and is actively pursuing a path of sustainable and diversified economic development.

    The Saudi economy recorded strong growth in the past year, with the non-oil GDP showing a notable increase of 3.5% in the third quarter. This growth was supported by higher oil prices and improved performance in non-oil sectors such as industry and technology. The Kingdom has successfully achieved a balance between traditional and modern sectors, contributing to the stability and resilience of the national economy in the face of global changes.

    Vision 2030 is explicitly identified as the driving force behind this economic transformation and the pursuit of a thriving economy. A key objective of the vision is economic diversification and reducing reliance on oil by developing sectors like tourism, technology, and renewable energy.

    The Kingdom has seen great success in attracting foreign direct investment in the past year, registering a 15% increase compared to the previous year. This improvement reflects the encouraging investment environment provided by the Kingdom through legal amendments and streamlined procedures to attract international investors, positioning the Kingdom as a promising destination. The National Investment Strategy focuses on increasing the volume and efficiency of both domestic and foreign investments, leveraging national strengths and prioritizing the private sector. The goal is to increase the contribution of small and medium-sized enterprises (SMEs) to 35% by 2030.

    Specific sectors are experiencing notable growth:

    • The tourism sector has witnessed a remarkable surge, with a 73% increase in the number of international tourists and a 207% rise in international tourism revenues in the first seven months of the past year compared to the same period in 2019. The Kingdom aims to increase the tourism sector’s contribution to the GDP to 10% by 2030, representing around 600 to 700 billion riyals. Saudi Arabia achieved its highest number of inbound tourists at approximately 30 million in the past year, with a target of 70 million by 2030.
    • The communications and technology market has reached a volume of 166 billion riyals, with a compound annual growth rate of 8% over the past six years. The Kingdom has also achieved the second rank among the G20 countries in the United Nations’ TII index for telecommunications infrastructure. The ICT market in the Kingdom is the largest and fastest-growing in the Middle East, North Africa, and Central Asia region.
    • The fintech sector has experienced tremendous development in recent years, with investments exceeding one billion dollars. This growth is supported by specialized investment funds like the “Fintech Fund” and the Public Investment Fund. The sector encompasses a wide range of financial services, including payment systems and transfers.

    The Public Investment Fund (PIF) is identified as the primary driver for achieving Vision 2030’s objectives. It has become one of the largest sovereign wealth funds globally in the field of non-oil investments. The PIF has established 79 local companies and created 500,000 direct and indirect jobs. Its strategic investments, including in Aramco, generate significant returns that are reinvested in domestic infrastructure and to support citizens.

    The Kingdom’s unique strategic location connecting three continents and its wealth in natural resources are being leveraged to localize industries, logistics services, and the energy sector. The “Developing National Industries and Logistics Services” program aims to localize 70% of the oil and gas sector and 30% of the pharmaceutical industries.

    The stable “+A” credit rating with a “stable” future outlook by Standard & Poor’s (S&P) reflects the strength of the Saudi economy and supports its development plans, attracting investments and reducing financing costs, thereby enhancing the achievement of Vision 2030’s targets. Furthermore, the Edelman Trust Barometer 2025 indicates that the Kingdom has the highest trust globally in the government sector at 87%, surpassing many developed nations. The Kingdom is also the most optimistic country globally about the future at 69%.

    The Kingdom boasts the highest rate of global productivity growth despite its later entry into the G20. This strong economic performance is supported by a robust financial policy aligned with Vision 2030, ensuring transparency and sustainability. The preliminary forecasts for 2025 indicate a 4.6% real GDP growth, driven by an increase in non-oil activities.

    The concept of sustainable development is a fundamental pillar for achieving the Kingdom’s future aspirations. Projects like NEOM are envisioned as global models for smart and sustainable cities relying entirely on renewable energy and advanced technologies like artificial intelligence and robotics. The Red Sea Project is another major initiative reflecting the vision for a leading sustainable tourism sector, adhering to environmental protection standards while contributing to economic diversification and job creation. The Saudi Green Initiative further underscores the Kingdom’s commitment to environmental sustainability by implementing numerous initiatives focused on mitigating climate change.

    In conclusion, the sources portray a Kingdom actively engaged in robust economic growth, driven by the ambitious goals of Vision 2030 and the strategic leadership of the Crown Prince. The focus on diversification, attracting investment, developing key sectors, and promoting sustainability indicates a commitment to long-term economic prosperity and a reduced reliance on traditional oil revenues.

    Saudi Arabia: A Central Actor in Global Affairs

    Based on the sources and our conversation history, Saudi Arabia under the leadership of the Crown Prince actively engages in robust international relations across various fronts. The Kingdom is portrayed as a pivotal player in regional and international affairs, seeking to strengthen alliances, mediate conflicts, promote peace, and foster cooperation on global issues.

    Key aspects of Saudi Arabia’s international relations highlighted in the sources:

    • Strengthening Strategic Alliances: Saudi Arabia actively works to strengthen its relationships with major global powers such as the United States, China, and Russia. This involves diplomatic visits and establishing strategic partnerships aimed at attracting investments and fostering economic cooperation. The Kingdom’s cooperation with major powers is seen as enhancing its position as a supporter of economic and security stability in the world.
    • Regional Leadership and Mediation: Saudi Arabia plays a central role in addressing regional issues. It has been actively involved in mediation efforts to resolve conflicts and promote stability in the Middle East and beyond. The Kingdom’s decision to remain neutral regarding the war in Ukraine, for instance, positioned it as a suitable venue for negotiations between various parties. The sources highlight the Crown Prince’s efforts in mediating prisoner exchanges between Russia and Ukraine and fostering dialogue to prevent further escalation of the conflict.
    • Combating Terrorism and Extremism: The Kingdom is at the forefront of efforts to combat terrorism and extremist ideologies. It has announced numerous initiatives aimed at drying up the sources of intellectual and terrorist extremism and promoting tolerance among peoples. This includes the establishment of centers like the King Abdullah bin Abdulaziz International Centre for Interreligious and Intercultural Dialogue (KAICIID). Saudi Arabia cooperates with other nations in the fight against terrorism.
    • Promoting Coexistence and Interfaith Dialogue: Saudi Arabia emphasizes the importance of peaceful coexistence among peoples and highlights its significant role in serving Islam and Muslims worldwide. The Kingdom places a great responsibility on itself to uphold the teachings of Islam based on moderation and fights extremist ideas in religion. It actively works to promote a culture of respect for diversity and dialogue among followers of different religions and cultures.
    • Support for the Palestinian Cause: Saudi Arabia strongly advocates for the rights of the Palestinian people and the establishment of an independent Palestinian state. The Kingdom has condemned Israeli aggression and continues to urge the international community to recognize the State of Palestine. It has also launched international alliances to implement the two-state solution.
    • Global Humanitarian Efforts: Saudi Arabia, under the guidance of the Crown Prince, provides significant humanitarian aid to numerous countries in need across different continents. The King Salman Humanitarian Aid and Relief Centre coordinates these efforts, assisting countries like Yemen, Syria, Palestine, Sudan, and Ukraine, among many others. These humanitarian policies reflect the Kingdom’s commitment to human dignity and alleviating suffering, regardless of religion, language, or ethnicity.
    • International Environmental Initiatives: Saudi Arabia is actively involved in global efforts to combat climate change and promote environmental sustainability. Initiatives like the Saudi Green Initiative demonstrate the Kingdom’s commitment to reducing carbon emissions, increasing reliance on renewable energy, and planting trees. The Kingdom aims to be a leader in environmental sustainability at the regional and international levels.
    • Hosting International Conferences and Forums: Riyadh has become an important global center for international conferences, including political and economic summits like the G20 summit. This reflects the Kingdom’s growing international prominence and its role in facilitating global dialogue and cooperation.
    • Crown Prince as a Global Peacemaker: The Crown Prince is increasingly being seen as a key figure in global peace efforts. His endeavors to promote regional and international peace and security have garnered international recognition, with some viewing him as a leader capable of achieving lasting geopolitical stability.

    In conclusion, the sources depict Saudi Arabia as an active and influential participant in international relations under the leadership of the Crown Prince. The Kingdom pursues a multifaceted foreign policy focused on strengthening alliances, resolving conflicts, promoting moderation and tolerance, championing key global causes, and playing a significant role in the international arena.

    Saudi Arabia: The Digital Transformation Under Vision 2030

    Based on the sources and our conversation history, digital transformation is a central pillar of Saudi Arabia’s Vision 2030 and is receiving significant attention and investment under the leadership of the Crown Prince. The Kingdom is making rapid strides in leveraging digital technologies to diversify its economy, enhance public services, and improve the overall quality of life.

    Here are the key aspects of digital transformation in Saudi Arabia as highlighted in the sources:

    • Government Focus and Vision 2030: The digital transformation is a key objective of Vision 2030, aiming to establish Saudi Arabia as a technologically advanced nation and a leading digital economy. This vision drives numerous initiatives and investments in the digital sector.
    • Advancements in Digital Infrastructure: The Kingdom has made considerable progress in developing its digital infrastructure, achieving the second rank among the G20 countries in the United Nations’ TII index for telecommunications infrastructure [7, and our conversation history]. This robust infrastructure is a foundation for further digital advancements.
    • Growth of the ICT Market: Saudi Arabia’s information and communication technology (ICT) market is the largest and fastest-growing in the Middle East, North Africa, and Central Asia region, reaching a substantial volume with a significant compound annual growth rate [7, and our conversation history]. This growth indicates a strong demand and potential for digital services.
    • Flourishing Fintech Sector: The financial technology (Fintech) sector has witnessed tremendous development in recent years, attracting over one billion dollars in investments. This growth is supported by dedicated investment funds and encompasses various areas such as:
    • Payment Systems and Transfers: Including the widespread adoption of electronic wallets like STC Pay, Apple Pay, and mada Pay, as well as innovative payment solutions for merchants.
    • Digital Banking: With banks increasingly offering digital services, eliminating the need for branch visits, and utilizing AI-powered chatbots to assist customers.
    • Digital Lending and E-lending: The emergence of direct lending platforms facilitates access to finance for SMEs, and AI is used for risk analysis and personalized loan offerings.
    • E-investment and Trading: Financial applications enable easy investment, and crowdfunding is growing as a way to support small projects.
    • Digital Insurance (Insurtech): Companies offer instant and digital insurance purchase and renewal online.
    • Blockchain Technology: Being explored for secure and transparent financial transactions, smart contracts, and proof of ownership, with the potential for a Saudi digital currency.
    • Emphasis on Emerging Technologies: The Kingdom is actively investing in modern technologies such as artificial intelligence (AI), cloud computing, and the Internet of Things (IoT). These technologies are seen as crucial for developing smart cities and enhancing various sectors.
    • Digital Transformation Across Sectors: Digital transformation is impacting various sectors beyond finance:
    • Government Services: The promotion of electronic services is a key aspect.
    • Education and Health: These sectors have seen improvements through curriculum development, research advancement, and investment in health technologies.
    • Cybersecurity and Data Protection: Recognizing the importance of a robust digital ecosystem, the Kingdom is focused on enhancing cybersecurity to protect customer data from breaches.
    • Smart City Initiatives: Projects like NEOM are envisioned as smart and sustainable future cities that heavily rely on advanced digital technologies.
    • National Recognition: Saudi Arabia is now recognized as a global model in digital transformation, holding a leading position in international digital competitiveness indices.
    • Challenges in the Fintech Sector: Despite significant progress, the Fintech sector still faces challenges such as lengthy processes for obtaining licenses, trust and awareness among individuals, increasing competition, and the need for strong cybersecurity measures.
    • Ongoing Development and Integration: Efforts are underway to further develop digital financial services for SMEs and to foster greater integration between traditional banks and Fintech companies to offer more advanced digital services.

    In conclusion, Saudi Arabia is undergoing a comprehensive digital transformation driven by the goals of Vision 2030 and strong government support. The rapid advancements in digital infrastructure, the thriving Fintech sector, and the focus on emerging technologies are positioning the Kingdom as a significant player in the global digital economy.

    A pledge renewed with great gains and eternal achievements

    Today, Wednesday, Ramadan 26, 1446 AH, corresponding to March 26, 2025 AD, marks the eighth anniversary of the pledge of allegiance to the Crown Prince, His Royal Highness Prince Mohammed bin Salman bin Abdulaziz Al Saud – may God protect him – and the Kingdom is enjoying an era of goodness, growth, and giving in the land of peace and glory. Eight prosperous years have passed, replete with great development. The trust bestowed by the Custodian of the Two Holy Mosques, King Salman bin Abdulaziz – may God protect him – enabled the vision’s sponsor to set out with confidence and passion to build great glory and prosperity in development and the economy, transforming the Kingdom into a strategic economic, political, and military power at the regional and international levels, and implementing numerous reforms that shortened time and achieved numerous accomplishments within a short period. The personality of His Highness the Crown Prince emerged powerfully in the eyes of the world through his accomplishments and his diverse and innovative positions. This is not surprising when we realize that he was raised in the care of the man of wisdom and knowledge, King Salman bin Abdulaziz, from whom he derived leadership, determination, and far-sightedness in every matter. The anniversary of the pledge of allegiance to His Highness the Crown Prince comes in light of a large number of qualitative achievements accomplished by the Kingdom, in which the Crown Prince played a fundamental role, foremost among which is the launch of the Kingdom’s Vision 2030, with its pioneering initiatives and qualitative projects, the fruits of which the Kingdom has begun to reap in terms of strengthening the capacity of the national economy and diversifying its resources. The Kingdom is witnessing significant development in various areas, full of achievements on various educational, cultural, social, health, and economic levels. These years have witnessed qualitative transformations that have confirmed that His Highness the Crown Prince won the bet when he relied on the people of this nation to achieve the goals of his comprehensive vision, which has brought great good to the Kingdom’s sky in the darkest circumstances that the countries of the world are experiencing. Vision 2030 was not just a multi-faceted economic proposal, but rather an official national document in which His Highness the Crown Prince pledged to achieve progress for the nation. Upon launching the vision on April 25, 2016, His Highness said: “We pledge to you that we will be among the best countries in the world in effective government performance to serve citizens. Together, we will complete the building of our country so that it will be as we all hope for it: prosperous and strong, built on the shoulders of its sons and daughters, and benefiting from its capabilities, without being dependent on the value of a commodity or the movement of foreign markets.” The Kingdom is witnessing significant development in various areas, full of achievements on various educational, cultural, social, health, and economic levels. These years have witnessed qualitative transformations that have confirmed that His Highness the Crown Prince won the bet when he relied on the sons of this nation to achieve the goals of his comprehensive vision, which has brought great good to the Kingdom’s sky in the darkest circumstances that the countries of the world are experiencing, from wars and epidemics. After the pledge of allegiance to His Highness the Crown Prince, the development process began to unfold in the Kingdom, with the drawing up of a roadmap for economic transformation in Vision 2030 and the National Transformation Program 2020, led by the Council of Economic and Development Affairs, chaired by His Highness. This has contributed to the Kingdom maintaining its advanced position among nations and competing with major powers in many economic, scientific, and cultural fields. The Kingdom has become a destination for senior leaders, politicians, businessmen, economists, and cultural and artistic giants. The Kingdom has prepared an infrastructure to become one of the largest economic, cultural, and tourism centers in the world, with giant projects transforming it from dependence on oil to diversifying sources of income, and opening up broad horizons of… Work and employment for the citizens of the country

    Our country, thanks be to God, has taken steps that cannot be described, but they are extraordinary by the standards of time and place. No other country in the world could have achieved the change that has taken place in our country, with all this brilliant achievement that was not limited to construction and development and huge projects, despite their importance. Rather, it was the people of this country who changed to levels that they had never expected to reach under any circumstances. This would not have happened had God Almighty not granted us our wise leadership, with the wisdom of the Custodian of the Two Holy Mosques and the ambitious vision of His Highness the Crown Prince, who the Saudi people in all cities, villages and regions of the Kingdom are celebrating the eighth anniversary of His Highness’s assumption of the position of Crown Prince of our dear Kingdom and the launch of Vision 2030, which is A platform for launching our national project, the fruits of which we have begun to reap even before the scheduled date for achieving its declared goals. The ambition of His Highness the Crown Prince is limitless and his passion is beyond imagination. His Highness announced that achieving the goals of Vision 2030 will not be the end of the ambition, but rather the continuation of tireless, uninterrupted work until our country becomes the focus of the world’s attention even more than it is now. The world knows that Vision 2030 and the impressive results it has achieved are only the beginning, and the coming days will bring the miraculous achievement that will, God willing and by His power, be the talk of the world. Our country possesses many economic and investment assets other than oil, and it has religious constants. The cultural, heritage, and societal origins have made it a permanent destination for people from around the world. All of this and more was achieved thanks to God Almighty, then thanks to our leadership, may God protect and guide its steps, and thanks to the unique vision of His Highness the Crown Prince, who taught us that ambition has no limits, that passion has no end, and that loving one’s country and working for its elevation and eminence is a duty that can only be carried out in the most perfect manner.

    Eight years of transformation and renewed ambition

    History remains a witness to the pivotal moments that change the course of nations, and great leaders of every decade acquire the ability to make decisive decisions. Here we see the Custodian of the Two Holy Mosques, King Salman bin Abdulaziz Al Saud – may God protect him – as a unique and wise leader who led the country to achieve accomplishments everywhere. One of his most important decisions was the selection of an exceptional figure who would shoulder the aspirations and dreams of the Saudi people. He is His Royal Highness Prince Mohammed bin Salman bin Abdulaziz, Crown Prince and Prime Minister – may God support him – who has become a model of an inspiring leader who possesses the vision to fulfill the hopes of future generations and contribute to shaping the future. He carries the leadership genes of great leaders who led the Kingdom in successive eras. Prince Mohammed bin Salman was not just a political leader, but a true architect of the renaissance, creative in realizing Vision 2030, which brought major transformations to the Kingdom at all levels. Through this insightful vision, he opened new horizons for the Kingdom, placing it at the forefront of countries embarking on the path of progress and sustainable growth, with an ambitious vision that outlined the future, transforming the Kingdom into a leading regional power and enhancing its international presence. From building future cities to investing in renewable energy, from promoting environmental sustainability to strengthening global partnerships, the foundations of the modern Kingdom have been laid, especially with the announcement of the Kingdom hosting Expo 2030 and the 2034 World Cup. It has become clear that the Kingdom will never stop keeping pace with the future and achieving dreams. His smile has encompassed all aspects of life, starting with building smart cities, investing in clean energy, and preserving the environment, all the way to highlighting the Kingdom in all international forums. We find that the Kingdom has placed itself firmly on the world map, thanks to Vision 2030, which was and remains a legend of the modern era, implemented by an inspiring and unique leader who never gets tired of his dreams. Celebrating the eighth anniversary of the pledge of allegiance to His Royal Highness the Crown Prince is a celebration of the journey of national ambition, a redefinition of the Kingdom’s position on the international stage, and a reminder of the profound allegiance renewed with each passing year. It also reaffirms the deep-rooted loyalty and devotion to a leader who pledges a bright future for his country and his people, and indeed for the region as a whole. On the eighth anniversary of the pledge of allegiance to His Royal Highness Prince Mohammed bin Salman bin Abdulaziz, Crown Prince and Prime Minister – may God support him – a scene of the ambitious vision that transformed the Kingdom’s features and placed it on the map of progress and the future in a changing world is embodied. Since assuming the position of Crown Prince, the young prince has become a symbol of wise and brilliant leadership that moves every wheel toward transformation and innovation, instilling in the nation a new spirit of pride and inspiration, and renewing hope for a prosperous future, not only for the Kingdom but for the entire world.

    Vision 2030 knows no impossible.
    Vision 2030, launched by Prince Mohammed bin Salman, was not just an ambitious plan. Rather, it was a unique roadmap that charted the path for the Kingdom’s development in all political, economic, and social fields. With his creativity and wise leadership, he was able to translate this vision into reality. His most notable achievements were the launch of mega-projects such as NEOM, the futuristic city that is shaping the future of the world, as well as Qiddiya, a city that represents a model for entertainment and innovation. The vision was not limited to building cities only, but also included developing a national economy based on diversity, as the prince is working to reduce dependence on oil, and expand sectors such as technology, renewable energy, tourism, and entertainment, in addition to localizing qualitative industries in all fields, attracting global investments, and even making the capital, Riyadh, the regional headquarters for more than 200 giant companies. An influential leader and strategic planner, Prince Mohammed bin Salman has become a symbol of strategic intellect and thought that looks far ahead. He has played a pivotal role in strengthening the Kingdom’s position in international politics through his prominent role in regional and international issues. He has ensured that the Kingdom is at the forefront of influential positions on major world issues, such as the Yemeni crisis, the Lebanese crisis, and the Russian-Ukrainian crisis. He has also played a pivotal role in establishing the foundations of global peace, and the Middle East in particular. On the economic front, it has become a leader of the economic revolution in the Kingdom. Through the “National Energy Program” and “Sustainable Investment,” it seeks to make the Kingdom a global center for renewable energy, represented by solar energy and hydrogen energy projects, such as “green hydrogen,” which is considered one of the most promising environmental projects in the world. Through these projects, the Kingdom contributes to creating sustainable environmental solutions and once again proves its ability to be a pioneer in confronting global challenges.

    Humanity and Social Change
    Prince Mohammed bin Salman’s humanitarian side was and remains one of the most prominent features of his leadership personality. Through his commitment to empowering Saudi women and providing them with opportunities in work and politics, as well as developing education and society, he has become an inspiring leader for the young generation of Saudis, who now see him as a model of excellence and ambition. His Highness launched initiatives in this regard, such as the “National Empowerment Program,” which has facilitated women’s participation in economic and social life in an unprecedented manner. He worked to draw attention to the importance of education and training, and established an educational and vocational system that prepares a generation of Saudi youth to become at the heart of global development. Therefore, we find that the Kingdom, under his leadership, has become a destination for young people looking to the future, continuing to strive to achieve the ambitions sown by Vision 2030. Preserving the Planet: One of Prince Mohammed bin Salman’s most important concerns is the environment. He was one of the first leaders to realize the importance of environmental change for the human future. The Kingdom was keen to make its role pivotal in preserving the Earth’s environment, investing in renewable and clean energy projects to reduce harmful emissions and protect the planet. The “Green Saudi Arabia” and “Middle East” projects are considered… “Green” is one of the initiatives that embody His Highness’s interest in creating a sustainable future. The launch of “Green Hydrogen” embodies his ability to combine modern technology with environmental protection. The Kingdom’s International Image: His Highness’s role was not limited to the domestic arena, but rather brought about a transformation in the Kingdom’s international image. He demonstrated an exceptional ability to leverage the Kingdom’s soft power, making it a pivotal player in resolving many international crises, whether in the fields of politics or the economy. The significant role played by the Prince in strengthening the Kingdom’s diplomatic relations cannot be denied. The Kingdom has assumed an influential position at the regional and international levels, believing that a policy of dialogue and understanding is the path towards building a more stable world.

    Pledge Day: Loyalty and Commitment
    Celebrating the anniversary of the pledge of allegiance is not limited to ceremonies alone. Rather, it is a day of renewal and loyalty, where the Saudi people express their deep belonging to their country and leadership. It is a moment to renew the pledge of allegiance and covenant with a leader who inspires hope and confidently moves toward the future. On this day, citizens express their pride and appreciation for the achievements made under His Highness’s leadership, affirming their support for the leadership on the path of change and development. The pledge of allegiance is not just a word, but a sincere expression of deep confidence in the leadership’s ability to achieve ambitious visions and reach the global goals it seeks to achieve. His Highness’s vision for the future outlines the Kingdom’s features in the coming years, as the Kingdom prepares to host two important global events: Expo 2030 in Riyadh and the 2034 World Cup. These two events will enhance the Kingdom’s position on the global stage, as the Kingdom will be at the center of the world’s attention, because organizing such events reflects the Kingdom’s economic strength and its transformation into a global cultural and commercial destination. A Leader for the Future with a Global Vision
    On the eighth anniversary of the pledge of allegiance, we can only emphasize that His Royal Highness Prince Mohammed bin Salman, Crown Prince and Prime Minister – may God support him – is an exceptional leader, not only because he works to strengthen the economy and politics, but also because he is a leader with a far-reaching vision and a desire to shape the future in an unconventional way. In less than a decade, he has become a pivotal force in the Kingdom and the world, and with him a new sun rises for the Kingdom, a bright sun that carries within it great ambitions and a hope for a better tomorrow.

    Today, as every day, all Saudis feel great gratitude on the occasion of the eighth anniversary of the pledge of allegiance to His Royal Highness Prince Mohammed bin Salman, Crown Prince – may God protect him. This is a valuable opportunity to express our appreciation for the profound transformations the Kingdom has witnessed under his leadership, especially in areas of foreign policy, which have been one of his most prominent concerns. Since Prince Mohammed bin Salman assumed the position of Crown Prince, Saudi foreign policy has witnessed radical changes, manifested in the adoption of a more dynamic and ambitious approach. Under his leadership, the Kingdom has sought to strengthen its international standing and deepen its relations with major countries, as well as developing its strategic alliances with friendly countries. These transformations were not limited to bilateral relations alone, but also to the Kingdom’s active role in many regional and international issues. This transformation was clearly embodied in the Kingdom’s policy toward the Arab region and the Islamic world. The Kingdom has demonstrated strong and effective leadership in confronting the security and political challenges facing the region, such as the conflict in Yemen and tensions with Iran. Saudi diplomacy, under the leadership of the Crown Prince, has been adept at resolving many conflicts and seeking peaceful solutions that ensure the stability and security of the region.

    Saudi diplomacy: settling disputes peacefully

    Riyadh – Jana Al-Anzi

    Foreign policy achievements were not limited to the region alone, but extended beyond it to include cooperation strategies with major powers such as the United States, Russia, and China, which strengthened the Kingdom’s position as a major supporter of economic and security stability in the world. Riyadh also succeeded in diversifying its economic partnerships by activating cooperation with Asian and African countries, which added new depth to Saudi policy. In addition, the Crown Prince played a crucial role in transforming the Kingdom into a global destination for international conferences. Riyadh has become an important center for economic and political conferences, such as the G20 Summit, reflecting the Kingdom’s evolving role on the global stage. The profound impact of Saudi Vision 2030 on foreign policy cannot be overlooked. This vision has contributed to restructuring many economic and political relations, and achieving a shift in the Kingdom’s strategy in line with future ambitions aimed at building a strong and diversified economy. The Kingdom has succeeded in attracting huge investments from around the world, reflecting international confidence in the Saudi leadership.
    Diplomatic Influences and Political Issues After the Pledge of Allegiance to the Crown Prince
    Since the pledge of allegiance to Crown Prince Mohammed bin Salman in 2017, Saudi foreign policy has entered a new phase of major transformations, with the Kingdom assuming a pivotal role in various regional and international issues.
    Under the leadership of Prince Mohammed bin Salman, the Kingdom has worked to strengthen its relations with major powers, both in the West and the East, gaining it increasing influence on the global stage. Saudi Arabia’s primary goal through this policy was to enhance its global standing and expand its circle of strategic alliances. This was largely achieved through strengthening cooperation with the United States in the areas of security and defense, while simultaneously seeking to open diplomatic channels with countries such as Russia and China, giving the Kingdom the ability to balance among the major global powers. However, Saudi policy was not limited to bilateral relations alone, but extended to complex regional issues that defined the Kingdom’s political orientations. The Yemen war was one of the most prominent challenges facing the Kingdom in recent years. By leading the Arab coalition, the Kingdom sought to support the legitimate Yemeni government in confronting the Iranian-backed Houthis. However, this war was not without costs, as it affected the Kingdom’s domestic and foreign policy and raised questions about its humanitarian and political repercussions. At the same time, tensions with Iran were increasing, especially after attacks on the Kingdom’s oil facilities. However, the Kingdom, under the leadership of the Crown Prince, adopted a policy of caution and appeasement with Tehran, attempting to maintain regional stability while simultaneously seeking to improve its borders and protect its interests. In the Islamic diplomatic arena, the Kingdom maintained its position as a leader of the Islamic world. It continued to provide political and humanitarian support to Islamic countries, while strengthening its relationship with international organizations concerned with the Islamic world. Under the leadership of Prince Mohammed bin Salman, the Kingdom has sought to address some important domestic issues, such as strengthening the economic and social rights of Saudi women, which has positioned Saudi Arabia as a more modern nation on the global stage. Despite what some see as challenges in this area, the Kingdom has been able to witness a qualitative shift in the development of the national economy through “Saudi Vision 2030,” which aims to reduce dependence on oil and achieve economic diversification through mega-projects such as NEOM, which reflects a new vision for the Saudi future.

    On the security front, Saudi foreign policy has been characterized by continuous interaction with the security challenges facing the region. The Kingdom has played a prominent role in combating terrorism and has played a pivotal role in military alliances to combat extremist organizations. Saudi Arabia has also sought to further strengthen its military strength within a defensive framework that ensures regional stability and secures its interests. There is no doubt that Saudi foreign policy under Prince Mohammed bin Salman represents a radical shift that reflects the Kingdom’s great ambitions on the international stage. In addition to achieving its political and strategic goals, the Kingdom seeks to be an influential force in the fields of economy, security, and humanity, reflecting the new directions of its leadership in achieving development and progress in a changing world. Ayman Al-Saqir, a banker at the Embassy of Uruguay, explained how Saudi Vision 2030 has contributed to transforming the Saudi economy from dependence on oil to a free market economy. He said, “The Kingdom of Saudi Arabia’s transition from a quarterly or annual economy to a market economy comes within the framework of a strategic vision aimed at enhancing the development of major projects such as NEOM, the New Square, and Al-Ula, which serves the Kingdom in diversifying sources of national income. This step represents an essential part of the transformation sought by Prince Mohammed bin Salman, as he seeks to move the Kingdom from its dependence on the traditional oil economy to a commercial economy linked to the free market. In this context, the idea of ​​establishing a global free market under the Public Investment Fund was adopted, a step that was recently announced, which enhances the Kingdom’s role as a center Global economic. Saudi Vision 2030 also focuses heavily on developing the tourism sector and relying on it as a major source of income, thus reducing dependence on oil and avoiding the impact of fluctuations in global oil prices.

    The ambassador continued, speaking about the most prominent foreign policy issues, saying, “US-Saudi relations witnessed differences between the terms of Democratic presidents such as Obama and Biden and the Trump era. During the Obama-Biden era, US policy was characterized by a focus on human rights and political issues, while restricting some aspects of military and economic cooperation. During the Trump era, relations developed significantly, as he had a close relationship with Prince Mohammed bin Salman, and military and economic cooperation was at the forefront of the priorities of this relationship, resulting in the signing of military and investment agreements worth $200 billion. In the same context, the Kingdom strengthened its relations with Russia.” “The Kingdom has developed its military and economic capabilities in line with its regional and international standing and power, as major investments have been made in various fields, including oil, energy, and technology. Furthermore, the Kingdom has witnessed huge investments from global companies and investment funds, exceeding one trillion dollars in value, reflecting the Kingdom’s strategic importance in the regional and international arenas.” Saudi Foreign Policy and the Goals of Vision 2030
    Under the auspices of Vision 2030, the Kingdom of Saudi Arabia seeks to redefine its international standing through a multi-dimensional diplomatic strategy aimed at engaging unconventionally with the challenges of the era, thus changing the rules of the foreign policy game.
    The Kingdom is transcending traditional frameworks to become an engine of geopolitical transformation in the Middle East and beyond. Saudi Arabia’s policy is based on the concept of sustainable economic sovereignty, moving beyond the idea of ​​unilateral influence to build strategic partnerships that push toward technological and economic integration with major and emerging global powers. This makes innovation one of the pillars of foreign policy. The Kingdom seeks to become a global center for future technology, capitalizing on its investments in artificial intelligence and renewable energy, including new sectors such as space and smart cities.

    Fahd Al-Tuwairiqi, in his Houston attaché, reported on the contribution of foreign policy to achieving the goals of Vision 2030. He said, “Under Vision 2030, the Kingdom of Saudi Arabia played a pivotal role in attracting the best international companies, as they opened regional headquarters in the Kingdom to serve as a regional headquarters in the Middle East. The Kingdom also aimed to attract investors from countries such as China, Korea, the United States, and Japan, in order to strengthen economic relations and diversify investment sources. In addition, an investment bank was established in cooperation with Japan is the largest reserve bank supporting the Saudi sovereign fund, which enhances the Kingdom’s ability to attract investments and support its major projects. He then continued and said about the future of Saudi relations with major powers such as the United States and China that Chinese relations with Saudi Arabia have become very noticeable recently, as there are currently more than 24 Chinese companies operating in the country. In the Kingdom. Regarding the United States of America, an agreement was reached on investment projects worth $500 billion, with significant support in the military and investment sectors. As for relations with Russia, they are characterized by mutual exchange within OPEC, as Russian President Putin stated: “We are with Saudi Arabia regarding oil, and our decision depends on their decision. We trust the King of the Kingdom and the Crown Prince regarding OPEC.” Regional Changes and the Kingdom’s Strategies in the Middle East The Middle East has witnessed major changes, prompting Saudi Arabia to develop new strategies to enhance its regional and international standing. The Kingdom is focusing on strategic independence and building flexible partnerships with countries such as the UAE, Egypt, and Turkey, while strengthening its role as a mediator in regional crises such as Yemen and its relations with Iran. In the energy sector, it is moving toward renewable projects such as Solar energy and hydrogen are the greenest ways to reduce dependence on oil. Through these strategies, Saudi Arabia seeks to enhance cooperation and influence in the Middle East and build a sustainable regional order.

    Nizar Al-Aoun, Minister of Foreign Affairs, stated, “Five years ago, the regional situation was unstable, and the Kingdom of Saudi Arabia was facing targeting by some countries. Relations between it and Qatar, Turkey, and Iran were tense, which led to the closure of embassies and diplomatic missions in those countries and the absence of an exchange of interests. Today, in the year 2025, thanks to God, the Kingdom has restored its relations with these countries, as there are Saudi embassies and diplomatic missions in those countries. Relations have become stronger than before, thanks to the wise leadership of the King and the Crown Prince, who succeeded in adjusting policies in a manner that is consistent with the Kingdom’s regional situation. Regarding the role that can be played by Saudi Arabia
    Since its founding, the Kingdom of Saudi Arabia has played a pivotal role in the energy sector. It is one of the six OPEC member states and is the main source of energy in the oil market. It is no secret that Saudi Arabia possesses vast gas reserves, ranking third in the world in this field. Despite this, the Kingdom has not been pleased with gas-dependent countries such as Russia and Qatar; on the contrary, it has supported them. Qatar supplies gas to many countries, while Russia supplies European countries. In this context, Saudi Arabia has played an important role in regulating gas prices in a manner consistent with the interests of other countries. On the other hand, four years ago, there were only six international companies operating in the Kingdom. Today, thank God, the number has reached more than 450 international companies with regional offices in the Kingdom, according to a statement by the Minister of Investment, Eng. Khalid Al-Falih. The Kingdom’s Commitment to Its Independent Foreign Policy and Future Challenges The Kingdom of Saudi Arabia continues to adhere to an independent foreign policy, seeking to secure its national interests and direct its international relations in line with its long-term strategies. The Kingdom focuses on building a network of strong alliances and strengthening its pivotal role in resolving regional and international issues, while maintaining its balanced position among major powers. Falah Al-Enezi, Director of Projects at the Ministry of Foreign Affairs, explained that the pledge reflects Saudi Arabia’s commitment to its independent and balanced foreign policy by adopting positions that enhance its national sovereignty and international cooperation in accordance with its strategic interests, while achieving a balance between regional and international relations to ensure stability and development. In conclusion, appreciation is a sophisticated artistic means of expressing appreciation and admiration. In this context, I am pleased to offer a poem expressing our deep appreciation for the Crown Prince and the great achievements the Kingdom has made under his wise leadership. In conclusion, the eighth anniversary of the pledge of allegiance to the Crown Prince, Prince Mohammed bin Salman, highlights how our wise leader has been able to strengthen the Kingdom’s position on the international stage and lead it into the future with confidence and clarity. It is an occasion to celebrate these profound transformations that have made the Kingdom’s foreign policy a driving force for peace and prosperity in the world.

    O source of hope and horizon of the sky
    A call

    Mohammed bin Salman, to glory
    Your steps drew a path in the evening
    And your playing is the eagle’s tune in the open sky
    In your eyes shine the hopes of the homeland
    And in your hands the dreams follow the laws
    With you the Kingdom paves the path of time
    Flying above the winds without a shroud
    I believe that the dream does not stop
    And that hope does not die or go out
    In your heart beats the dawn and expectation
    And in your footsteps dwell elevation and excellence
    Your lines in The sky will not be erased, and your bridge to the future will not collapse. O descendant of glory, the head of injustice. In your hands is light, in your heart is peace. Your courage is ambition, and your determination is fuel. You build glory from every friendly meadow. We have in you an inexhaustible pride. You are the dream of the homeland and its glorious reality.

    News – Ibrahim Al-Shaiban

    The Kingdom’s Credit Rating
    Standard & Poor’s (S&P) raised the Kingdom’s credit rating to “A+” with a “stable” outlook. This has numerous positive impacts on the Saudi economy, including enhancing investor confidence, lowering the cost of borrowing, attracting more foreign investment, supporting the stability of the Saudi riyal, enhancing the growth of the national economy, and improving the global reputation of the Saudi economy.
    Raising the Kingdom’s credit rating to “A+” reflects the strength of the economy and supports its development plans. It attracts investments and reduces financing costs, which enhances the achievement of the goals of Vision 2030.
    Edelman Report
    The Edelman Trust Report 2025 confirmed that the Kingdom has the highest trust globally, with a rate of 87% in the government sector, outperforming many developed countries. The annual report, which is considered one of the most prominent global studies on trust, measures the extent of public confidence in government and indicated a continuous rise in trust levels, indicating that trust in the Kingdom has maintained its high levels. The Kingdom is the most optimistic country in the world about the future, with a rate of 69% compared to other countries worldwide.
    In addition, it continues to lead globally, and the Kingdom has outperformed many major countries in Indicators, such as the United States (47%), Germany (41%), and the United Kingdom (43%). The report revealed that the Kingdom’s government enjoys a trust rate of 87%, making it the most trusted government in the world, starting from strengthening non-oil sectors and creating new job opportunities, to attracting foreign investment and diversifying sources of income. Sustainable Economic Growth
    The Saudi economy recorded strong growth last year, with the gross domestic product (GDP) increasing by a remarkable 3.5% in the third quarter of the year. This growth was supported by rising oil prices and improved performance in non-oil sectors, such as industry and technology. The Kingdom was able to achieve a balance between traditional and modern sectors, which contributed to the stability of the national economy and enhanced its ability to adapt to global changes. The Kingdom witnessed significant success in attracting foreign direct investment (FDI) last year, recording a 15% increase compared to the previous year. This improvement reflects the Kingdom’s encouraging investment environment, achieved through amendments to laws and facilitating procedures to attract international investors. The Kingdom has become an attractive investment destination in various economic sectors. Digital Transformation and Renewable Energy The Kingdom continued to promote digital transformation, launching numerous innovative projects in areas such as artificial intelligence, e-commerce, and digital financial services. This transformation has helped strengthen the technology sector, which has become an essential part of the national economy and has contributed to creating new job opportunities and expanding the digital economy in the Kingdom. Meanwhile, the renewable energy sector in the Kingdom has witnessed remarkable development, with the launch of several new solar and wind energy projects. The Kingdom continues its significant investments in clean energy projects with the aim of reducing dependence on fossil fuels and increasing the share of renewable energy in the national energy mix, in line with its environmental and sustainability goals. Major Projects and Tourism
    The Kingdom has launched several major infrastructure projects, including the development of NEOM and tourism projects on the Red Sea. These projects are considered major drivers of economic growth in the Kingdom, contributing to the creation of massive job opportunities and enhancing the Kingdom’s position as a global economic center. The tourism sector has witnessed a significant leap, with the number of international visitors increasing significantly thanks to facilitative policies that include the issuance of tourist visas and the development of major tourism projects such as the Red Sea Project and Qiddiya City. This growth has contributed significantly to increasing the Kingdom’s non-oil revenues, as Reflects the major transformation in the national economy

    The Kingdom continued to lead the G20 countries in indicators of the growth rate of the number of international tourists and the growth rate of international tourism revenues, according to the latest available data for the first seven months of last year 2024 AD, compared to the same period in 2019 AD. The Kingdom achieved a 73% increase in the number of international tourists, while international tourism revenues recorded a 207% increase, according to the Barometer report issued by the United Nations Tourism Organization in September 2024 AD. Various tourist destinations in the Kingdom have witnessed a significant increase in the number of international tourists this year. Ahmed Al-Khateeb, Minister of Tourism, had previously revealed that the Kingdom received 60 million tourists in the first half of last year, spending approximately 150 billion riyals, a growth rate of 10% compared to the same period last year. He said: “We are proceeding steadily to achieve the target of raising the tourism sector’s contribution to the GDP to 10% by 2030, which represents approximately 600 to 700 billion riyals.” Al-Khatib revealed that Saudi Arabia achieved the highest number of tourists coming from abroad, with about 30 million tourists last year, and the target is to reach 70 million tourists by 2030. Sports Sector: The Kingdom has invested heavily in the sports sector, hosting many international sporting events such as football and boxing championships. Projects have also been launched to develop sports facilities and stimulate youth sports, which has contributed to enhancing the Kingdom’s global image and creating new economic opportunities. Perhaps the most prominent event in sports was FIFA’s official announcement of the Kingdom’s victory in the 2018 FIFA World Cup. Saudi Arabia will host the 2034 World Cup after its bid received the highest rating in the history of the global event, and unprecedented historic support from more than 140 countries. This reflects the international community’s confidence in the Kingdom’s full support for hosting the World Cup. It is certain that the Kingdom will present the best edition in the history of the World Cup in 2034, and the largest edition ever to be organized in a single country. The Kingdom will also be the only country to host the tournament alone in its new format. Most importantly, the Saudis continue to dream, achieve, and write a new history of national accomplishments. They will continue working over the next decade to create an exceptional global event, when the Kingdom welcomes the world. We have achieved the goals of Vision 2030, and many of the features of the new Saudi Arabia have become clear, which the world will witness not only in sports, but also in heritage and civilization, history and culture, tourism and entertainment, and other areas of sustainable development. The Kingdom’s Role in the Global Economy
    The Kingdom continued to strengthen its leading role on the international economic stage through its active participation in OPEC+ and global oil agreements. The Kingdom succeeded in ensuring the stability of global markets. The Kingdom also signed numerous trade and investment agreements with major countries, strengthening its position as a major supporter of economic stability in the region and the world.
    Saudi Economic Highlights
    His Royal Highness Prince Mohammed bin Salman bin Abdulaziz, Crown Prince, Prime Minister, and Chairman of the Council of Economic and Development Affairs, announced the launch of the Machinery Company, which operates in the semiconductor industry and aims to make the Kingdom a global center for electronics.

    Launch of the New Space Group
    The Public Investment Fund (PIF) launched the New Space Group (NSG). The Public Investment Fund (PIF) announced the establishment of the New Space Group (NSG), a wholly owned subsidiary of the Fund, to be a leading national company in the space and satellite services sector.
    It will work to stimulate satellite and space services in the Kingdom and develop capabilities that will contribute to strengthening the sector’s position. Locally, in this growing global field, the Public Investment Fund is the most valuable brand. The Public Investment Fund (PIF), the sovereign wealth fund, topped the list of global brands with more than $1 billion, ranking first globally as the owner of the highest brand value, with $1.1 billion, compared to global sovereign wealth funds. BlackRock was ranked as the most valuable asset management brand in the world, according to a study by the global Brand Finance organization. The Brand Finance study included more than 4,400 companies, media outlets, and specialized audiences in major global markets. It also included qualitative interviews with executives in the sector. The fund is close to its target of assets under management reaching 4 trillion riyals by the end of 2025, noting that the baseline for these figures was 1.5 trillion riyals recorded in 2020.
    Establishment of the National Minerals Program
    The Council of Ministers, chaired by Crown Prince and Prime Minister Prince Mohammed bin Salman, approved the establishment of a National Minerals Program linked to the Ministry of Industry and Mineral Resources.
    The program will be a powerful and supportive tool for enhancing the quality of The adequacy of mineral supply chains, ensuring the continuity of their supply to local industries and major projects, developing the Kingdom’s infrastructure, and achieving the goals of Saudi Vision 2030, plays an effective role in driving growth paths in the minerals sector and exploiting the Kingdom’s mineral wealth. Generative Artificial Intelligence Center
    The Saudi Digital Cooperation Organization announced the launch of the International Center of Excellence for Generative Artificial Intelligence, led by the Kingdom. This is in line with the aspirations of Vision 2030 and its leadership position, as a global force in the field of innovation and advanced technologies, and a supporter of the organization’s efforts. The center aims to enhance the full potential of member states and support their global competitiveness by developing talent and resources to contribute to the adoption of generative artificial intelligence solutions and stimulate the growth of the digital economy. The center, announced during the third edition of the Global Artificial Intelligence Summit in Riyadh this year, 2024, reinforces the Kingdom’s role as a pivotal center in the field of generative artificial intelligence, providing a supportive environment for economic growth and innovation at the regional and global levels.

    The Kingdom’s Communications and Technology Market
    The Communications and Space Technology Commission revealed that the size of the communications and technology market will reach 166 billion riyals in 2023, with a compound annual growth rate of 8% over the past six years, during the tenth edition of the Communications and Technology Indicators Forum for 2024.

    Digital Infrastructure in the Kingdom
    It was announced in September 2024 that the Kingdom achieved second place among G20 countries in the United Nations Telecommunication Infrastructure Index (TII), which assesses the development of digital infrastructure in countries and is a key component of the e-Government Development Index (EGDI).
    The Communications and Space Technology Commission explained that the importance of the index is evident in the pivotal role digital infrastructure plays in measuring the growth and progress of e-government, economic development by attracting investment and stimulating innovation, and social development by improving education and health. The Commission indicated that the Kingdom’s continued progress in this indicator confirms the strength of the Kingdom’s digital infrastructure and its contributions to enhancing the growth and development of the digital economy and attracting investments. The Kingdom’s communications and technology market is the largest and fastest-growing in the Middle East and North Africa region, with mobile telecommunications subscription penetration reaching 198% of the population, and the monthly per capita data consumption rate in the Kingdom exceeding the global average by three times. National Strategy for the Sustainability of the Red Sea
    Prince Mohammed bin Salman bin Abdulaziz, Crown Prince, Prime Minister, and Chairman of the Council of Economic and Development Affairs, launched the National Strategy for the Sustainability of the Red Sea, which aims to protect the Red Sea ecosystem, enhance cooperation frameworks for its sustainability, empower society, and support the transition to a sustainable blue economy. This strategy achieves economic diversification and is in line with the objectives of the Kingdom’s Vision 2030 and the previously launched national priorities for the research, development, and innovation sector, most notably environmental sustainability and basic needs. The Crown Prince said: “The Kingdom of Saudi Arabia continues to unleash its economic, geographical, and cultural potential, and its pioneering efforts in the fields of sustainability and environmental conservation. Through this strategy, the Kingdom strengthens the position of the blue economy as a fundamental pillar of its economy. The Kingdom aspires for the Red Sea region to become a reference for best practices in the blue economy, and for the Kingdom to become a global leader in the field of research, development, and innovation in the blue economy. The Kingdom also affirms its commitment to a sustainable future for the Red Sea, and we look forward to everyone’s cooperation to protect our coasts on the Red Sea, nature, and the communities that depend on it.” The Red Sea is one of the Kingdom’s most distinctive and biologically diverse regions. It is a natural area with an area of ​​​​186,000 square kilometers, a coastline of 1,800 kilometers, the fourth largest coral reef system in the world, home to 6.2% of the world’s coral reefs, and an archipelago containing hundreds of islands. Acquisition of a 15% stake in Heathrow Airport
    The Public Investment Fund announced the completion of the acquisition of a stake of approximately 15% in FGP Topco, the holding company for Heathrow Airport (Heathrow Airport Holdings Limited), from Ferrovial SA, as well as from other Topco shareholders. Heathrow Airport is the largest British airport and the third busiest airport in the world in terms of passenger traffic. Turki Al Nowaiser, Deputy Governor and Director of the General Department of International Investments at the Public Investment Fund, explained that the investment in Heathrow Airport is one of the important assets in the United Kingdom, as it is a world-class airport. The Public Investment Fund’s investment in Heathrow Airport is in line with its strategy to empower important sectors and companies through long-term partnerships within the Fund’s portfolio of international investments.

    Riyadh Metro Operation
    The Royal Commission for Riyadh City announced the operation of the six Riyadh Metro routes consecutively, starting Sunday, Jumada al-Awwal 29, 1446 AH (December 1, 2024 AD). The King Abdulaziz Public Transport Project in Riyadh is one of the ambitious plans developed by the Royal Commission for Riyadh City to provide integrated public transport solutions in the capital and provide the city’s residents and visitors with appropriate public transport services that meet their current and future needs. The project aims to build and operate a fast public transport network in accordance with the latest global technologies, providing residents with economical transportation options that contribute to reducing the excessive use of private vehicles, strengthening the local economy, and preserving the environment. It will also facilitate traffic flow and connect various parts of the city. The Riyadh Metro will contribute to facilitating traffic flow and connecting the various regions. The capital’s various transportation hubs include 6 train lines, 85 train stations, 80 bus lines, 2,860 bus stations, and 842 buses. Train and bus transportation services are integrated into a giant network with a capacity estimated at 1.7 million passengers per day during the initial operational phase. The project costs $22.5 billion. Standard Incentives
    The Ministry of Industry and Mineral Resources and the Ministry of Investment announced the allocation of 10 billion riyals to activate the standard incentives for the industrial sector, which were approved by the Council of Ministers in mid-March. This is to enable industrial investments, stimulate their growth, and achieve sustainable industrial development in the Kingdom, while raising the level of competitiveness of the Saudi industry globally. The Saudi Investment Marketing Authority
    The Council of Ministers approved the organization of the Saudi Investment Marketing Authority. This decision reflects the continued support and backing of the wise leadership for the investment system and the investment environment in the Kingdom, which aims to consolidate the Kingdom’s position as a world-class investment center, in line with the objectives of the Kingdom’s Vision 2030, which seeks to diversify the economy and enhance its competitiveness internationally, to build a prosperous and sustainable economy, and in line with the plans, programs, and objectives of the National Investment Strategy. The decision reflects the state’s keenness to support the investment system and create an investment environment in the Kingdom, which strengthens the Kingdom’s position as a global investment hub. This vision is not far from the goals of Vision 2030, which seeks to diversify the national economy and enhance its competitiveness on the international level. The Authority aims to highlight the Kingdom as an investment destination locally and globally, market investment opportunities in all sectors with all their components, and enhance businesses and services related to investment marketing, in light of the general investment policies and executive plans prepared by the Ministry.

    The Kingdom has achieved a complete digital transformation in the financial sector.

    Riyadh – Ahmed Ghawi

    The financial sector in the Kingdom has received special attention in the objectives of the Kingdom’s Vision 2030, which is directly funded by His Royal Highness Prince Mohammed bin Salman bin Abdulaziz Al Saud, Crown Prince and Chairman of the Council of Ministers – may God protect him. The most prominent achievement in developing this sector has been the work to enhance and develop the trend towards diversifying the state’s resources, and not relying on oil as the sole and primary resource that feeds the state’s budget and injects into the government sector the expenditures of state projects and the entitlements that accrue to citizens, both directly and indirectly.

    The Ministries of Finance and Economy, Planning, and state sectors with an interest in financial aspects, such as the Saudi Central Bank (SAMA), the Zakat, Tax and Customs Authority, and the Efficiency and Spending Authority, and government projects, led the development of the financial sector in accordance with the vision and achieved the trend towards establishing an advanced financial structure for the state, based on continuous reforms since the launch of the vision in 2016. We are currently celebrating the eighth anniversary of the reign of the vision’s sponsor, His Highness Prince Mohammed bin Salman, as Crown Prince. We see growth and development in multiple sectors operating according to a clear strategy. State agencies are cooperating in broad partnership with the private sector to continue the path of growth and prosperity for the Saudi economy, which has been noted by the International Monetary Fund and neutral global bodies. It has also been confirmed by the continued positive trajectory of the economy’s credit ratings and the optimism that it will achieve increasing growth leaps. Diversification: A Fundamental Pillar
    According to recent reports from the Ministry of Finance, the Kingdom of Saudi Arabia relies on a diverse set of resources for its revenues, which constitute the cornerstone of its national economy. Oil and gas revenues are at the forefront of these sources, based on the Kingdom’s energy wealth. Non-oil revenues also play an increasing role, including zakat, taxes, and various fees, in addition to revenues generated from strategic investments. For its part, the Public Investment Fund effectively manages these investments through an integrated portfolio of projects at home and abroad that aim to diversify sources of income, strengthen the national economy, and reduce dependence on oil, in line with Saudi Vision 2030. These efforts contribute to building a strong and sustainable economy that enhances the Kingdom’s position in global markets. The annual state budget
    The annual budget of the Kingdom of Saudi Arabia is viewed as a pivotal milestone in the path of economic and financial reforms led by the Kingdom’s government under the umbrella of Saudi Vision 2030. The Ministry of Finance prepares it according to a systematic process that begins with the preparation phase, then approval, and ends with implementation, benefiting from automation programs to enhance performance efficiency. The budget includes an introduction to its financial targets for the current year, along with reports. Performance indicators that illustrate spending across various sectors, and highlight the most prominent projects that represent a qualitative turning point that contributes to achieving sustainable development and strengthening the Kingdom’s position at the regional and international levels. Initial forecasts for 2025 show real GDP growth of 4.6%, supported by an increase in the GDP of non-oil activities. This growth comes as a result of economic reforms and efforts to accelerate economic diversification with the aim of promoting sustainable economic growth. In addition, programs and initiatives that empower and stimulate the private sector contribute to making it the main factor of economic growth and contribute to creating new and sustainable job opportunities in the labor market. The effective implementation of the programs and projects of Saudi Vision 2030 continues, as they are the main tool for achieving the goals of economic transformation.

    Transparency to ensure sustainability
    The state budget is linked to achieving the goals and objectives of Vision 2030. The Ministry of Finance is required to explain its preparation of the budget transparently to ensure sustainability and achieve future aspirations.
    The budget is subject to legislative and regulatory scrutiny and is based on the system.
    The Basic Law of Governance and the state’s general budget require all government agencies to implement the principles of budget governance, most notably achieving transparency and reliability. The predictability of fiscal policy, the implementation of a policy that is aligned with Saudi Vision 2030 and any other national strategy or priority, as well as a comprehensive and participatory discussion regarding budget planning, and the availability of open data and documents with transparency and accessibility. The achievements of the Vision 2030 programs continue on the ground, and their objectives are fully achieved ahead of schedule, indicating the precise, meticulous, and rapid work of state institutions. To achieve the specified goals in record time, at a rapid pace, reflecting the desire of the state and the Saudi citizen to race against time in order to build modern Saudi Arabia and strengthen its pillars according to the vision’s goals and comprehensive aspirations, foremost among which is the national economy, which has shifted its compass from an economy dependent on oil income to a multi-source economy. In this regard, we note the “Financial Sustainability” program as one of the first programs to achieve Vision 2030, whose recent achievements are highlighted by the decision of the Council of Economic Affairs to end it after it had fully achieved its goals before 2030. It was launched at the end of 2016 under the name of the Fiscal Balance Achievement Program, and later transformed into the Financial Sustainability Program. Over these years, the program has achieved a set of objectives, including its ability to promote a positive transformation in the Kingdom’s public finances, through the implementation of strategic financial reforms and the establishment of effective entities that have helped diversify sources of income, enhance the efficiency of government spending, and improve financial planning capabilities.

    Maximizing Revenues
    Added to the program’s achievements is achieving fiscal balance, monitoring and disbursing financial performance, with the aim of maximizing oil and non-oil revenues, increasing the efficiency of government spending, and managing the associated risks, while maintaining adequate financial reserves and a high and sustainable capacity to borrow from local and international financial markets, in accordance with the medium-term public debt strategy, in order to achieve financial sustainability. Over the past years of the vision, the Financial Sustainability Program has witnessed the implementation of several initiatives that have achieved its objectives, including: raising the efficiency of government operational spending, establishing the Strategic Procurement Unit, and the Government Spending and Projects Efficiency Authority, in addition to continuing to achieve its objectives through the implementation of the financial reforms approved in the program, including the Citizen Account, incentive packages for the private sector, the application of the financial levy on expatriates, value-added tax, correcting energy prices, and increasing customs duties on some goods. The program has also proven its effectiveness and efficiency during the COVID-19 pandemic, contributing to monitoring and managing financial performance with the aim of maximizing oil and non-oil revenues, raising the efficiency of government spending, and managing associated risks, while maintaining adequate financial reserves and a high and sustainable capacity to borrow from local and international financial markets, in accordance with the medium-term public debt strategy.

    The Vision 2030 Realization Programs are medium-term entities, most of which were created after the Vision was launched, as the primary tools for implementation. These programs have contributed effectively over the past years to enhancing levels of cooperation within the system, accelerating the pace of achievement, and exceeding the Vision for a number of its ambitious goals. The Financial Technology Sector
    The financial technology (Fintech) sector in the Kingdom has achieved tremendous development in recent years, thanks to Vision 2030, which seeks to transform the Kingdom into an advanced financial and technological center. Fintech aims to integrate technology with the financial sector, contributing to the provision of more efficient and flexible solutions, helping to achieve financial inclusion, and transforming the economy into a cashless environment based on electronic payments.

    • Factors Supporting the Development of Fintech in Saudi Arabia
      A. The Saudi Vision and Government Support
      The vision seeks to promote digital transformation and reduce reliance on cash by encouraging startups, updating laws, and investing in financial technology. Among the most important government initiatives are:
    • Launching “Fintech Saudi” in 2018 to support entrepreneurs and startups in financial technology.
    • Expanding the “legislative experiment” environment, which allows companies to test their products and services before obtaining an official license from the Saudi Central Bank (SAMA) or the Capital Market Authority.
    • Adopting the “Sarea” instant payments system, which enables financial transfers between banks in seconds.
    • Launching the Saudi Central Bank’s pilot digital currency to test the potential of adopting national digital currencies.

    B. Increased Demand for Digital Solutions

    • The prevalence of smartphones and the internet among the population, making digital financial services more widely accepted.
    • Increased interest in electronic payments after the COVID-19 pandemic, with the percentage of non-cash transactions rising to 70% of total financial transactions.
      C. Growth in FinTech Investments
    • The sector has attracted investments exceeding $1 billion in recent years, reflecting growing confidence in the market.
    • The presence of specialized investment funds, such as the FinTech Fund and the Public Investment Fund, to support emerging companies in this field. 2. FinTech Fields in Saudi Arabia
      The Saudi FinTech sector includes a wide range of financial services, including:
      A. Electronic Payment and Transfer Systems
    • The rise of electronic wallets such as Mada, STC Pay, Apple Pay, UrPay, and BayanPay
    • Providing innovative payment solutions to online merchants such as Tabby and Tamara, which offer the “buy now, pay later” service.
      B. Digital Banking
    • Digital bank accounts have become more prevalent, with all banks providing financial services without the need to visit branches. Some banks offer smart chatbots that rely on artificial intelligence to assist customers.
      C. Digital Finance and Electronic Lending
    • The emergence of direct lending platforms that allow small and medium-sized enterprises to obtain financing without the need for traditional banks. • Using artificial intelligence to analyze risks and provide tailored loans to individuals and companies.
      D. Online Investment and Trading
    • The rise of financial applications that enable individuals to invest easily.
    • The growth of crowdfunding, where investors can support small businesses in exchange for future profits.
      E. Digital Insurance (Insurtech)
    • The emergence of companies that provide instant digital insurance, where insurance can be purchased and renewed online in minutes.

    F. Islamic Fintech Solutions

    • Providing Sharia-compliant financial solutions, such as:
      Islamic finance, digital sukuks, and electronic zakat.
      Modern Technologies Used in Saudi Fintech
      A. Artificial Intelligence and Data Analysis
    • Smart algorithms are used to analyze spending patterns and provide financial recommendations to individuals.
    • Developing intelligent chatbots to assist customers in conducting transactions with ease.
      B. Blockchain Technology
    • Its use in money transfers, smart contracts, and digital proof of ownership, enhancing transparency and security in financial transactions.
    • Testing the Saudi digital currency as part of the future of the digital economy.
      C. Cloud Computing and Information Security
    • Relying on cloud services to provide flexible and fast financial systems.
    • Enhancing cybersecurity to protect customer data from breaches.
    1. Challenges Facing the FinTech Sector in Saudi Arabia
      Despite significant growth, it still remains The sector faces some challenges, such as:
    2. Regulations and licensing:
      Some startups need a long time to obtain legal permits to operate.
    3. Trust and awareness: Some individuals still prefer cash transactions due to concerns about digital fraud.
    4. Strong competition: The presence of an increasing number of fintech companies requires the development of new solutions to remain in the market.
    5. Cybersecurity:
      Companies need strong protection systems to prevent attacks. Electronic fraud and data theft.
    6. The Future of Financial Technology in Saudi Arabia
      A. Increasing Reliance on Artificial Intelligence
    • Improving financial analysis systems and providing smart recommendations to users.
    • Developing predictive solutions that enhance financial planning for individuals and companies.
      B. Expanding Use of Digital Currencies
    • Possible Launch of the Saudi Digital Riyal to Enhance Digital Payments
    • Integrating Blockchain into Banking Services to Secure Transactions.
      C. Promoting Financial Inclusion
    • Providing financial solutions to individuals who do not have bank accounts through digital wallets.
    • Developing financial services that meet the needs of small and medium-sized enterprises.
      D. Greater integration between fintech and traditional banks.
    • Major banks are collaborating with fintech companies to provide advanced digital services.
    • Developing platforms that allow customers to manage all their financial accounts through a single application. Saudi Arabia is today a pioneer in the field of financial technology in the region, and is rapidly moving towards achieving a complete digital transformation in the financial sector. Thanks to government support and investment in innovation, financial technology will continue to expand, making financial services easier, safer, and more efficient for users.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Comprehensive Guide to GitLab CI/CD Pipelines and AWS Deployment

    Comprehensive Guide to GitLab CI/CD Pipelines and AWS Deployment

    The provided text offers a comprehensive guide to utilizing GitLab’s CI/CD features for software development and deployment. It begins by explaining the fundamentals of creating and troubleshooting GitLab pipelines using YAML configuration files, including common mistakes and account verification. The source then introduces continuous integration (CI) principles and demonstrates how to automate build and test processes for a React website within GitLab. Furthermore, it explores continuous delivery (CD) by detailing the deployment of the website to AWS S3, covering topics such as bucket policies, public access, and environment management. The text culminates in illustrating more advanced deployment strategies using Docker and AWS Elastic Beanstalk, encompassing containerization, image management, and automated application updates.

    GitLab CI/CD and DevOps Study Guide

    Key Concepts Review

    This section outlines the core concepts covered in the source material. Review each point to solidify your understanding.

    • GitLab CI: Understand what GitLab CI is and its role in automating software development workflows.
    • CI/CD Pipelines: Describe the concept of Continuous Integration and Continuous Delivery/Deployment pipelines.
    • DevOps: Explain the fundamental principles of DevOps and how GitLab CI supports these principles.
    • Automation: Recognize the importance of automation in the software development lifecycle.
    • GitLab Projects: Understand how to create and manage projects within GitLab.
    • .gitlab-ci.yaml: Explain the purpose and structure of the GitLab CI configuration file.
    • Jobs: Define what a job is in GitLab CI and how it’s configured.
    • Scripts: Understand how to define and execute shell commands within a GitLab CI job.
    • Stages: Explain how stages organize jobs in a pipeline and their sequential execution.
    • Docker: Understand the basics of Docker and its use in GitLab CI for consistent environments.
    • Docker Images: Explain how to specify and use Docker images in GitLab CI jobs.
    • YAML: Understand the basic syntax of YAML, including key-value pairs, lists (sequences), and indentation.
    • GitLab Runner: Understand the role of the GitLab Runner in executing pipelines.
    • Artifacts: Explain how to define and use job artifacts to pass data between jobs.
    • Testing: Recognize the importance of automated testing within CI/CD pipelines.
    • Variables: Understand how to define and use local and global variables in GitLab CI, including CI/CD variables and environment variables.
    • Merge Requests: Describe the purpose of merge requests and their integration with GitLab CI pipelines.
    • Rules: Explain how rules are used to control when jobs are executed based on conditions like branch names.
    • AWS (Amazon Web Services): Understand the basics of AWS and its role as a cloud provider for deployment.
    • AWS S3 (Simple Storage Service): Explain the purpose of S3 for storing and serving static website files.
    • AWS CLI (Command Line Interface): Understand how to interact with AWS services using the AWS CLI.
    • IAM (Identity and Access Management): Explain the purpose of IAM users and policies for managing access to AWS resources.
    • Environments: Understand how GitLab environments help manage and track deployments to different stages (e.g., staging, production).
    • Continuous Delivery vs. Continuous Deployment: Differentiate between these two concepts and how GitLab can support both.
    • Docker Registry: Understand the purpose of a Docker registry for storing and sharing Docker images, including the GitLab Container Registry.
    • Services (in GitLab CI): Explain how services, like Docker in Docker (DinD), can be used to provide necessary tools within a CI/CD job.
    • Dockerfile: Understand the purpose and basic syntax of a Dockerfile for defining Docker images.
    • Elastic Beanstalk: Understand the basics of AWS Elastic Beanstalk as a Platform-as-a-Service (PaaS) for deploying web applications.

    Short-Answer Quiz

    Answer the following questions in 2-3 sentences each.

    1. What is the primary purpose of GitLab CI?
    2. Explain the role of the .gitlab-ci.yaml file in a GitLab project.
    3. Describe the relationship between jobs and stages in a GitLab CI pipeline.
    4. Why is Docker often used in conjunction with GitLab CI?
    5. What are GitLab Runner(s) responsible for in the CI/CD process?
    6. How can you pass data between different jobs in a GitLab CI pipeline?
    7. What is the benefit of using environment variables in GitLab CI?
    8. Explain the purpose of AWS S3 in the context of deploying a static website.
    9. How does IAM help secure your AWS resources when using GitLab CI for deployment?
    10. What is the key difference between Continuous Delivery and Continuous Deployment?

    Quiz Answer Key

    1. GitLab CI’s primary purpose is to automate the software development lifecycle, specifically the building, testing, and deployment of code changes. This automation ensures faster feedback, reduces manual errors, and enables more frequent releases.
    2. The .gitlab-ci.yaml file is the configuration file for GitLab CI/CD pipelines. It defines the stages, jobs, and scripts that will be executed automatically whenever code is pushed to the repository or a merge request is created.
    3. Jobs are the individual units of work in a GitLab CI pipeline, defining specific actions like compiling code or running tests. Stages organize these jobs into logical phases that are executed sequentially, ensuring a defined workflow.
    4. Docker provides consistent and isolated environments for GitLab CI jobs. By specifying Docker images, you ensure that the build, test, and deployment processes have the necessary dependencies and configurations, regardless of the underlying infrastructure.
    5. GitLab Runners are the agents that execute the jobs defined in the .gitlab-ci.yaml file. They pick up jobs from the GitLab server and run the specified scripts within the configured environment, reporting the results back to GitLab.
    6. Data can be passed between different jobs in a GitLab CI pipeline using artifacts. Artifacts are a collection of files and directories created by a job that can be downloaded by subsequent jobs in the same pipeline.
    7. Environment variables in GitLab CI allow you to configure jobs dynamically without hardcoding values in the .gitlab-ci.yaml file. This is useful for storing sensitive information like API keys, configuring different deployment environments, and making the pipeline more flexible and reusable.
    8. AWS S3 (Simple Storage Service) is used to store the static files (HTML, CSS, JavaScript, images) of a website in the cloud. GitLab CI can automate the process of uploading these files to an S3 bucket, which can then be configured to serve the website to users over the internet.
    9. IAM (Identity and Access Management) allows you to create users with specific permissions to access AWS resources. When using GitLab CI for deployment, you create an IAM user with limited permissions (e.g., only to upload to a specific S3 bucket) and use its credentials in GitLab CI variables, enhancing security by avoiding the use of root account credentials.
    10. Continuous Delivery is the practice of automating the release process so that code can be deployed to production at any time, but the final decision to deploy is made manually. Continuous Deployment goes a step further by automatically deploying every code change that passes the automated tests directly to production without manual intervention.

    Essay Format Questions

    1. Discuss the benefits of implementing a CI/CD pipeline using GitLab CI for a software development team. Consider aspects such as development speed, code quality, and deployment reliability.
    2. Explain the role of Docker in creating reproducible and consistent environments for CI/CD pipelines. Describe how specifying Docker images in GitLab CI helps achieve these benefits.
    3. Compare and contrast the use of global variables defined at the top level of .gitlab-ci.yaml with CI/CD variables defined in the GitLab project settings. When might you choose one over the other?
    4. Describe the steps involved in deploying a static website to AWS S3 using GitLab CI. Include details about configuring the .gitlab-ci.yaml file, setting up AWS credentials, and making the website publicly accessible.
    5. Discuss the transition from a Continuous Integration and Continuous Deployment pipeline to a Continuous Delivery pipeline. What changes would be necessary in your GitLab CI configuration and overall workflow to implement continuous delivery?

    Glossary of Key Terms

    • CI (Continuous Integration): A development practice where code changes are frequently integrated into a shared repository, followed by automated building and testing.
    • CD (Continuous Delivery): An extension of CI that ensures the software is always in a deployable state, allowing for manual deployment to production.
    • CD (Continuous Deployment): An extension of CI where every code change that passes automated tests is automatically deployed to production.
    • DevOps: A set of practices that integrates software development (Dev) and IT operations (Ops) to shorten the development lifecycle and provide continuous delivery with high software quality.
    • Pipeline: In GitLab CI, a pipeline represents the entire automated process from code commit to deployment, defined in the .gitlab-ci.yaml file.
    • Job: A specific task or action executed by a GitLab Runner as part of a pipeline, defined under a stage in the .gitlab-ci.yaml file.
    • Stage: A logical division within a GitLab CI pipeline that groups related jobs. Jobs within a stage run in parallel, and stages are executed sequentially.
    • Script: A set of commands (usually shell commands) defined within a GitLab CI job that the GitLab Runner executes.
    • Artifact: A collection of files and directories produced by a GitLab CI job that can be downloaded or used by subsequent jobs.
    • Docker Image: A lightweight, standalone, executable package that includes everything needed to run a piece of software, including the code, runtime, system tools, system libraries, and settings.
    • Docker Container: A running instance of a Docker image.
    • YAML (YAML Ain’t Markup Language): A human-readable data serialization language commonly used for configuration files, including GitLab’s .gitlab-ci.yaml.
    • GitLab Runner: An application that works with the GitLab CI/CD coordinator to execute jobs in a pipeline.
    • Variable: A named storage location that holds a value, used in GitLab CI to configure pipelines and jobs dynamically.
    • Merge Request: A request to merge changes from one branch into another, often triggering a GitLab CI pipeline for validation.
    • Rule: A conditional statement in GitLab CI that determines if and when a job should be executed.
    • AWS (Amazon Web Services): A comprehensive and broadly adopted cloud platform, offering a wide range of services including computing, storage, and databases.
    • AWS S3 (Simple Storage Service): A scalable, high-performance object storage service offered by AWS, often used for storing static website files.
    • AWS CLI (Command Line Interface): A tool that allows you to interact with AWS services using commands in a terminal.
    • IAM (Identity and Access Management): An AWS service that enables you to manage access to AWS services and resources securely.
    • Environment: In GitLab, an environment represents a deployment target (e.g., staging, production) and provides a way to track deployments and related information.
    • Docker Registry: A service that stores and distributes Docker images, allowing users to pull and push images. GitLab has its own Container Registry.
    • Dockerfile: A text document that contains all the commands a user could call on the command line to assemble a Docker image.
    • Elastic Beanstalk: An easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, and IIS.
    • Service (GitLab CI): Allows you to define and run additional containers alongside your main job container, often used to provide dependencies or simulate external services (e.g., Docker in Docker).

    Briefing Document: GitLab CI/CD with AWS Course Review

    This document provides a detailed review of the main themes, important ideas, and facts presented in the excerpts from the GitLab CI/CD with AWS course taught by Valentine. The course focuses on automating software build, test, and deployment pipelines using GitLab CI and deploying to Amazon Web Services (AWS).

    Main Themes

    1. Introduction to GitLab CI and DevOps: The course aims to introduce beginners to the concepts of DevOps and how GitLab CI can be used to implement CI/CD pipelines. Valentine positions himself as a passionate software developer eager to share his knowledge in an accessible way.
    2. Automation of Software Delivery: A central theme is the automation of the software delivery process. The course emphasizes building pipelines that automatically build, containerize, test, and deploy applications to AWS, reducing manual effort and potential errors.
    3. Hands-on Learning: The course adopts a practical, hands-on approach, encouraging learners to build pipelines and deploy software to AWS through exercises and assignments. Valentine emphasizes “learning by doing.”
    4. GitLab CI Fundamentals: The course covers the basics of GitLab CI, including creating projects, understanding the .gitlab-ci.yaml file, defining jobs and stages, and understanding pipeline execution.
    5. Integration with AWS: A significant focus is on integrating GitLab CI with AWS to deploy applications to the cloud. The course introduces key AWS services like S3 and Elastic Beanstalk.
    6. Importance of Testing: The course highlights the role of automated testing in ensuring the quality and reliability of software deployments. It covers adding test jobs to the pipeline and validating deployments.
    7. Managing Environments: The course touches upon the concept of managing different environments (e.g., staging, production) within GitLab and deploying to them in a controlled manner.
    8. Docker and Containerization: Docker is introduced as a key technology for building and deploying applications consistently across different environments. The course covers building Docker images within GitLab CI.
    9. Version Control with Git and GitLab: The course implicitly relies on Git for version control and uses GitLab as the platform for hosting repositories and running CI/CD pipelines.
    10. Best Practices: Throughout the course, Valentine introduces various best practices related to CI/CD, such as using infrastructure as code (Dockerfiles), automating testing, and managing deployment environments.

    Most Important Ideas and Facts

    • GitLab CI as a Tool for DevOps: GitLab CI is presented as a crucial tool for implementing DevOps practices, particularly continuous integration and continuous delivery/deployment.
    • “in this course valentine will teach you how to use gitlab ci to build ci cd pipelines to build and deploy software to aws hello frequent campers and welcome to this course which will introduce you to gitlab ci and devops”
    • CI/CD Pipeline Workflow: The course walks through creating a pipeline that takes a simple website, builds a container, tests it, and deploys it to AWS.
    • “during the course we’ll create a pipeline that takes a simple website builds a container tests it and deploys it to the amazon web services cloud also called aws”
    • Focus on Automation: The core purpose of GitLab CI is to automate the software delivery process.
    • “in other words we’ll be focusing on automation”
    • No Prior Knowledge Required (Mostly): The course is designed for beginners with no prior DevOps or GitLab CI experience, and minimal coding knowledge is needed initially.
    • “I’ve created this course for people new to devops who want to use gitlab to build test and deploy their software don’t worry if none of this makes sense right now if you’re a beginner that is totally fine you don’t need to install any tools or anything else also no coding knowledge is required”
    • Importance of Course Notes: The course notes contain valuable resources, troubleshooting tips, corrections, and updates.
    • “go right now to the video description and open the course notes there you will find important resources and troubleshooting tips if something goes wrong I will also be publishing there any corrections additions and modifications”
    • Learning DevOps Concepts: While focusing on GitLab CI and AWS, the underlying concepts are applicable to other technologies and cloud providers.
    • “well in this course we’ll be focusing on a specific technology and cloud provider what you’re actually learning are the concepts around devops”
    • Using gitlab.com: The course primarily uses the hosted version of GitLab at gitlab.com.
    • “I’ll be using gitlab.com throughout the course if you don’t have a gitlab.com account please go ahead and create one”
    • .gitlab-ci.yaml File: The pipeline definition is stored in a file named .gitlab-ci.yaml in the root of the GitLab repository. The exact naming and syntax are crucial.
    • “this file name must be called dot gitlab dash ci dot yaml if it’s not exactly this name if you’re writing it on your own this pipeline will not be recognized so the pipeline find will not be recognized by gitlab this is a very common mistake that beginners make”
    • Jobs and Stages: A pipeline consists of jobs organized into stages. Jobs are sets of commands to be executed.
    • “what is a pipeline it is a set of jobs organized in stages right now we have a single job that belongs to the test stage however in the upcoming lectures we’ll be expanding this pipeline”
    • YAML Syntax: GitLab CI pipelines are defined using YAML, a human-readable data serialization language based on key-value pairs, lists (sequences), and indentation for structure. Correct syntax and indentation are critical.
    • “the language that we’re using here to describe our pipeline is called yaml and yaml is essentially a way to represent key value pairs it may look a bit weird in the beginning but after a few examples I’m sure you will get used to it”
    • GitLab Runner: The GitLab server manages pipeline execution, and GitLab Runners are the agents that execute the jobs. The course uses the GitLab.com infrastructure, so managing runners is abstracted away for beginners.
    • “at the minimum the gitlab architecture for working with pipelines contains the gitlab server and at least one gitlab runner the gitlab server manages the execution of the pipeline and its jobs and stores the results the”
    • Docker Images for Jobs: Each job in a GitLab CI pipeline typically runs within a Docker container specified by the image keyword. This ensures a consistent execution environment.
    • “in the previous execution we haven’t specified a docker image to use and by default it will download a ruby docker image which for our use case here doesn’t really make a lot of sense so we’re going to use a very simple docker image it’s a linux distribution that will be started with our job”
    • Artifacts: Jobs can produce artifacts, which are files or directories that can be passed between jobs or downloaded at the end of the pipeline.
    • “so we have managed to create this file and we want to pass it to the next job and the way we do that in gitlab is by using artifacts”
    • Testing in the Pipeline: Automated tests are crucial for verifying the correctness of the build and deployment. Test jobs execute commands to validate the application.
    • “tests also play a very particular role when we’re working on this pipeline when we’re building software there are many various levels of testing but essentially tests allow us to make changes to our software or to our build process and to ensure that everything works the same”
    • Variables: Variables can be defined at different levels (global, job, environment) to store configuration values and avoid hardcoding them in the .gitlab-ci.yaml file. Environment variables are automatically available to the jobs.
    • “quite often when we have something that we are searching multiple times inside a file or inside the configuration we want to put that into a variable and that way if it’s inside a variable if we need to make changes to that particular value we only have to change it once and then it would be replaced all over”
    • Merge Requests: Merge requests in GitLab are used for code review and collaboration. Pipelines can be configured to run against the branch associated with a merge request.
    • “quite often when we are creating branches we tend to use some naming conventions now totally up to you what you want to use or how your organization uses that quite often you will have something like feature for example for what slash and then a name of a feature sometimes you may reference a ticket or something like that so for example you have your ticket number one two three four add linter”
    • Rules for Job Execution: The rules keyword allows defining conditions under which a job should be executed, such as only running on the main branch.
    • “in order to achieve this we still need to make a few changes to our pipeline now this is how the configuration looks like at this point and the changes that we need to make are here in the deploy to s3 job now how do we exclude this job from this pipeline which is running on the branch and to ensure that it only runs on the main branch gitlab has this feature which is called rules”
    • AWS S3 for Static Websites: AWS S3 can be used to host static websites by storing public files in buckets and serving them over HTTP.
    • “since our website is static and requires no computing power or database we will use aws s3 to store the public files and search them to the word from there over http”
    • AWS CLI: The AWS Command Line Interface (CLI) is a tool for interacting with AWS services from the command line, which is essential for automating deployments.
    • “for the aws cloud we need a command line interface to be able to upload files for example and fortunately aws has already thought about that and there is an official aws command line interface that we can use”
    • IAM for AWS Credentials: AWS Identity and Access Management (IAM) allows creating users with specific permissions to access AWS services securely. Access keys (ID and secret) are used for programmatic access via the CLI.
    • “the thing is how is aws cli supposed to know who we are I mean if this would work as it is right now we should be able to upload files to any bucket that belong to other people or to delete objects from buckets that belong to other people so we need to tell aws cli who we are and this is what we’re going to do in the upcoming lectures”
    • Environment Variables for AWS Credentials in GitLab CI: AWS access key ID, secret access key, and region can be securely provided to the GitLab CI pipeline as environment variables. Specific variable names (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) are recognized by the AWS CLI.
    • “I’m going to start here writing aws and you will see there already some predefined things that pop up so one of them is aws access key id this has to be written exactly as you see it here there’s something that’s different about this away cli will not be able to pick up this variable it will look exactly for this variable name and will automatically pick it up without us doing anything else so it has to be exactly as it is”
    • S3 Bucket Policies for Public Access: To make a static website hosted on S3 publicly accessible, a bucket policy needs to be configured to allow public read access.
    • “in order to make our website that we have uploaded to s3 publicly accessible we need to do something additional and that is to change the bucket policy”
    • Continuous Delivery vs. Continuous Deployment: The course explains the difference, with continuous deployment involving automatic deployment to production upon successful builds and tests, while continuous delivery requires manual approval for production deployment. GitLab offers “manual jobs” to implement continuous delivery.
    • “what is a continuous delivery pipeline this is exactly what I wanted to show you essentially a continuous delivery pipeline is just a pipeline where we don’t automatically deploy to production essentially what we want to do is add here a button and only when we are sure that we really want to make that change to production we can click on that button and make that change so let me show you how to do this”
    • Dockerfiles for Building Docker Images: A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. It’s a declarative way to define a Docker image.
    • “in order to build our own docker image we need to create a file which is called docker file so inside our project i’m going to create a new file and the name of the file has to be exactly like this docker file with a capital d and no extension”
    • Docker in Docker (dind) Service in GitLab CI: To build Docker images within a GitLab CI job, a Docker in Docker service needs to be defined in the .gitlab-ci.yaml file.
    • “in order to be able to run this docker command we also have to define the image that we’ll use and the image will be docker just using this docker image will not work we’re gonna get an error the reason for that is the docker architecture is composed of a client and a server essentially what we have here docker this is the client and the client sends some instructions to a server actually to the docker demon which is the one who builds the job and in order to get access to a daemon inside gitlab ci we need to use a concept and that concept is of services we want to define here a tag services and this contains a list of services that we can start and what we’re starting here is actually service called docker in docker”
    • GitLab Container Registry: GitLab provides a private Docker container registry for storing and managing Docker images associated with projects.
    • “both aws and gitlab offer private docker registries and for this example we’ll be using the docker registry offered by gitlab and you’ll see here on the left hand side packages and registry and we’re going to use here the container registry because docker is all about working with containers”
    • Docker Login and Push: To save a Docker image to a registry, the GitLab CI job needs to log in to the registry using docker login and then push the image using docker push. GitLab provides predefined variables (CI_REGISTRY_USER, CI_REGISTRY_PASSWORD, CI_REGISTRY_IMAGE) for accessing its container registry.
    • “the command to login is docker login relatively easy and we’re going to specify username and password for this service we’re not actually using our username and password that we used to log into gitlab we’ll use some variables again that will give us some temporary user and passwords don’t really care so much about that but essentially this is what we’re to do so if you’re looking here at the variables that are available we’ll find here ci registry see a registry user say a registry password”
    • AWS Elastic Beanstalk for PaaS: AWS Elastic Beanstalk is a Platform-as-a-Service (PaaS) offering that simplifies deploying and managing web applications. The course introduces deploying Docker containers to Elastic Beanstalk.
    • “aws elastic beanstalk is a platform as a service offering that we can use to easily deploy and manage applications in the aws cloud so if you don’t want to deal with the underlying infrastructure configuring servers load balancers auto scaling groups and so on elastic beanstalk is the perfect option for you”
    • Environment Management in GitLab: GitLab allows defining and managing different deployment environments (e.g., staging, production) and associating pipeline jobs with specific environments. This helps in tracking deployments and managing environment-specific variables.
    • “going inside the project you will find here on the left hand side deployments and inside deployments there’s this optional environment what is an environment staging is an environment production is an environment wherever we’re deploying something that is an environment and it really makes sense to have these environments defined somewhere and to work with the concept of environment instead of fiddling around with so many variables that’s really not the best way on how to do that”
    • Extending Job Configurations (.): GitLab CI allows defining reusable job configurations using a dot prefix (.), which can then be extended by other jobs using the extends keyword, reducing duplication in the pipeline definition.
    • “if looking here at the deployed staging and we’re looking at deeply production well essentially at this point because we have used all these variables these jobs are almost identical the only thing that is different is the different stage different job name and we’re specifying the environment but the rest of the configuration is identical and yes the answer is yes we can simplify this even more so essentially we can reuse some job configurations so i can go ahead here and i’m going to copy this and i’m going to go here and i’m going to define essentially a new job i’m just going to call it deploy this will be a special kind of job it will be a job that has a dot in front of it and as you remember we have used the dot notation to disable jobs by having this we can essentially have a configuration here we don’t care about the stage right we don’t care about the environment so this is something that is not in common with the rest it doesn’t even have to be a valid job configuration we have just put here the parts that are really important for us and then in these other jobs we’re going to keep what we need so what we need we need a stage and we need the environment and of course we need the job name and this other part here we can simply write something like extends”

    Conclusion

    The excerpts indicate that this GitLab CI/CD with AWS course provides a comprehensive introduction to automating software delivery. It covers essential concepts of DevOps, GitLab CI, Docker, and AWS, emphasizing hands-on learning and practical application. The course progresses from basic pipeline creation to more advanced topics like environment management, Docker containerization, and deployment to AWS services like S3 and Elastic Beanstalk. It highlights best practices for building robust and efficient CI/CD pipelines.

    GitLab CI/CD Pipelines: An Overview

    1. What is GitLab CI and why is it useful?

    GitLab CI (Continuous Integration) is a tool within GitLab that allows users to automate the building, testing, and deployment of their software through CI/CD (Continuous Integration and Continuous Delivery/Deployment) pipelines. It’s useful because it automates repetitive tasks, ensuring code is frequently tested and deployed, leading to faster development cycles, fewer errors, and more reliable software releases.

    2. What are the basic components of a GitLab CI/CD pipeline?

    A GitLab CI/CD pipeline is defined in a .gitlab-ci.yml file and consists of:

    • Jobs: These are the fundamental units of work in a pipeline, representing a set of commands to be executed (e.g., building code, running tests, deploying). Each job runs in an isolated environment.
    • Stages: Jobs are organized into stages, which define the order of execution. Jobs within the same stage run in parallel, while stages run sequentially. Common stages include build, test, and deploy.
    • Scripts: Each job contains a script section where the actual commands to be executed are defined. These are typically shell commands.
    • Images: Jobs run inside Docker containers. The image keyword specifies which Docker image to use for a particular job, providing a consistent and isolated environment.

    3. How do you define a pipeline in GitLab?

    A pipeline is defined using a YAML file named .gitlab-ci.yml at the root of your GitLab repository. This file specifies the stages, jobs within each stage, the script to be executed in each job, and other configurations like the Docker image to use. The structure relies heavily on indentation to define the relationship between different parts of the configuration (e.g., which scripts belong to which job).

    4. What is YAML and why is it used in GitLab CI?

    YAML (YAML Ain’t Markup Language) is a human-readable data serialization language. It is used in GitLab CI to define the pipeline configuration in the .gitlab-ci.yml file. YAML’s structure, based on indentation and key-value pairs, makes it relatively easy to read and write pipeline definitions, although proper syntax and indentation are crucial to avoid errors.

    5. How does GitLab CI integrate with Docker and AWS in this course?

    GitLab CI uses Docker to provide isolated and consistent execution environments for pipeline jobs. Each job runs inside a Docker container specified by the image keyword. This ensures that the build and test processes are reproducible. The course focuses on deploying a simple website to Amazon Web Services (AWS) S3 (Simple Storage Service) using the AWS Command Line Interface (CLI) within a GitLab CI pipeline. This involves using an AWS CLI Docker image and configuring credentials to interact with AWS services.

    6. How can you manage environment-specific configurations and credentials in GitLab CI?

    GitLab provides CI/CD variables that can be defined at the project level (Settings > CI/CD > Variables). These variables can store configuration values, API keys, and other sensitive information. Variables can be marked as “protected” (available only on protected branches) and “masked” (their values are hidden in job logs). Additionally, variables can be scoped to specific environments (e.g., staging, production), allowing different values for the same variable name based on the deployment environment. AWS credentials (access key ID and secret access key) are securely stored as GitLab CI/CD variables to allow the pipeline to interact with AWS.

    7. What is the difference between Continuous Integration (CI), Continuous Delivery, and Continuous Deployment?

    • Continuous Integration (CI): Focuses on frequently merging code changes from multiple developers into a shared repository, followed by automated building and testing. The goal is to detect integration issues early and ensure the codebase is always in a working state.
    • Continuous Delivery: Extends CI by automating the process of preparing code for release to production. This may include additional testing, configuration management, and manual approval steps. The code is always in a deployable state, but the actual deployment is a manual decision.
    • Continuous Deployment: Takes Continuous Delivery a step further by automatically deploying every change that passes all stages of the pipeline directly to production without manual intervention. The course demonstrates aspects of both Continuous Delivery (with staging and production environments) and sets up a mechanism for manual deployment to production in the later stages.

    8. How can you create a more sophisticated CI/CD pipeline with branching strategies and manual deployment?

    To create a more sophisticated pipeline:

    • Branching Strategies: Use feature branches for development, merging them into the main branch upon completion and review. The pipeline can be configured to run different sets of jobs based on the branch (e.g., run all tests on feature branches, but only deploy from the main branch).
    • Rules: GitLab CI allows defining rules for jobs to control when they are executed based on conditions like the branch name (if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH).
    • Manual Deployment: You can configure a job with when: manual to require a manual trigger in the GitLab UI before it is executed. This is useful for production deployments, allowing for human oversight before releasing changes.
    • Environments: Define and utilize GitLab Environments to track deployments to different stages (e.g., staging, production), associate variables and URLs with these environments, and monitor the health and status of deployments.
    • Job Templates (.job_name): Reuse job configurations by defining a template job (prefixed with a .) and then extending it in other jobs using the extends keyword, reducing duplication and improving maintainability.

    GitLab CI/CD Pipelines for AWS Deployment

    GitLab CI pipelines are a powerful tool within GitLab that allows you to automate the processes of building, testing, and deploying your software. This automation is central to the practices of Continuous Integration (CI) and Continuous Delivery/Deployment (CD). Valentine introduces this course to teach how to use GitLab CI to build CI/CD pipelines for deploying software to AWS.

    Core Concepts of GitLab CI Pipelines:

    • .gitlab-ci.yaml File: The entire pipeline is defined in a YAML file named .gitlab-ci.yaml which must reside in the root of your project repository. The pipeline will not be recognized by GitLab if this file is not named exactly like this. This file contains the configuration for all the stages and jobs in your pipeline.
    • Jobs: A job is the fundamental building block of a pipeline and represents a set of commands that you want to execute. For example, a job might compile your code, run tests, or deploy your application. Jobs are defined with a name and contain a script section specifying the commands to be executed.
    • Stages: Stages define the order in which jobs are executed. Jobs within the same stage can run in parallel, while stages run sequentially. You can define custom stages or use predefined ones like build, test, and deploy. If no stage is specified for a job, it automatically belongs to the test stage by default.
    • Scripts: The script section within a job lists the commands that will be executed by a GitLab Runner. These are often Linux commands, and the course will explain the commands used.
    • Docker Images: GitLab CI jobs typically run inside Docker containers. You specify the Docker image to be used for a job, and the GitLab Runner will download and start a container from that image. This provides an isolated and consistent environment for your jobs. The container is destroyed once the job is finished.
    • GitLab Runner: The GitLab Runner is the agent that executes the jobs in your pipeline. It retrieves job instructions from the GitLab server, sets up the environment (including downloading the Docker image and getting project files), runs the commands in the script, and reports the results back to the server. GitLab.com provides shared runners that can be used by any project.
    • Artifacts: Artifacts are files or directories produced by a job that you want to save and potentially use in later jobs. You define artifacts using the artifacts keyword in a job’s configuration and specify the paths to the files or folders you want to save. Artifacts are uploaded to the GitLab server after a job completes successfully and can be downloaded by subsequent jobs.
    • Variables: You can define variables in your .gitlab-ci.yaml file or in the GitLab project settings under CI/CD > Variables. Variables allow you to configure your pipeline dynamically, such as specifying AWS region, bucket names, or application URLs. Variables can also be scoped to specific environments.
    • Environments: Environments represent deployment targets, such as staging or production. You can associate jobs with specific environments in your pipeline configuration. GitLab provides a section under Deployments > Environments to track deployments and environment URLs.

    The Workflow of a GitLab CI Pipeline:

    Every time you push code to your GitLab repository, GitLab CI will automatically look for the .gitlab-ci.yaml file and, if found, will trigger a new pipeline execution. The pipeline will proceed through the defined stages, and the jobs within each stage will be executed according to their configuration. You can monitor the progress and logs of your pipeline in the GitLab interface.

    Continuous Integration and GitLab CI:

    GitLab CI is a key enabler of Continuous Integration (CI). CI is a development practice where developers frequently integrate their code changes into a shared repository, and these changes are automatically built and tested. GitLab CI pipelines automate this integration and verification process, ensuring that any integration issues are detected early. Working with branches and merge requests is a common CI workflow. By protecting the main branch and requiring changes to go through merge requests with successful pipeline runs, you can ensure the stability of your main codebase.

    Continuous Delivery and Continuous Deployment with GitLab CI:

    GitLab CI also supports Continuous Delivery (CD) and Continuous Deployment.

    • Continuous Delivery involves automating the release process so that your software can be deployed to a production-like environment at any time. However, the final decision to deploy to production is typically a manual step. You can implement this in GitLab CI by having a deploy job that requires manual intervention using the when: manual condition.
    • Continuous Deployment takes this a step further by automatically deploying every code change that passes all stages of your pipeline directly to the production environment without manual intervention.

    Your course covers deploying a static website to AWS S3 and deploying a Dockerized application to AWS Elastic Beanstalk, demonstrating how GitLab CI can be used for both continuous delivery and deployment scenarios.

    Important Considerations and Best Practices:

    • YAML Syntax: Pay close attention to the YAML syntax in your .gitlab-ci.yaml file. Incorrect indentation, missing colons, or incorrect spacing are common causes of pipeline failures. Enabling the rendering of whitespace characters in the Web IDE preferences is recommended to help identify these issues.
    • Job Dependencies: Consider the dependencies between your jobs when structuring your pipeline into stages. Jobs that depend on the output of previous jobs should be in later stages, and you might need to use artifacts to pass data between them.
    • Failing Fast: It’s a good practice to order your pipeline stages so that jobs that are likely to fail early (such as linters and unit tests) run before longer or more complex jobs. This provides faster feedback on potential issues.
    • Pipeline Optimization: Optimizing pipeline execution time is important. You can explore running independent jobs in parallel within a stage and restructuring jobs to avoid unnecessary steps or waiting times.
    • Environment Management: GitLab’s environment feature helps you manage different deployment environments and associate variables and deployments with them. This simplifies managing configurations for staging and production environments.

    By understanding and effectively using GitLab CI pipelines, you can significantly streamline your software development lifecycle, improve the quality of your code, and automate the delivery of your applications.

    GitLab CI/CD YAML Configuration Essentials

    YAML configuration is fundamental to defining GitLab CI/CD pipelines. The entire configuration of a pipeline is written in a YAML file named .gitlab-ci.yaml located at the root of your project repository. If the file is not named exactly this, GitLab will not recognize the pipeline.

    Here are the key aspects of YAML configuration in the context of GitLab CI/CD, drawing from the sources:

    • Key-Value Pairs (Mappings): YAML at its core represents data as key-value pairs. In .gitlab-ci.yaml, you define jobs, stages, and their properties using this structure. A colon (:) is used to separate the key from the value, and it is crucial to have a space after the colon. For example:
    • name: john
    • age: 23
    • This is also referred to as a mapping, where a key is associated with a value. The order of these key-value pairs generally does not matter.
    • Lists (Sequences): YAML allows you to define lists of items, which are called sequences. Each item in a list is written on a new line and must start with a dash (-) followed by a space. For example, defining multiple commands in a job’s script:
    • script:
    • – echo “Building a laptop”
    • – mkdir build
    • – touch build/computer.txt
    • Indentation: Indentation is crucial in YAML for defining scope and structure. It allows you to understand which values belong to which keys. For instance, the script commands are indented under the build_laptop job definition. Typically, two or four spaces are used for indentation, and the GitLab Web IDE often defaults to four spaces. Inconsistent or incorrect indentation is a common source of errors.
    • Reserved Keywords: When configuring GitLab CI/CD pipelines, you use specific reserved keywords that GitLab understands. Examples include job_name:, stage:, image:, script:, variables:, rules:, extends:, artifacts:, and environment:. You cannot arbitrarily rename these keywords; they must be used as defined by GitLab.
    • Variables: YAML in .gitlab-ci.yaml can include variables. These allow you to make your pipeline configuration more dynamic and configurable. Variables can be defined directly in the .gitlab-ci.yaml file or in the GitLab project settings. In the YAML file, you typically access variables using a dollar sign ($) followed by the variable name (e.g., $AWS_S3_BUCKET). Depending on the variable’s content, you might need to enclose it in quotes.
    • Stages: Pipelines are organized into stages, which define the sequence of job execution. You define the order of stages using the stages: keyword at the top level of the .gitlab-ci.yaml file. Jobs are then assigned to specific stages using the stage: keyword under the job definition.
    • Rules: The rules: keyword allows you to define conditions for when a job should be executed. This often involves checking predefined CI/CD variables like CI_COMMIT_REF_NAME (the current branch or tag name) and CI_DEFAULT_BRANCH (the default branch name) using an if: condition.
    • Extending Job Configurations: YAML allows you to reuse job configurations using the extends: keyword. You can define a template job (often with a name starting with a dot, like .deploy) containing common configurations, and then other jobs can extend from this template, overriding or adding specific configurations as needed.
    • Common Mistakes: Beginners often make mistakes related to the YAML syntax, such as:
    • Incorrect or inconsistent indentation.
    • Forgetting the space after the colon in key-value pairs.
    • Forgetting the space after the dash in list items.
    • Using an incorrect file name for the pipeline configuration (it must be exactly .gitlab-ci.yaml).
    • Missing colons in key-value pairs.

    Understanding these YAML basics is crucial for effectively configuring GitLab CI/CD pipelines to automate your software development processes. While the syntax might seem a bit peculiar at first, with practice, you will become more comfortable with writing and debugging .gitlab-ci.yaml files.

    GitLab CI/CD: Understanding and Using Docker Images

    Docker images are a fundamental concept in GitLab CI/CD, as they define the isolated and reproducible environment in which your pipeline jobs are executed. Here’s a comprehensive discussion of Docker images based on the sources:

    • Job Execution Environment: GitLab CI jobs run inside Docker containers. You specify the Docker image that should be used for each job in your pipeline configuration file, .gitlab-ci.yaml, using the image keyword.
    • Image Retrieval: When a job needs to be executed, the GitLab Runner will retrieve the specified Docker image from a container registry. The most common public registry is Docker Hub. GitLab also offers a private Container Registry associated with each project.
    • Specifying Images and Tags:
    • It is crucial to specify a version or tag for your Docker images instead of just using the latest version (e.g., node or alpine). Relying on the latest tag can lead to inconsistencies and potential pipeline failures if the upstream image introduces breaking changes.
    • You can specify a tag by appending a colon (:) followed by the tag name to the image name (e.g., node:16, nginx:1.21.6-alpine).
    • Using official Docker images from verified publishers on Docker Hub is generally recommended when available.
    • Base Images: When creating your own Docker images, you typically start with a base image that provides a foundational operating system and necessary tools. For example, when Dockerizing a Node.js application, you might start with an official Node.js image.
    • Image Size and Efficiency:
    • Consider using smaller Docker images, such as those based on Alpine Linux (e.g., node:16-alpine, nginx:1.21.6-alpine), as they can significantly reduce the time it takes for the runner to download the image, thus speeding up your pipeline execution. Larger images contain more tools and dependencies, which might not all be necessary for your specific job.
    • Isolation and Cleanliness: Each job in a GitLab CI pipeline runs in a new and isolated Docker container. This ensures that jobs do not interfere with each other’s dependencies or state. Once a job is finished, the Docker container is destroyed, providing a clean environment for the next job.
    • Accessing Project Files: During the execution of a job, the files from your project’s Git repository are automatically made available within the Docker container.
    • Persistence and Artifacts: Any files or changes created within the Docker container during a job’s execution are not automatically persisted back to the Git repository. If you need to use files created in one job in subsequent jobs, you must explicitly define them as artifacts in the .gitlab-ci.yaml configuration.
    • Building Docker Images within GitLab CI:
    • You can build your own Docker images as part of your GitLab CI pipeline using the docker build command. This requires using a Docker image that has the Docker client installed (e.g., the docker image itself).
    • To enable docker build within a GitLab CI job, you need to utilize the Docker-in-Docker (DinD) service. You define services in your .gitlab-ci.yaml to start a Docker daemon alongside your main job container.
    • When building Docker images, you should tag them appropriately using the -t or -d flag. It’s common to use CI/CD environment variables like $CI_REGISTRY_IMAGE to tag images with your project’s container registry URL and a specific tag (e.g., latest or the commit/build version).
    • Pushing Docker Images to a Registry:
    • After building a Docker image, you can push it to a container registry (like the GitLab Container Registry) using the docker push command. The –all-tags option can be used to push all tagged images.
    • Pushing to a private registry requires authentication using docker login. You typically use the $CI_REGISTRY_USER and $CI_REGISTRY_PASSWORD predefined CI/CD variables for this purpose, along with the $CI_REGISTRY URL. It is recommended to pass the password securely using echo “$CI_REGISTRY_PASSWORD” | docker login -u “$CI_REGISTRY_USER” –password-stdin “$CI_REGISTRY” to avoid exposing the password in the logs.
    • Testing Docker Images in GitLab CI:
    • You can test your built Docker images within the pipeline by running them as services using the services keyword in .gitlab-ci.yaml. This allows you to define an alias (a friendly network name) for your running container, making it accessible from your test job.
    • Once the container is running as a service, you can use tools like curl in your test script to send requests to the application running inside the container and verify its behavior.
    • Docker Images and AWS Elastic Beanstalk: AWS Elastic Beanstalk supports deploying applications packaged as Docker containers. You typically provide a Dockerrun.aws.json file that specifies the Docker image to be pulled from a registry (like the GitLab Container Registry) and run by Elastic Beanstalk.

    In summary, Docker images provide the foundation for isolated, consistent, and automated execution of jobs within GitLab CI/CD pipelines. Effectively managing Docker images, including specifying versions, using smaller images, building and pushing your own images, and testing them within the pipeline, is crucial for efficient and reliable CI/CD workflows.

    GitLab CI/CD for AWS Deployment: S3 and Elastic Beanstalk

    Based on the sources, AWS deployment within GitLab CI/CD pipelines is primarily demonstrated through two key methods: deploying static websites to AWS S3 and deploying Docker containers to AWS Elastic Beanstalk.

    Here’s a breakdown of the concepts and processes involved in AWS deployment as discussed in the sources:

    • Interacting with AWS via AWS CLI: The sources heavily emphasize the use of the AWS Command Line Interface (CLI) within GitLab CI/CD jobs to interact with various AWS services. This allows for the automation of deployment tasks. To use the AWS CLI, you typically use a Docker image that has it pre-installed, such as amazon/aws-cli.
    • Authentication and Authorization: To allow GitLab CI/CD pipelines to interact with your AWS account, you need to configure AWS credentials. This is typically done by setting the following as secret CI/CD variables in your GitLab project settings:
    • AWS_ACCESS_KEY_ID: Your AWS access key.
    • AWS_SECRET_ACCESS_KEY: Your AWS secret access key.
    • AWS_DEFAULT_REGION: The AWS region where you want to deploy your resources (e.g., us-east-1). These variables are automatically recognized by the AWS CLI within the pipeline environment. It’s crucial to mask the AWS_SECRET_ACCESS_KEY variable for security. Additionally, the IAM user or role associated with these credentials needs to have the necessary permissions to perform the required actions on AWS services (e.g., AmazonS3FullAccess for S3 and administrator access for Elastic Beanstalk for the examples shown).
    • Deploying Static Websites to AWS S3:
    • Creating an S3 Bucket: The first step is to create an S3 bucket in your AWS account to store your website files. Bucket names must be globally unique.
    • Making the Bucket Public: To serve a static website, you need to disable “Block All Public Access” for the S3 bucket.
    • Enabling Static Website Hosting: You need to enable the static website hosting feature for your S3 bucket and specify the index document (e.g., index.html) and optionally an error document. This provides a public URL for your website.
    • Setting a Bucket Policy: You need to create an S3 bucket policy to grant public read (s3:GetObject) permission to the objects within the bucket.
    • Uploading Files: Within your GitLab CI/CD pipeline, you use the aws s3 cp command to copy individual files or the aws s3 sync command to synchronize an entire directory (like your build output) to the S3 bucket. The –delete flag with aws s3 sync ensures that files removed from your source are also removed from the S3 bucket.
    • Testing: After deployment, you can test if the website is accessible via the S3-provided URL.
    • Deploying Docker Containers to AWS Elastic Beanstalk:
    • Understanding Elastic Beanstalk: AWS Elastic Beanstalk is a service that simplifies the deployment and management of applications in the AWS Cloud, handling the underlying infrastructure (like EC2 instances) for you. It supports various platforms, including Docker.
    • Creating an Elastic Beanstalk Application and Environment: You create an application in Elastic Beanstalk, which acts as a container for one or more environments. An environment represents your running application.
    • Dockerrun.aws.json: To deploy a Docker container, you typically provide a Dockerrun.aws.json file in your source bundle. This file specifies the Docker image to be used (including the registry and tag). For private registries like the GitLab Container Registry, it also requires authentication information.
    • Automating Deployment with AWS CLI: In your GitLab CI/CD pipeline, you use the AWS CLI to automate the deployment process to Elastic Beanstalk. This involves two main steps:
    • Creating an Application Version: The aws elasticbeanstalk create-application-version command is used to create a new version of your application in Elastic Beanstalk, referencing the Dockerrun.aws.json file (which is typically uploaded to S3 first). You need to specify the application name, version label (often derived from CI/CD variables like $APP_VERSION), and the location of the source bundle in S3.
    • Updating the Environment: The aws elasticbeanstalk update-environment command is then used to deploy the newly created application version to your Elastic Beanstalk environment. You need to specify the application name, environment name (e.g., using an $APP_ENV_NAME variable), and the version label to deploy.
    • Authenticating with Private Registries: When using Docker images from a private registry like the GitLab Container Registry, you need to provide authentication credentials to Elastic Beanstalk. This is often done by including an authentication file (e.g., auth.json) in your source bundle, which contains a deploy token generated from GitLab encoded in Base64. The Dockerrun.aws.json file then references this authentication file. You can generate a deploy token in GitLab with read_repository and read_registry permissions. The process in the GitLab CI/CD pipeline involves:
    • Creating a CI/CD variable (e.g., $GITLAB_DEPLOY_TOKEN) containing username:token.
    • Encoding this token in Base64 using echo “$GITLAB_DEPLOY_TOKEN” | tr -d ‘\n’ | base64.
    • Creating or substituting variables in the auth.json file with this Base64 encoded token.
    • Uploading both Dockerrun.aws.json and auth.json to S3.
    • Waiting for Environment Updates: After triggering an environment update, it takes some time for AWS to deploy the new version. You can use the aws elasticbeanstalk wait environment-updated command in your pipeline to wait until the environment has finished updating before proceeding with further steps (like testing).
    • Testing Deployed Applications: After the Elastic Beanstalk environment is updated, you can use tools like curl to send HTTP requests to the application’s URL (provided by Elastic Beanstalk and accessible via the $CI_ENVIRONMENT_URL CI/CD variable when an environment is defined in GitLab) and verify if the deployment was successful.
    • Managing Environments in GitLab: GitLab provides a feature called Environments that allows you to define and track different deployment environments like staging and production. You can associate CI/CD variables with specific environments. This helps in managing configurations for different deployment targets. The $CI_ENVIRONMENT_URL predefined variable provides the URL of the currently active environment.
    • Continuous Delivery (CD) vs. Continuous Deployment: The sources touch upon the difference between continuous delivery (where deployments to production require manual approval) and continuous deployment (where every successful commit on the main branch is automatically deployed to production). You can implement continuous delivery by using the when: manual keyword for the production deployment job in your GitLab CI/CD pipeline.

    In summary, the sources illustrate a comprehensive approach to deploying applications to AWS using GitLab CI/CD, emphasizing automation through the AWS CLI, secure management of AWS credentials and deploy tokens as CI/CD variables, and the utilization of services like S3 for static websites and Elastic Beanstalk for more complex containerized applications. The concept of managing different environments and the choice between continuous delivery and continuous deployment are also highlighted.

    Understanding Continuous Integration (CI)

    Based on the sources, Continuous Integration (CI) is a practice and often considered the foundational first step when adopting DevOps. It addresses the challenges that arise when multiple developers work on the same codebase.

    Here’s a breakdown of key aspects of Continuous Integration as described in the sources:

    • Frequent Code Integration: At its core, CI involves developers integrating their code changes with the code created by other team members on a frequent basis. This means that every time a developer makes changes, their code is intended to be merged and combined with the shared repository.
    • Automated Testing and Verification: A crucial component of CI is the automatic testing and verification of code changes upon each integration. This typically involves running various types of tests, such as:
    • Unit tests: To ensure individual components of the software function correctly (yarn test is mentioned as a command for running unit tests).
    • Linting: Static code analysis to identify potential errors and stylistic issues (yarn lint is mentioned).
    • Basic integration tests: To verify if essential files are present after a build process (e.g., checking for index.html).
    • More comprehensive integration tests that verify the functionality of the built application (e.g., using curl to check for specific content on a running server).
    • Continuous Integration as an Ongoing Process: The term “continuous” emphasizes that integration should happen continuously, as changes occur, rather than in infrequent batches (like weekly or monthly). Waiting for longer periods to integrate increases the likelihood and cost of resolving integration conflicts and issues.
    • GitLab’s Role in CI: The sources highlight GitLab as a tool used to facilitate and automate CI. GitLab CI/CD pipelines are defined using a .gitlab-ci.yml file, which outlines the sequence of jobs and stages involved in building, testing, and integrating code.
    • CI Pipelines: A CI pipeline in GitLab automates the process of taking code changes, building the software, running automated tests, and producing a new version of the product. These pipelines can be triggered automatically upon code commits to a repository branch.
    • Importance of a Stable Main Branch: CI aims to ensure that the main branch (or a similar primary integration branch) remains stable and functional at all times, allowing for the delivery of new software versions whenever needed. Preventing broken code from being merged directly into the main branch is a key objective.
    • Feature Branch Workflow: To support CI and maintain a stable main branch, a feature branch workflow is often employed. This involves:
    • Developers creating dedicated branches for each new feature, bug fix, or change.
    • Committing their changes to these feature branches.
    • Allowing the CI pipeline to run on these branches to automatically test the changes.
    • Using merge requests to propose the integration of the feature branch into the main branch. Merge requests often involve code reviews and require the CI pipeline to pass before merging is allowed.
    • Job Artifacts: GitLab’s concept of artifacts plays a role in CI by allowing the output of one job (e.g., the built application in the build folder) to be saved and made available for subsequent jobs in the pipeline (e.g., testing jobs).
    • Stages in CI Pipelines: CI pipelines are typically organized into stages (e.g., build, test, package) to define the order of execution for different sets of jobs. This helps in structuring the CI process logically.
    • Fail Fast Principle: An important consideration in designing CI pipelines is the “fail fast” principle. This means that jobs that are likely to fail early (such as linting and unit tests) should be placed earlier in the pipeline to provide rapid feedback to developers.

    In essence, Continuous Integration is a set of practices that emphasizes frequent code integration, automated testing, and the use of tools like GitLab to ensure that software development teams can work efficiently, maintain a stable codebase, and deliver new features and fixes with confidence.

    DevOps with GitLab CI Course – Build Pipelines and Deploy to AWS

    The Original Text

    in this course valentine will teach you how to use gitlab ci to build ci cd pipelines to build and deploy software to aws hello frequent campers and welcome to this course which will introduce you to gitlab ci and devops my name is valentine i’m a software developer and i like to share my passion for technology with others in a way that is easy to understand when i’m not speaking at a conference or traveling the world i like to share what i know by being active in groups and forums and creating tutorials on youtube or online courses in this course we will understand what gitlab ci is and why we need this tool and start building cicd pipelines during the course we’ll create a pipeline that takes a simple website builds a container tests it and deploys it to the amazon web services cloud also called aws in other words we’ll be focusing on automation i’ve created this course for people new to devops who want to use gitlab to build test and deploy their software don’t worry if none of this makes sense right now if you’re a beginner that is totally fine you don’t need to install any tools or anything else also no coding knowledge is required but if you have some it is great it will help a bit i will explain to you everything you need to know step by step this course focuses on gitlab ci but the course notes are packed with resources i recommend exploring if unfamiliar with a specific topic go right now to the video description and open the course notes there you will find important resources and troubleshooting tips if something goes wrong i will also be publishing there any corrections additions and modifications yes this is a very dynamic industry and things change all the time so if something is not working first check the course notes i am a big fan of learning by doing and you will get hands-on experience building pipelines and deploying software to aws throughout the course i will give you assignments to practice what you have learned well in this course we’ll be focusing on a specific technology and cloud provider what you’re actually learning are the concepts around devops with the skills acquired in this course i’m sure you’ll be able to start using gitlab ci for whatever you need in no time at all this is an action-packed course which i’m sure will keep you busy at least for a few days as always here on freecodecamp please help us make such courses available to you by liking and subscribing also don’t forget to drop a comment below the video if you like this course i invite you to check out and subscribe to my youtube channel link in the video description which is packed with content around devops software development and testing also feel free to connect with me on social media i would really love to hear from you finally i would like to thank those who will support free code camp by clicking that thanks button and making a small donation i hope you’re excited to learn more about gitlab ci aws and devops and with that being said let’s get started i have designed this course to be as easy to follow along as possible you don’t need to install any software on your computer and you should be able to do everything just from a browser i’ll be using gitlab.com throughout the course if you don’t have a gitlab.com account please go ahead and create one by default you will get a free trial with your account which will be downgraded to a free one after 30 days it just takes a few steps to create an account if you don’t want to participate in the free trial that’s totally fine there’s also the possibility of skipping the trial altogether gitlab is a platform that offers git repositories where we store code and code pipelines which help us build software projects now that the registration process is completed let’s begin by creating our first project and we’re going to create a blank project and i’m going to call this project my first pipeline i have the option of providing a project subscription which is optional and i can also decide on the project visibility either private which means that only i or people who i explicitly grant access to can view this project or public which means that can be viewed by anyone without any authentication i’m not going to initialize this project with a readme file i’m going to simply go ahead and click create project this gitlab project allows us to store files and to use git to keep track of changes and also to collaborate with others on this project if the concepts around git are not clear check the course notes for a free course on getting started with git for gitlab since for this account i haven’t configured git you will also get here this warning in regards to adding the ssh key this is also covered in the material i have mentioned but for the moment we don’t need this so we can simply discard it the first thing that i like to do is to change a few settings in regards to how this interface looks like so from the user profile i will go to preferences and here from the syntax highlighting theme what i like to do is to select monokai so this is essentially a dark theme and as you probably know we like to use dark themes because light attracts bugs and we definitely don’t want any bugs now leaving the joker side some people like it some people don’t like it i prefer to use a dark theme when writing code but totally agree that depends on everyone’s preference on how to use this there are also some other settings i want you to do right now in the beginning i’m going to scroll here a bit further down and the first thing that i want you to enable is render white space characters in web ide this will show us any white space characters whenever editing files that’s super important okay we have everything that we need to do so i’m gonna go all the way to the bottom click on save changes and go back to gitlab you’ll see here your projects so currently you have only one project i’m going to click on it and currently we have absolutely no code inside this project the first thing that i want to do is to begin to create a file so from this new gitlab project we’re going to use the web ide to create the pipeline definition file i’m going to click here on new file this will open up the gitlab ide so i’m going to create a new file and we are already provided here with a template and this file name must be called dot gitlab dash ci dot yaml if it’s not exactly this name if you’re writing it on your own this pipeline will not be recognized so the pipeline find will not be recognized by gitlab this is a very common mistake that beginners make probably this is why if you click directly on this one you’ll be pretty sure that you don’t name this file like anything else now in this file we’re gonna define the pipelines and essentially gonna write here configuration to create pipelines in gitlab say it’s totally fine if you don’t know what that is right now just want to create a very simple example to make sure that we have everything we need in order to follow along with the rest of the course so what i’m going to do here i’m going to write something like test column and then i’m going to go to the next line and you will see here everything is already indented so with this indentation with this four spaces that you can see right now here i’m gonna write script column space and then i’m going to use the echo command to display a text this is going to be the text that we want to display the echo command is used to display a text and we’ll be able to see it later on and this dot gitlab ci that yaml file allows us to describe our pipeline as i said don’t worry if this does not make any sense right now this is just a test to ensure we have everything we need to get started so now what we’re gonna do is to actually commit these changes which means introducing this file inside the gitlab repository if we click again here on the project name we’ll exit this view and you will see here that the pipeline failed so every time we make changes to this project the pipeline will be executed based what we have defined in this yaml file but you will see here right on top there’s this indication that something is wrong and even here if you look inside the pipeline you will get this additional information so what is going on in order to run your pipeline using the gitlab.com infrastructure you need to verify your account now this is not the same as verifying your email address you already did that but you need to go an additional step of verification unfortunately some people decided to take advantage of this free service and have abused it for mining cryptocurrency for the time being you will be asked to verify your account using a credit card now your credit card will not be charged or stored by gitlab and it is used solely for verifying your account just to ensure that you are one of the good guys and i know that you’re one of the good guys and i know that this is a bit annoying in the beginning but this is how things are right now i also know that credit cards are not that widespread in some countries and this may be inconvenient maybe you can ask a friend to help out i hope that gitlab will introduce alternative verification options nevertheless verifying your gitlab.com account and using the gitlab.com infrastructure is the easiest way to follow along with the course so if you can invest five minutes now and get this done it will save you hours later you can use your own infrastructure to run gitlab but it is more complex and from my experience of training thousands of students is that people new to gitlab who use their own infrastructure have issues running their pipelines and waste a lot of time trying to get them to run properly you have been warned but if you want to go this path i’ve added some resources to the course notes which you can find in the video description now in order to get started with the verification process you have to click here on validate account you will be asked to enter your credit card information i hope that the validation has been okay and in order to see if everything is working properly i’m gonna go back to the project and open the web ide i’m gonna click on the get lab ci file to make a change to it and i’m gonna change here the message so this is gonna be now hello world 2 and going to go here commit so essentially making a new change to this file and commit it directly into the main branch and if i’m looking here at the bottom i should be able to see that something is happening so very soon a pipeline will be started and you will see here now pipeline with the specific number is running i can click on it and if you click here on this execution you’ll be able to see the job logs and what we’re interested in is firstly seeing this message here hello world and additionally what we’re also interested in seeing here is seeing this text here which says pulling docker image now this is very important not for this job itself but what we are going to do throughout the course we want to make sure that whatever we have here in terms of the execution that we are actually using docker if this is working it’s fantastic you can jump directly into the next lecture otherwise check the course notes for some troubleshooting ideas so what is a pipeline allow me to make an analogy to an assembly line used to manufacture a physical product any product goes through a series of steps let’s take a laptop for example to oversimplify the assembly line would have the following steps we’ll take an empty laptop body case we’ll add the main board and add a keyboard we would do some quality assurance to ensure it turns on and works properly then we would put it in a box and finally ship it to customers and we are not using gitlab to produce physical products we want to build software but producing software has similarities to what i have described before before we can ship anything we go through a series of steps let’s try to build the laptop assembly line in gitlab ci well kind of instead of real components we’ll use a file a folder and some text so let’s begin with the first task take an empty laptop case we’ll put this in a job in gitlab a job is a set of commands we want to execute so now let’s go back to our project and make some changes to it again i’m gonna open the web ide to be able to view the pipeline file now essentially we already have a job here but we’re gonna expand this and make it build a laptop if you’re facing any issues getting the following steps to run make sure to watch the next lesson where i’m going over some of the most common mistakes now we already have a job and this job is called test but probably we should go ahead and rename this to maybe build a laptop or we can also call it simply build laptop now in the script part this is where we can essentially write commands now so far we have used this echo command but the way we written this allows us only to write one command so what i’m going to do here i’m going to go on the next line and i’m going to start here with the dash and this will allow us to essentially write multiple commands one after the other so let’s rename this in something like building a laptop just to give us some information in regards to what we’re trying to do i want you to notice that after this dash i have added a space and you can see that space represented by a dot common mistake that people just getting started with gitlab and this language that you see here which is called yamo is that they don’t add the spaces or they don’t properly indent what they see so make sure that what you have inside your editor looks pretty much the same as what i have here and you’re doing that pretty sure this example will also work for you now as i said the language that we’re using here to describe our pipeline is called yaml and yaml is essentially a way to represent key value pairs it may look a bit weird in the beginning but after a few examples i’m sure you will get used to it now so far our problem doesn’t do anything and inside this job we actually said we want to build this laptop and we also said that we’re not going to use physical components we’re going to use folders we’re going to use files we’re going to use some text so let’s begin with the first command which will create a new folder now we want to put this into a folder which is called build so on the next line i’m gonna use a command that will create a folder this command is called make deer and i’m going to call this folder build so now we have a folder and let’s go to the next line and actually create a file so i want my file to be inside this build folder and in order to create this file we’re going to use the touch command now the touch command is generally used for modifying the timestamp of a file essentially you’re touching it you’re modifying it but it also has an interesting behavior which we will use here if the file does not exist it will create an empty file and initially for us that’s perfectly fine so we’re going to create this file inside the build folder which we created one step before and with the forward slash we go inside this build folder we can specify the file name which in this case will be computer.txt now the next question is how do we get some text inside this file and in order to do that we’re going to use a command we have already used before and this is the echo command now echo if we don’t do anything else like we did here it will just print this message and we’ll see it in our build logs but we can also kind of redirect this and send it directly to a file and for that we’re going to use an operator so let me show you what i mean by that i’m going to write here again echo and the first thing that we are going to do is we’re going to add here the main board now let’s see the file itself it’s uh just containing the the laptop and then we’re adding components to it so if you would keep this as it is right now it will just display this information just display mainboard but we actually want to get it inside this file that you see here so i’m simply going to go ahead and copy it and in order to get this text inside there we’re going to use this operator it’s actually greater than greater than and essentially this operator takes the output from one command so echo is one command and it will append it to a specified file so now we have specified here this computer.txt file which is inside the build folder so if you want to take a look and see exactly what is the contents of the file we can do that as well and for that we there are different commands that we can use one option would be to use the cat command and cat stands for concatenate and can be used for creating displaying or modifying the contents of files in this case we’re using this hat command to view the contents of a file and again we have to specify the path to that file so just to make sure i don’t make any mistakes and always go ahead and copy paste the value of the file the name of the file and of course we can also go ahead and add the other steps so which other steps did we had for example we wanted to add a keyboard i’m gonna add this again with a new command and i think that should be it’s a way we have the main board we have the keyboard and of course we can also try this cat command once again at the end and this will give us an idea of how the job itself is working in the previous execution we haven’t specified a docker image to use and by default it will download a ruby docker image which for our use case here doesn’t really make a lot of sense so we’re going to use a very simple docker image it’s a linux distribution that will be started with our job and we can do that by specifying here another keyword and you will see here it’s under the job itself which is build laptop but at the same level with the script so i’m going to write here image column and the image name will be alpine so alpine linux is a very lightweight linux distribution what’s most important for us that this distribution has these commands that we’re using so these are pretty standard commands that are available essentially in any linux distribution but having a very small linux distribution will make our job run much faster so let’s go ahead commit these changes and see how the pipeline runs i’m going to commit again to the main branch and if i’m in patient i can click directly here on the pipeline or i can also go directly on the project page and you will only see here the pipeline running pipeline is also available if you go here inside cicd pipelines it will display your list of all the pipelines that are running you can click here on this one which is the id of the pipeline you will see now our pipeline contains a job and this job has been assigned to the stage test by default if no stage is defined the job will use the test stage now it doesn’t really matter how the name of the stage has been called we just want to make sure that the commands that we have executed are actually working properly we’re getting here no errors so the job is running so the job has executed successfully we can click on it take a look at the execution logs see exactly what has happened here and you will see here in the logs the commands that we have executed they’re all visible here you will see here echo building laptop you will see the text being displayed after that we are creating a new folder we’re putting a file inside that folder we’re adding some text to that file then we’re checking the contents of the file to make sure everything is fine you see here the word mainboard being displayed and then we add the keyboard and then again you will see here the contents of the file containing both main board and keyboard so what is a pipeline it is a set of jobs organized in stages right now we have a single job that belongs to the test stage however in the upcoming lectures we’ll be expanding this pipeline it is quite common that when you are just getting started with defining these pipelines that you make some mistakes let me show you like some common mistakes that will lead to invalid configuration which will lead to git lab not running your pipeline i’m going to make this a bit bigger on the screen so that you can easily check and compare it with what you have it’s very important that in some places you have this column so for example here i’m defining the job and in order to add image and scripts as essentially properties of this job it’s important to have here this column if i’m removing that you will see here in the editor when you see these lines here it will indicate that something is wrong most of the time these messages are really not so easy to understand so it’s more important to double check what you have written here to make sure it is exactly as it should be it’s also important that you have some spaces where there are spaces expected so for example here with the commands and whenever you’re writing echo or make deer or touch there needs to be a space between the dash and the command this is why in the beginning i’ve asked you to enable this white spaces so that you can easily see them in your script so if i write something like this this again will make something weird so it will not show here an error because this is actually valid yamo but when gitlab will try to execute this pipeline and we’ll look at these commands we’ll think that you’re trying to run a command that starts with dash echo and we’ll say i cannot find this command so for that reason you need a space here to make a difference between this dash here which indicates a list and this command what’s also important is the indentation as you can notice here there are four spaces so everything that is under build laptop is indented with the level if i add something like this here it it will no longer belong to build laptop and will come out as something that’s really weird and most likely it will be invalid so always make sure that you have the right indentation uh two spaces are also fine by default this web ide will use four spaces just make sure you have that indentation there in place in the course notes you will find even more examples of why your pipeline may be failing including some common error codes that you may encounter so definitely check the course notes if you’re still having issues getting this pipeline to run in this lesson we’ll try to understand what yaml is if you already know yaml feel free to skip this as i will not be covering any advanced features the most important reason why you need to know some yaml basics is because you’ll be facing many errors while writing yaml and as i mentioned in the beginning this is normal trust me i also did the same mistakes that you did and sometimes i’m still making mistakes while writing yaml if i’m not paying attention if you’ve already been exposed to formats such as json or xml i’m sure you’ll be able to understand the basics around yaml very easily actually yaml is a superset of json and you can easily convert json to yaml both xml json and yaml are human readable data interchange formats while json is very easy to generate and parse typically yaml is considered easier to read as you will see not so easy to write but we’ll get to that quite often yaml is being used for storing configuration especially if you’re learning devops you probably face yaml a lot and this is exactly why we’re using it in gitlab as well to store a pipeline configuration at its core yaml follows key value storage principles and let me open up here inside the editor a new file and i’m gonna start writing some yaml basics so i’m gonna create here file i’m gonna call it test.yaml and let’s start with a few basics so for example how do we represent a key value pair so for example i have here a name typically would write something like the name is john right so this is something that anyone would understand now in yaml we use a column to separate that and so i’m going to add here name column john and what’s also more important that we have a space after this column so it will be like this and you will see here the color here will also change so now we have a key value pair the key is name and the value is john we also call this a mapping we’re mapping a key with a value of course on a new line we can start adding an additional key value pair for example let’s say here h 23 and what’s important to know is that the order of the properties does not matter so we can define them in any order so if i write first name john and after that h or the other way around that’s actually the same both are defined here in this yamo quite often we need to define lists which in yaml are called sequences and we do that by writing each value on a new line so for example let’s write here some hobbies call them sports youtube and hiking right and what you also do is we put them each of them on a new line but each line must start with a dash and a space so we have here a dash and a space a dash and a space dash and a space now we have a list now the way i’ve written this doesn’t really work like that so if we remove everything from here this will be probably a valid list but we cannot simply just combine this properties and now just add this list here in between what’s important to know about yaml is that it uses indentation for scope essentially it allows you to know which value belongs to which key because it has the proper indentation so for example now we know this is not valid here but if you write here for example hobbies as a key then this list here will belong to this key so essentially the mapping will contain a key and this list of values well this is valid we also like to indent this i’m going to select everything and click on tab and this will indent all these values here additionally we can have some nested structures so for example if i’m trying to write here an address so this will be the key and then on a new line i can write additional key value pairs which all belong to the address and you will see here i have the indentation so i can write something like street and on a new line i can go ahead and write a city and again on a new line i’m gonna write here the zip code and essentially by using this indentation we show that street city and zip they all belong to address if we didn’t have this indentation and it would all be a property of something else this is why in this case we’re using here name age hobbies and address these are like properties on the first level and street city and zip they are under address in terms of lists we can also build some more advanced lists so this is a very simple list that we’ve used for hobbies but let’s say for example that we want to add here a new key which is called experience and here uh for the experience we’re gonna create a list and we just wanna say like what is the professional experience of this person for example we can have here job title that could be junior developer and instead of creating here a new item in the list we just go to the same level as with title then we can start writing something like period so it will indicate in which period this person has been a junior developer let’s say from 2000 to 2005. and then we can go ahead and add a new item to the list again with title let’s say now this person is a senior developer and we can also define a different period so this will be since 2005. now additionally what we can do is we can take everything that we have here and how about we define here let’s say this is a person right and then we can take every everything that we have here and indent it once and then all these properties that we have here will belong to a person now you can see here that we are still have some mistakes here so we can we need to fix something because this editor will tell us this is a bad indentation and as you learn the indentation is very very important so i’m going to add here to spaces and add here again to spaces and now this indentation will be correct now when we are writing gitlab ci pipelines we don’t really get to choose which data structures to use we have the liberty of designing the pipeline but we need to do it in a way that gitlab will understand it so if we’re looking here at our pipeline we can just decide to use something else so for example instead of image we cannot just decide we’re going to call it docker image or docker or instead of scripts we cannot write here scripts because this is something that gitlab will not understand yes from a yaml perspective this is still valid but from the perspective of gitlab this is something that’s not according to what we agreed essentially in advance when we started writing these pipelines so it’s just important that you understand like what we’re doing here and how this indentation and how this key value pairs are being written but when we’re writing jobs we we decide how this job will be named we decide what exactly will happen inside it some keys will be reserved and simply cannot be renamed you just have to pay attention that what you’re writing here is really important and it has to be exactly at least exactly as the examples that i’m showing you otherwise gitlab will not be able to understand what you’re seeing throughout the course we’ll be using linux and linux commands we have already learned some commands such as echo touch make deer cat and so on we typically use these commands through a command line interface or cli what you see here for example i can go ahead and create here a new folder i can switch inside that folder we’ll see here for example with ls i will be able to list the contents of that folder let’s go ahead and write here touch this touch command and create here file name computer and again with ls i can see which files are inside the current folder so we typically type these commands that you have seen in the pipeline through this command line interface or cli sometimes we call it a console a terminal or a shell while technically speaking they are not the same thing you may notice me and others use them interchangeably a command line interface is the opposite of a graphical interface this is a graphical interface you will be able to see text colors you have buttons that you can click things are happening through your interaction you’re moving your mouse and you’re clicking or something or you’re using your keyboard and something changes on the screen this is a command line interface we will work with the command line interface to write commands computers we interact with have no user interface that we can use anyway automating graphical user interfaces is not as easy and as reliable as simply using commands the command line interface that computers have is called the shell the shell is simply the outer layer of the system the only thing that we can see from outside and interact with so we send these commands to the system and the system will run them this is how we can interact with it when using gitlab ci we essentially automate a set of commands which we execute in a particular order while i will explain every command that we’ll be using throughout the course if this is something new there’s absolutely no replacement for trying things on your own please see the resources in the course notes for this lesson on setting up a linux environment on your own computer and which linux commands you should know let’s talk for a minute about the gitlab architecture at the minimum the gitlab architecture for working with pipelines contains the gitlab server and at least one gitlab runner the gitlab server manages the execution of the pipeline and its jobs and stores the results the gitlab server knows what needs to be done but does not do this itself when a job needs to be executed it will find a runner to run the job a runner is a simple program that executes the job a working gitlab setup must have at least one runner but quite often there are more of them to help distribute the load a runner will retrieve a set of instructions from the gitlab server download and start the docker image specified get the files from the project git repository run all the commands specified in the job and report back the result of the execution of the gitlab server once the job has finished the docker container will be destroyed if docker is something new to you check the course notes for a quick introduction what’s important to know is that the git repository of the project will not contain any of the files created during the job execution let’s go back to our project you will see here that inside the git repository there’s no build folder there’s no computer.txt so what exactly is happening let’s go inside one of the jobs and quickly go through the log so that you can understand what is going on so right here on top you’ll have information about the runner that is executing the job and a runner will also have an executor in this case the executor is docker machine and here on line four you will see here which image is being downloaded and you’ll see here pulling docker image alpine because this is what we have specified and then essentially the environment is being prepared and then in the upcoming steps you get the files from the git repository so essentially all the files that you have inside the git repository will also be available here inside the runner so after this point the docker container has been started you have all the project files and then you start executing the commands that you have specified inside the pipeline so in this case we’re creating the folder we’re creating these files we’re putting some text inside there and then at the end we’re not doing anything else so the job succeeds because there are no errors and the container is destroyed so this docker container that has been created in the beginning just maybe a few seconds ago is then destroyed you cannot log into it you cannot see it anymore it doesn’t exist anymore so it has done its job has executed this command that we have specified and then it has been destroyed since every job runs in a container this allows for isolation and flexibility by having our job configuration stored in the yaml file we describe how the environment where the job is running should look like in practice we don’t know or care which machine has actually executed the job also this architecture ensures that we can add or remove runners as needed while the gitlab server is a complex piece of software composed of multiple services the gitlab runner has a relatively simple installation and can run on a dedicated server or even on your laptop now right here on top of the job you have seen some information in regards to the runner so the question is where is this job actually running and to be able to understand this we’ll have to go here to the project settings cicd and here we’re going to expand runners and you’ll see here two categories there are specific runners and they are shared runners now for this job we have used shared runners any project can use shared runners within a gitlab installation these shares runners are offered by gitlab.com and are shared between all users now as you’ve seen there are multiple runners here and honestly we don’t really care which of these runners picks up our job because we have defined exactly what our job should do which docker image we want to use which command should be executed so as long as that runner knows how to deal with a docker image and was able to execute these commands then we’re fine with any runner now this is an oversimplified version of the gitlab architecture the main idea i want you to get from this is that we are using docker containers in our jobs and every time for every job the gitlab runner will start a new docker container will execute any commands that we have and then when the job execution is done that docker container will be destroyed so now we have created this laptop and have defined all the steps inside the build laptop job and of course with this cad command we have also visually verified that indeed this computer.txt file contains everything that we expect but we really want to automate this process we don’t want to go inside the job itself and to look and see if everything was successful so let’s expand our pipeline and add a test job we want to make sure that our laptop contains all components so i’m going to go ahead here and create a new job i’m going to call it test laptop and we’re going to use the same image the alpine linux image and we’re going to also define the script and this time we need to find a way to actually check for example if this file has indeed been created so this would be like a very basic test and what we can do here is to use the test command so the test command will allow us to check if this file has been created and this command also has a flag which we’ll gonna write with dash f and then we’ll specify the path to the file so essentially this command will ensure that this file really exists and if it doesn’t exist it will fail the job so let’s go ahead commit this and see how the pipeline looks like if we’re looking at the pipeline we’ll notice something unusual and that is we’re building the laptop and at the same time we’re testing it and essentially what we wanted to do is to have this in two separate stages right we first build and then we test now currently what we did is we assigned by default both of these jobs to the test stage they both are running in parallel but of course these are not the kind of jobs that we can execute in parallel because they depend on one another particularly the test job depends on first the build job completely so i’m not even going to look at why the test build failed because by the way this pipeline looks like doesn’t make a lot of sense and we have to go back to the concept of stages so what we want to do is to have two different stages and we’re going to change our pipeline configuration and define these stages we want to have a build stage and we want to have a test stage in gitlab we can go ahead and define another configuration which is called stages and here as a list we can define the stages that we want to have so we can see here we want to have the build stage and we want to have the test stage and in order to specify which job belongs to which stage in the job configuration we will also say to which stage this job belongs so for example we want the build laptop job to belong to the build stage so i’m going to write here stage and the stage will be built the same goes for the test laptop now if you don’t specify a stage here it will automatically belong to the test stage by default but actually you want to make it as explicit as possible so we’re going to write here stage test so we here we have defined the stages we have assigned the build laptop job to the build stage and we have assigned the test laptop job to the test stage so let’s commit these changes and take a look again at the pipeline if we’re looking at the pipeline we’ll be able to see now the two stages that we have build and test so these stages will run one after the other this stage does not start until the build stage is over so first we have to build a laptop and then we can start with a test unfortunately this is still failing so in this case we really have to take a look inside this job and understand what is going on and we’ll see here that the last command that we have executed is this test command here so up to this point everything seems to be working fine this has been the last command that we have executed and somehow this job has failed in the next lecture we’ll try to understand why do pipelines fail so let’s jump into that and continue debugging this problem so let’s try to understand why did this job fail looking here inside the job blocks we’ll be able to see here this error says job failed exit code 1. exit codes are a way to communicate if the execution of a program has been successful or not an exit code 0 will indicate that a program has executed successfully any other exit code which can be a number from 1 to 255 will indicate failure so in this case exit code 1 is not a 0 so it means something has failed this exit code is issued by one of the commands that we have in our script as soon as one of these commands will execute an exit code execution of the job will stop in this case we have only one command so it’s relatively easy to figure out which command has issued this exit code most likely it is the last command that you see here inside the logs so in this case what test is trying us to tell is that it has tested for the existence of this file and couldn’t find it if the file would have been there would have gotten an exit code 0 and the execution would have continued in this case the file is for some reason not there and we have retrieved an exit code 1. this tells gitlab that this job has failed and then the entire execution will stop if a job in the pipeline fails by default the entire pipeline will be marked as failed as well let me show you an example let’s go back to our pipeline definition and we already know that the build laptop job works just fine so let’s see here somewhere in the middle we’re going to add a new command and this command will be the exit command and we’re going to exit with a code one so what we should observe is that commands echo make tier and touch are still being executed but for example here where we’re putting the main board we’re using cat and again we’re putting the keyboard inside this file this shouldn’t be executed anymore so now i’ve executed a pipeline again you will see here that a build job failed and because this job failed the rest of the pipeline was not executed so it was interrupted as soon as something has failed it actually doesn’t really make a lot of sense to continue with the rest of the stages if one of the jobs before has failed so let’s go inside it and take a look at the execution logs to see what exactly has happened here and you’ll be able to see as i said we have here the this echo command that’s being executed we have created this directory we have created this file and then we have exit one and then we says here job failed exit code one now we have forced this failure here but i just wanted to demonstrate like where in the execution you can notice that something went wrong and actually going through these commands that are executed looking at your job configuration trying to figure out what has happened what is the last command that did something sometimes inside the logs you will find hints in regards to what went wrong in this case there are not a lot of hints in terms of what went wrong but these are also very simple commands but it’s very important to read the logs from from the beginning as high as possible to understand like which docker image has been used what is happening before are there maybe any any warnings or any hints that something went wrong this case that’s not the case and then to locate okay what was the last command that i executed why did this command fail so i’m gonna remove this exit code and we’re gonna continue with the rest of the course and try to understand how we can get the simple pipeline to run let’s go back to our pipeline configuration and understand what are we doing wrong as you probably remember from the architecture discussion every job runs independently which means here the build laptop job will start the docker container will create this folder and this file will put this text as instructed and then at the end we’ll destroy the container meaning the file that we had created inside this docker container will be gone as well and test laptop will start a completely new container that doesn’t have this file there and for that reason it cannot pass this test file will always tell us that there is no file there because from where could this file come now does this mean that we can only use a single job meaning that we need to move this command here to test inside the build laptop well that would be very inconvenient because then would have a big job that does everything and would kind of lose the overview of what our pipeline steps really are now there is a way to save the output of the job this case the output of the job what we are actually interested in this job is this file including this folder and gitlab has this concept of artifacts now an artifact is essentially a job output it’s something that’s coming out of the job that we really want to save it’s not something that we want to throw away for example we may have used any other files or any other commands within the job but we’re only interested in the final output that we have here so in order to tell gitlab hey i really want to keep this file in this folder we need to define the artifacts so the artifacts are an additional configuration an additional keyword that we add to our pipeline as the name tells its artifacts don’t write it artifact because gitlab will not recognize that and as a property of artifacts we’re going to use paths so notice it is indented it’s not a list and then below paths we can add a folder or a file that we want to save now in this case we’re going to tell gitlab save everything that is inside this build folder so now let’s give it a run and see how the pipeline performs this time now if we’re looking at the pipeline execution we now see that both building the laptop and testing the laptop are successful so what exactly has happened behind the scenes did we reuse the same docker container or what has happened there well to understand exactly what has happened and how these jobs now work we have to go inside the logs and we try to understand what exactly did this build job do differently this time and what i want you to notice here is that towards the end if you compare it to the logs of the previous job we also have this indication that something is happening and it will tell you here uploading artifacts for a successful job and will tell you here which artifacts are being uploaded we’ll reference here the build folder and says that two files and directories were found and these are being uploaded to the coordinator not a coordinator to put it very simply essentially the gitlab server so in this case the runner has finished this job has noticed inside the configuration oh i need to do something with these files and we’ll essentially archive these files and we’ll give them back to the gitlab server and tell them hey i’m finished with this job i’m just gonna destroy this docker image you wanted to keep these files so you know here we go just handle these files i’m i’m done with my job here so essentially the runner is not saving these files they’re being saved somewhere else in the storage now when the next job is being executed something pretty similar is happening i’m gonna go here to the test laptop job and what you see here in the beginning there’s also a new indication inside the logs that something different is happening and we’ll see here downloading artifacts and says again downloading artifacts from coordinator which essentially means we now are downloading this build folder inside the new docker container that we have just created we have managed to copy this files from one job to the next one and this is why now this test command is able to find the build folder and the computer.txt file inside it and the job is passing if this job is still failing for some reason it’s always a good idea to take a look at the job that has generated the artifacts so in order to do that again we’re gonna go and visit the pipeline and if we go inside the build laptop job here on the right hand side you should see some information in regards to the job artifacts and in order for these job artifacts to exist they are saved even after the job has terminated and you have the possibility of inspecting them so if you’re not really sure like what is the contents of the file you don’t really need to go inside the build pipeline and make some debugging there you could do that but essentially what has been saved here is the final version of the artifacts that are being used so you can go here inside browse you’ll find here the build folder that we have specified and we’ll find here the computer.txt and of course you can download this file and you can take a look at it after you download it on your own computer and see if it has the right content make sure that when you’re testing this you’re actually giving the correct path and not some other path that’s a very important way on how you can actually inspect the outputs of the job at this point i wouldn’t say that we are really done with testing the build output yes this file exists and we have now tested it so this is a very basic test that we have written here but how about checking the contents of the file to see if it contains the main board and the keyboard as we expect again just using a command like cat and displaying this into logs doesn’t really help us automate this we need a tool that when it doesn’t find the respective text in the file it will issue an exit code and tell us that that text is not really present there and for that purpose we’re going to use the grep command so this is the grep command and grep is a cli tool that allows us to search for a specific string in a file so we’re going to specify here for example the string to be main board and i’m going to copy it from above just to make sure i don’t make any mistakes there and we also can specify in which file we’re looking for this so we know that this file already exists so this is an additional test here that we’re adding on top of this and now we actually know that the file exists but now we want to check if this word main board is inside the file and of course we can also duplicate this and write an additional test here gonna check for the keyboard as well we’re checking for the main board and the keyboard now grep is really complex command and can support regular expressions and many other advanced features but i won’t get into those i’m gonna commit these changes and in a few seconds take a look at the pipeline all right so now if we’re taking a look at the pipeline we’ll see the build job is still successful the test job is still successful so if we’re looking inside here what we’ll be able to see we’ll be able to see some log outputs and then grab here is looking for the word main board inside this file and is able to find it will be displayed here and it’s also looking for the word keyboard inside this file and is able to find it what’s important about writing tests is to also ensure that your pipeline will fail if one of these tests doesn’t work and sometimes you may think that the command does what it’s supposed to do but the best way to make sure that you’re really mastering that command to actually introduce an error inside your build job essentially and to check if the test job will fail so let’s go ahead and try that out so here inside our build job what can we do well for example we could try and make a change here for example i’m going to remove the m from main board and i’m gonna simply commit these changes and to see if this job is now failing we’ve been looking now inside the tests we’ll be able to see here that the last command that was executed was grep you will see it in comparison to the previous one there’s no text being outputted below this is the last command that was executed we’re getting an exit code 1 which essentially means grep has looked inside this file couldn’t find the word main board so let’s go back and fix our pipeline but this has been a very important test because if you’re not really checking that our pipeline will fail at one point then whatever we did inside the pipeline in terms of testing is really not very useful i’m gonna go and add here main board back to the configuration and as we expect now the pipeline will also work again tests also play a very particular role when we’re working on this pipeline when we’re building software there are many various levels of testing but essentially tests allow us to make changes to our software or to our build process and to ensure that everything works the same for example i heard that if we are using this operator here and we’re putting text inside a file that this approach doesn’t really require to have a file already created with the touch command so how about we try this out and see if we can rely on the tests to get this to work so i’m going to simply remove this touch command and i’m going to commit a configuration we’ll see what’s going on so let’s take a look at the pipeline and what do we see this test job is successful and if we really want to manually check once again we can go to the build laptop job we can take a look at the artifacts we’ll see the build folder is there the computer.txt file is there so apparently we didn’t need to have this touch command in our configuration and by having the tests we have gained an additional level of confidence that whatever changes we’re making we kind of trust the tests and if the pipeline is passing we know that in the end we’ll have this computer.txt file and i will have the proper content let’s take another look at our pipeline configuration what if we need to change the name of the file so so far we have used this name computer.txt but what if we need to call it for example laptop.txt now quite often we don’t really like when we have something for example a file name or something that could change and have that spread also the entire pipeline because if we need to make a change we need to identify all the currencies now this is a very simple example and it is relatively easy to identify this but quite often for example going into a large file and doing something like a replace all can lead to some undesirable errors that could occur so quite often when we have something that we are searching multiple times inside a file or inside the configuration we want to put that into a variable and that way if it’s inside a variable if we need to make changes to that particular value we only have to change it once and then it would be replaced all over so how do we define a variable well we can go inside our script block and define a variable here so for example you can just define a variable called build file name and we see i’m writing this in lowercase and we have also some underscores to separate the words and then we can use the equal sign and write something like laptop.txt now in order to reference this variable we’re going to copy the name and go whenever we need to have this and we’re going to start with the dollar sign and then the variable name so we’re referencing the variable by using the dollar sign before the variable name now this is a local variable that is available only inside this script and it will only be available inside this job so for this job we need to do the same thing as well as you’ve noticed quite often we write local variables in lowercase and using lowercase helps avoid any conflicts with any other existing variables now this is one way how we can do this but there’s also the possibility of defining a variable block we can go inside the configuration of the job and write something like variables this will not be a list that’s very important so this will be build file name column and the value will be laptop.txt so this is essentially almost the same as writing it like this but we are getting it away from the script and we are letting gitlab do this for us and of course if we need to do this we have to take it from here and also put this in the other job so we’ll have some duplication here in terms of the configuration we can also define a global variable which is available for all jobs in order to define something globally all we have to do is take it from here and due to the indentation we’re going to move it outside of the job and everything that’s happening here is on a global level so i’m gonna move it here at the root of this document essentially here we define variables and this is the name and whenever we have this we have to use this syntax and of course we can go ahead and remove it from the test job because it would also be available there now this is essentially as defining an environment variable which is available for the entire system while there is no hard rule we typically write environment variables in all caps and still use underscores to separate the words because we are inside an ide i’m going to select this text use the f1 command and then i’m going to transform to uppercase so this is how i want it to look like build file name and wherever i want to have this again dollar sign and this name so for example i’m going to have it here for computer as well here this command which we may decide to replace or not really depends on us but i’m going to replace it here as well i’m going to use it here and here and here so again wherever we had computer.txt we have now replaced this with this environment variable and whenever we need to make changes to it we can easily just change it here it’s pretty easy to see maybe adding some other variables that we have inside our pipelines it will make the managing of these details much easier well in this example it is not necessary depending on which characters you include in your variable value you may need to put everything between quotes this is just something to keep in mind but this is a very simple text here that we have so that will not cause any conflicts in general with the yaml syntax so let’s commit these changes and see if the pipeline is still working as it should the pipeline is running successfully and we can go inside the build job that we had here and we can take a look at the artifacts and indeed we’ll see that now we are using this file name laptop.txt and no longer computer.txt so i have mentioned devops quite a few times and by now you have heard of devops as well so what is devops let me tell you first what devops is not devops is not a standard or a specification different organizations may have a different understanding of devops devops is not a tool or a particular software nor is it something you do if you use a particular tool or a set of tools devops is a cultural thing it represents a change in mindset let’s take a look at the following example you have a customer who wants a new feature a business person let’s call them a project manager would try to understand what the customer wants write some specifications and hand them over to the developers the developers will build this feature pass it on to the testers who would test it once ready the project manager would review the work and if all looks good would ask the developers to pass the software package to the sysadmins to deploy it as you can see there’s a lot of passing stuff around and in the end if something goes wrong and often things go wrong in such situations everyone is unhappy and everyone else is to blame so why does it happen because every group has a different perspective on the work there is no real collaboration and understanding between these groups let’s zoom in on the relation between the developers and the sys admins the developers are responsible for building software ensuring that all these cool features that the customers want make it into the product the it operations team is responsible for building and maintaining the t infrastructure ensuring the i.t systems run smoothly securely and with as little downtime as possible do these groups have something in common yes of course the software the product the problem is the idea operation team knows very little about the software they need to operate and the developers know very little about the infrastructure where the software is running so devops is a set of practices that tries to address this problem but to say that devops is just a combination of development and operation would be an understatement actually everyone mentioned before works on the software just in a different capacity since the final outcome impacts everyone it makes sense for all these groups to collaborate the cultural shift that devops brings is also tightly connected to the agile movement in an ever more complex environment where business conditions and requirements change all the time and where we need to juggle tons of tools and technologies every day the best culture is not one of blaming and finger-pointing but one of experimentation and learning from past mistakes so we want to have everyone collaborate instead of working in silos and stages instead of finger pointing everyone takes responsibility for the final outcome if the final product works and the customers or users of the product are happy everyone wins the customers the project managers the developers the testers the sys admins and anyone else i did not mention everyone wins however devops is more than just culture to succeed organizations adopting devops also focus on automating their tasks manual and repetitive work is a productivity killer and this is what we are going to address in this course automatically building and deploying software which falls under a practice called cicd we want to automate as much as possible to save time and give us the chance to put that time to good use instead of manually repeating the same tasks over and over again but to automate things we need to get good at using the shell working with cli tools reading documentation writing scripts quite often you may see devops being represented by this image while this does not give a complete picture of what devops really is it does show a series of steps a typical software product goes through from planning all the way to operating and monitoring the most important thing i want you to notice in this representation is that this process never stops it goes on and on in an endless loop this means that we continue going through these steps with each iteration or new version of the software what is not represented here is the feedback that goes back into the product devops goes hand in hand with the agile movement if adrian and scrum are new to you make sure to add this to your to-do list nowadays many organizations go through an agile transformation and value individuals who know what agile and scrum are regardless of their role i’ve added some resources you may want to look into in the course notes if you have some free time while commuting or doing other things around your house i highly recommend you listen to the phoenix project as an audiobook it is an accurate description of what companies that are not adopting devops go on a day-to-day basis and realistically portrays such a transition this is by no means a technical book and i’m sure it will be a fun listen so devops is a set of practices that helps us build successful products to do that we need a shift in thinking and new tools that support automation however i must warn you that you can use tools that have devops written all over them and still not do devops so devops is so much more than just adopting a particular tool with that being said let’s continue diving into gitlab ci in this unit we will start working on a simple project we want to automate any of the

    manual steps required for integrating the changes of multiple developers and create a pipeline that will build and test the software we are creating in other words we will do continuous integration continuous integration is a practice and the first step when doing devops usually we’re not the only ones working on a project and when we’re doing continuous integration we’re integrating our code with the code other developers created it means that every time we make changes to the code that code is being tested and integrated with the work someone else did it is called continuous integration because we integrate work continuously as it happens we don’t wait for anything to do that we don’t want to integrate work once per week or once per month as it can already be too late or too costly to resolve some issues the more we wait the higher the chances we will run into integration issues in this unit we will use gitlab to verify any changes and integrate them in the project i’m going to be honest with you as we build more advanced pipelines you will most likely encounter some issues if you haven’t done it yet go right now to the video description and open the course notes there you will find important resources and troubleshooting tips finally let’s do a quick recap when we have multiple developers working against the same code repository ci is a pipeline that allows us to add and integrate our changes even multiple times per day what comes out is a new version of the product if you’re still unsure about continuous integration at this point don’t worry we’ll implement ci in our development process in the upcoming lessons for the rest of the course we’ll be using this project this is a simple website built with react which is a javascript technology developed by facebook now we don’t want to get too much into the technical details because they don’t really matter so much at this point but the first step in order to be able to make changes to this repository is to make a copy of it so for example if you’re trying here to open a web ide in this project i will get this option to fork the project by the way you will find a link to this project in the course notes and the course notes are linked in the video description so we can click here on fork and we’ll make a copy of this project under our account now that we made a copy out of this project we can then open the web ide and start making changes to it and particularly what we’re trying to do is to create the pipeline so let me give you an overview of the tasks that we are trying to automate essentially here in this project we have a couple of files one of these files is this package.json file and this file essentially documents which requirements this project has and in order to actually run this project we first need to install this requirement so locally i already have a copy of this project and the command to install these requirements is called yarn install so now all the requirements have been installed the next step would be to create a build and that would be done using the command yarn build and during this process what has actually happened is that a build folder has been created and this build folder contains multiple files that are required for the website so let me give you an idea how this website looks like and what we actually did here so i’m going to run the command serv minus s and going to specify the build folder and now essentially we have started a server we started an http server which is serving the files available there so i’m going to open this address in a new tab and this is how the website looks like so essentially what we’re trying to do in this section is to automate these steps so we want to install the dependencies we want to create a build we want to test the bill to see if the website is working and i’ve shown you these tools because it is always a good idea to be familiar with the cli tools that we’ll be using in gitlab ci now in gitlab we try to automate any manual steps but before we do that we must know and understand these steps we cannot jump into automation before we understand what the commands that we want to do are actually doing now i’m not really referring in particular to the commands that i’ve shown you here because they are specific to this project you may be using python or java or anything else so you don’t need to be familiar with these tools in particular i will explain to you what they do and how they work however what is important to understand is the concepts the concepts remain the same and this is what we are actually focusing on in this course we are focusing on understanding the concepts around automation so let’s begin creating the ci pipeline for this project so i’m going to go ahead and create here a new file and of course the definition file for the pipeline will be dot gitlab.ci dot yaml the first job that we want to add here is build website and what we are trying to do here where we’re trying to build this website and why do we need to build the website well essentially or most of their projects do have a build step in this case we’re essentially creating some production files production ready files which are smaller optimized for production from some source files so we have here in the source files you will see here an app.js and any other file so essentially the build process will take all these files and will make them smaller and will put them together in a way other programming languages may need to have a compilation step or any other steps so typically something happens in the build process where we actually are putting our project together now of course we don’t want to do that manually from our computer we want to let gitlab do this for us so let’s go ahead and write here the script for this the first step is to essentially run yarn and yarn is a tool that is helping us build this project this is specific for javascript projects essentially node.js projects and yarn is a tool that can be used for getting dependencies they can also be used for building the software so the command that we are running here is build locally as you remember the first thing that i did was to do a yarn install to install dependencies and this is something that needs to happen before the build so every time when we are building this website we need to get the dependencies to make sure that we have all the dependencies that we need and to ensure that all of them are up to date and because they don’t remain anywhere in the container we need to do that all the time and normally locally would do that only when we need to do that so for example when we know that we need a newer dependency of a software package but gitlab doesn’t have this information so we kind of like need to run this all the time you also need to specify your docker image so let’s try for example alpine which we have used before so essentially what i’m trying to do is to replicate the commands that i’ve executed on my computer installing dependencies and building the project so let’s commit these changes and see what pipeline does i’m going to commit them to the main branch and click on commit here we can take a look at what the job is doing and we’ll be able to see here that we get an exit code now remember any exit code that is not zero will lead to a job failure and it says here job failed now why did this job fail well we have to look like what is the command that we try to execute and we’ll find here something saying that yarn not found so essentially what this means is that the docker image that we have used does not have yarn so how do we install yarn or how do we normally do this now the thing is we don’t have to use this alpine image that you have seen here essentially for most projects and this includes node.js which is actually what we’re using here and which i already have installed locally this is why it worked locally there are official docker images that we can use and the central repository for such images is docker hub so this is a public docker repository so for example if i’m typing here node i will be able to find here the official image for node and i can essentially instead of using alpine i can simply use here node so let me go back to the project and i’m going to write here node now the thing is when we’re doing here when you’re writing alpine or node what is actually happening is that we are always getting the latest version of that docker image sometimes it may work but sometimes the latest version may contain some breaking changes which may lead to things not working anymore in our pipeline if one day we’re getting one version and next day we’re getting something else without us making any changes things may break so for that reason it is generally not a good idea to just use node for example or just to use alpine as we have done before it is better to specify a version to put it down like which version do we need here and to write it down as essentially as a tag now how do we know which version do we need now for node what we’re going to do here we’re going to head to nodejs.org and here you’ll see here two versions that are currently available for download what we want to do is we want to use the lts version now you will see here that the latest lts version that i’m currently seeing right now is 16.13.2 now what’s important here is the major version which is 16. when you are watching this it’s important that you come to this page and you look at a number here probably it will increase over time most likely it will increase over time you’ll get a different version it’s important here that you get the latest lts version that you see here all right so let’s go inside our pipeline and then write this 16 version here so the way we’re going to do here we have node which is the base image and then we can specify a tag by writing column and then i’m going to write 16 right and most likely this version is already available on node but you can always make sure and check here go to the tags and see if this specific tag is then available there but this major tags typically they are available and will have no issues downloading this so let’s commit the changes and see how it goes and again i’m gonna push to the main branch when this executing you will be able to see here which image is being downloaded and you will see here it’s node and the tag is for the version 16. now this job is now requiring much much longer to run you will see here the duration in this case was one minute and 35 seconds and this is because we have to download what is a relatively large docker image this node image and then we are installing the dependencies and you’ll see here that these dependencies take 44 seconds to be installed to figure out which dependencies are required to download them from the internet that takes a bit and then we are actually doing the build and this also takes a few seconds to complete but fortunately everything is then successful in the end and this is the most important step at this point we don’t want to waste a lot of time when we are actually executing these builds and i know for a fact that this note image is a few hundred megabytes large in size this is because it contains a lot of tools and a lot of dependencies which we may not need so for that reason it’s always a good idea for these larger images to go here on the specific image to click here on the text tab and generally to take a look at like what is the size of these images and what’s happening with them because some of them are quite big so we could theoretically search here for version 16. and by default we can see here that this is the one tag that’s more specific it’s not exactly what we’re using we will see here version 16 something it has about 332 megabytes so if we’re selecting to use this image every time we’ll have to download 300 something megabytes that’s a lot of download and a lot of time that we are wasting just to start this image so for that reason what i typically do is i go here in the tags and i search for alpine sometimes slim or other images can also be a good idea and what i’m interested in is something like 16 alpine so let me write directly 16 alpine and this looks absolutely fine here so 16 will be again the node version that we are trying to use and if we’re looking here at the size take a look at this it’s 38 megabytes so what we’re going to do we’re going to simply take this and go in our pipeline and replace 16 with this stack so here inside instead of using 16 we’re going to use 16-alpine gonna commit these changes we’re gonna take a look again at the pipeline to see how long does it take right now to build this so this job still needed quite a bit of time one minute and 26 seconds you may see this duration varying but generally it is a very good practice to use images that are as small as possible because this can save time and you may see that maybe this job will even go below one minute it really depends like how fast the runner will pick up the job and will able to start this image but the main idea is the same we now have managed to automate the first steps in our project we’re installing some dependencies and then we are running the build so this seems to be working just fine just to recap we are using this node image before we have tried using alpine image now the alpine image didn’t work because it didn’t have node js installed now essentially what we’re using here is essentially the same image as before the same alpine image alpine linux image but it has node installed so it has the dependency that we need and this node dependency contains yarn this is why yarn didn’t work before now it’s working just fine and it’s building the project the most important thing that you can do when you’re learning something new is practicing and i want to give you the opportunity in this course to practice along so not just following along what i’m doing but you also have the opportunity to do something on your own and for the next assignment i already think that you have to know how necessary in order to do that what we’re trying to do is to create two new additional jobs in this pipeline this is your job now to write these jobs so what are these jobs all about the first job is trying to test the website and the website is currently inside the build folders if i go inside the build folder you will see here a list of files now your job is to ensure that the index.html file is available inside the build folder so this is the first job that you need to create the second job i want you to create is in regards to running units so in order to run unit tests the command that we are using is yarn test and the only thing you need to do is to create a job and to run this command to take a look at the logs and see that the tests have indeed been executed the upcoming lesson will contain the solution to this but please it’s super important that you pause this video and try this on your own try as much as you can because this is the best way to learn and to ensure that what i’m showing you in this course is something that you will be able to use in your projects as well i hope you have tried to solve this assignment on your own but anyway this is how i would approach this problem so i’m here inside the editor for the pipeline and let’s begin just with the skeleton so what are we trying to do we have two new jobs we have test website where we’re essentially trying to test the output of the build website job and we also have a unit tests job so first of all we have to think about stages what we want to do happens essentially after the build well it really depends a bit so for example the test website this definitely needs to happen after the build the unit tests they don’t necessarily need to happen after the build but we’re going to put them inside a different stage as well so let’s go ahead and define the stages here so we’re going to have two stages we’re going to have here built and we’re going to have another stage which is called test and what we need to do is to assign this jobs to a stage so the build will be assigned to the stage built of course and then the test website will be assigned to the stage test and the same goes with the unit test right in order to test the website what we are trying to do well let’s try and write the script we are trying to test if we have an index.html file there so as you probably remember the command test dash f so this we are testing for the existing file this needs to be inside the build folder and the name of the file is index.html now what we haven’t done so far is inside this build website job to declare artifacts so as it is right now this command will fail so what we have to do here is of course think about the artifacts so which artifacts do you have we have to define the paths and the only paths that we’re interested in is the build path so then this will be able to test for this file the next thing we need to think about is which image do we need for test website so theoretically we could use node 16 but actually this command test doesn’t require something like that so we could just use alpine and test is a pretty general command so we don’t have to worry about specifying a version or anything like that so just going with alpine should be just fine there’s of the unit test we essentially need this node image because we’ll be using yarn so i’m going to simply go ahead and copy this image that we have used in the build website and of course the script will also be kind of a similar uh we still need to install dependencies so yarn install is necessary here when we’re trying to run the unit test and the command that we want to run is yarn test so let’s double check to make sure that we have everything in place we have defined two stages build and test we have assigned build website to the stage build and we have assigned the test website and the unit tests we have assigned them both to the stage test so this means these two jobs will run in parallel here we’re just using the test command to verify if this file exists and here we’re installing the dependencies and then running the tests so i’m gonna go ahead commit these changes and we’ll inspect together the pipeline and after a minute or two this buy plan will succeed and you’ll notice here the two stages build and test we’re building a website and then we’re testing what we have the unit tests are not necessarily dependent on the build itself but we put them together in a test so if looking here at test website what do we see well we see here the command test minus f so it’s testing if this file actually exists if it’s part of the job artifacts of course if you’re looking inside the build website you can go here and look at the artifacts see here the build folder we’ll see here multiple files so not only the index.html file but we’ll see here some images some additional files that we don’t really care so much at this point but they are available there so that’s the most important aspect that we really care about and here the unit tests the unit tests are part of the project and generally when you’re writing code we are also writing unit tests to document that what we’re doing there is working properly you will see here the command that has triggered the test has been yarn test there’s only one file here that contains only one test all these tests have been executed and because the tests are passing the job is also succeeding any of these tests would not work then the job will be failing and the entire pipeline will also be failing the first tool we need for integrating work is already in place we are using git for versioning our code we also use gitlab as a central git repository we take git for granting nowadays but it solves a critical issue and is one of the first devops tools you need to know while this course does not go into git i highly recommend checking the course notes for a comprehensive git tutorial so in our current model every developer pushes changes to the main branch whatever version of code has been pushed last time in the main branch that is the latest version anyone wanting to add new changes will have to make them compatible with the main branch however this model does have a serious flaw nothing is safeguarding the main branch what if the latest changed has introduced an issue and we can’t build a project anymore or what if the tests are failing this is now a massive problem as nobody on the team can continue working and we can’t deliver new versions of the software a broken main branch is like window production halts in a factory is not good for business we must ensure that the main branch does not contain any broken code the main branch should always work and allow us to deliver new versions of the software anytime we need to do that so how do we solve this the idea is simple we just don’t push untested work in the main branch since we can’t trust that developers remember to run all tests locally before pushing a change we want to take advantage of automation and gitlab to automatically run the tests before adding any changes to the main branch the idea is to work with other branches which are later integrated into the main branch this way every developer can work independently of other developers there are various git workflows but we will use one that is simple to understand it’s called the git feature branch workflow the idea is simple for each new feature bug idea experiment or change we want to make we create a new branch we push our changes there let the pipeline run on the branch and if everything seems okay we can integrate the changes in the main branch so in other words we simulate running the main branch before we actually run the main branch if our branch pipeline fails no worries all other developers are unaffected and we can focus on fixing it or if we don’t like how things turned out we can just abandon the branch and delete it no hard feelings there either as part of working with branches we create a merge request that allows other developers to review our code before it gets merged a much request is essentially one developer asking for the changes to be added to the main branch the changes are reviewed and if nobody has objections we can merge them so this is the plan for the upcoming lessons to start working with git branches and merge requests so let’s get to work so how can we create merge requests in gitlab first of all to ensure that the chances of breaking the main branch are as small as possible we need to tweak a few settings so we’re going to go here to settings general and right here in the middle you should see merge requests i’m going to expand that and what i like to use when using merge requests is to use this fast forward merge essentially no merge commits are created and generally the history remains much cleaner there’s also the possibility of squashing commits directly from gitlab and you can put it here and encourage scratching commits is when you’re pushing multiple changes to a branch and instead of pushing all these changes back into the main branch we scratch them all together so we essentially like we have only one commit again makes the history much easier to read going forward here in the merge checks we want to make sure that the pipelines succeed before we are merging something so this is a super important setting here that we have so let’s go ahead here go at the bottom and click on save changes and additionally again from settings when go here to repository and from the repository you’re going to go here to protected branches i’m going to expand this and what we want to do here is we want to protect the main branch so essentially we don’t want to commit changes to the main branch anymore we want to prohibit that so nobody will be allowed to directly commit something to the main branch so in order to do that we have to go here to allow to push and instead of having something selected or some role selected here can i use no one so no one is allowed to push to this protected branch only if it goes through a merge request so these are the initial settings that we need to do and we’ll be able to see here now let’s try and make some changes and open the web ide open the pipeline file and now let’s say i’m trying to add here a new stage where i’m trying to do some checks for example there is linter that i can use and linter is simply a static code analyzes tool that is used to identify potential programming errors stylistic issues and sometimes you know questionable code constructs since it is static it does not actually run the application it just looks at the source code and most projects do tend to have such linter inside and just for the sake of completion i also want to add here linter so i’m gonna go ahead here and i’m gonna write here linter this is the name of the job the image that i’m using is still node here and the reason for that is inside the script the command that we are running is actually yarn lint and of course we also need to install all dependencies and additionally we have the possibility of assigning this job to a stage now by default gitlab comes with some predefined stages prefined stages include a press stage build stage a test stage deploy stage and post stage so these are all actually predefined and to be honest this is just to make it clear like which stages we are defining here and which stages we are using but these are already defined by gitlab so we’re just essentially redefining something that exists so for this linter i could go ahead and use a stage and this stage name will be dot pre and this linter has absolutely no dependencies on the build itself the same goes for example here with the unit tests the unit tests are also not dependent on the build so i could go ahead and move them to the same stage just to make this clear so there’s a dot there and because this is a predefined stage we don’t need to redefine it again so i could go ahead and write it here but it’s not really needed all right now going back here the editor that i opened here is from the main branch you will see here main is selected right and let’s go ahead and commit and you’ll see here i’m no longer allowed to commit to the main branch so this is by default disabled the settings that we did ensure that we are no longer allowed to directly make changes to the main branch so we have to create a new branch quite often when we are creating branches we tend to use some naming conventions now totally up to you what you want to use or how your organization uses that quite often you will have something like feature for example for what slash and then a name of a feature sometimes you may reference a ticket or something like that so for example you have your ticket number one two three four add linter so you will see here i’m adding no spaces or anything like that it’s totally up to you how you use these forward slashes hyphens as separators and so on you’ll also see here the possibility of starting a new merge request so i’m essentially these changes now are not committed i’m going to create a new branch the branch name will be feature forward slash and some name i’m gonna click here on commit this will open an additional window so the branch has been created but now i’m also opening a new merge request and here in the merge request there are a few things that i should fill out so for example the title is not very suggestive so i’m going to write here something like add linter to the project you can also go ahead and provide a description this is also useful for the people who are looking at this merge request to know why this is important what this feature is bringing or if it is a bug fix which issues is this fixing and so on so you could do that there are also some additional labels and options that you can set here i’m not going to go over them because they are essentially relatively easy to explain and i’m going to go here and click on create merge request and now a new merge request has been created and additionally we also have here a pipeline that is running against this branch so what is happening here is that the changes that we made which you will be able to see here what we do do we added here a new stage we added here a linter uh also made some changes to the do the unit test so we can go ahead and look at these changes we have here a pipeline that’s executing it’s going through all these stages we have here the pre-stage the build stage and the test stage and now we can simulate running this pipeline to see if it fails if it fails we have the opportunity or of fixing things if it doesn’t fail then we have the option of merging these changes the next important step in the life of a merge request is the review process especially the code review where somebody else from the team is taking a look at our changes and is giving us feedback now just in case you don’t know where your merge request is you will find here on the left hand side this panel says here merge requests and we’ll indicate how many merge requests are open at this time so we only have one merge request you will see here this is the title of the merge request so we’re trying to add linter and you’ll find here like the most important information so this is a request to merge this feature into the main branch right if you need to make changes to it you can open this branch in the id and continue making changes to it you have your information about the pipeline so we know that the pipeline has passed and someone else looking at this we’ll be able to see here which commits have been made and also to have an overview of the changes inside here there are different views that you can have you can compare these files and someone can also leave comments here so for example i could simply click here on the line and ask why did you use the prestage right and you can add a comment now where does this merge request go now typically when someone has reviewed this can go ahead here and approve it so you will see here who has reviewed these changes and you may have internal roles like you need to people to review any changes before they are being merged so the changes can be approved and then they can be merged comments can appear so for example here i’ve added a question to these changes so maybe there’s some discussion that needs to happen there feedback can be gathered from different people involved and this feedback may need to be integrated so for example as i mentioned you can still do changes to this the merge request will always have the latest changes so we can make more commits it’s also possible that for some reason these changes are no longer needed they are wrong or the approach that was taken doesn’t really make sense so so there’s also the possibility of closing a merge request you can go here and see closed merge requests so this will be closed and no changes will be merged so that’s also a possibility but typically what happens after the review after some changes have been integrated we’re gonna go here on this merge button and what is happening here is we are merging this branch into the main branch and there are two options that are enabled by default the source branch so the branch that we have created will be deleted which makes sense because we don’t need it anymore and in case we have multiple commits we can also squash those commits and in this case we have only one commit we can modify the commit message if we want to in this case that’s not needed and then we can simply click here on the merge button this merge button is available only if the pipeline succeeded but our pipeline did succeed so this is why we can see it so now gitlab will merge these changes into the main branch and again a new pipeline will be generated and this is the pipeline for the main branch so you will see exactly the changes that we made we have here the pre-stage the build and the test these are all available here and exactly what we have run inside a merge request the pipeline is running again against the main branch and this is needed just to ensure that indeed everything is working fine and that there are no integration issues or no other issues so it’s a good practice not something that may seem that it’s happening somehow as a duplicate it’s actually important to ensure that the main pipeline is working properly this is what we care most about to ensure that this main pipeline is working as it should work that’s the reason why we have reviewed the merge request to ensure that whatever we’re changing here in the main branch is as good as it gets and that the chances of breaking something are drastically reduced right in the beginning of this section i’ll show you locally which are the steps they need to build this project but i’ve also taken the build folder and i’ve opened the website and you have seen something that looks like this how can we replicate this in gitlab essentially we want to make sure that we indeed have a website that’s running that can be started by a server and we want to make sure that you know for example this text here shows up learn gitlab ci how can we do that inside the pipeline currently we’re just checking if we have a file which is called index.html that’s not really telling us the entire story so this lecture we’re going to take a look at how we can do essentially what’s sometimes called an integration test we’re really testing that the final product is really working i’m going to open up the web ide and inside the pipeline file kind of focus on this test website job so this current test is not really that helpful we want to do something else so for example you have seen me running the following command which has been serve dash s build right so this takes the build and we’ll be able to start a server and then we can take a look at what’s going on so we’re going to remove this because we don’t need that anymore i’m going to start here server and just because i want to make sure that this is running as fast as possible and that we’re not wasting a lot of time i’m going to go ahead and disable some jobs so i’m going to disable here the linter job that’s not really needed in the beginning i’m going to also disable the unit test so to disable the job you simply add a dot in front of the job name and that job will be disabled let’s go ahead and commit these changes and again we’ll have to create a new branch call this feature integration test i’m going to start a new merge request as well i’m going to call it add integration tests i’m going to click here on create merge request if you’re looking at the pipeline we’ll see that the build has succeeded but there seems to be an issue with testing the website so let’s take a look at the logs and understand what is going on we’ll try to understand here what is the error we’re getting an exit code the last command that we executed is serv and we’re getting here surf not found so again we’re trying to run a command this command was working locally for me but at least the docker image that we are using here does not have this command so which docker image are we using we’re using alpine and alpine does not have this command so we need to find a way to install this command as well so for that we’re going to go back to the editor we can go here from the merge requests click on the merge request and we’ll find here open in web id and then we’ll be able to see here this is essentially a list of changes that we have this is the review it shows us what we have changed but if you want to make changes to the code we’re going to go here this will allow us again to select the pipeline file and make changes to it so let’s see what we need to do in order to get this job to run as well now first of all we’re gonna use here this same node image because serv is actually something that runs on node so it’s a dependency that runs on node and we’re gonna use yarn and we’re gonna add this dependency i’m gonna see here yarn add serve and actually you’re going to use this as a global dependency so i’m going to write here global so using yarn global add serve right this will ensure that we now have serve we can use yarn because we now have the node image again this time we are already in a merge request so we can go ahead click on commit i’m going to commit directly here to the existing branch that we have and the pipeline will be executed again be sure to watch what i’m explaining next because we have introduced an issue in this pipeline and it’s a big issue but can explain in a second what that issue is i’m going to go ahead open this pipeline and i’m going to go directly to this test job and wait a bit here to see what is happening and i wait for this job to start so i want you to notice what is happening with this job so we have started this docker container which contains node then we have added this dependency which is serve and then we have executed serv which folder are reserving or serving the build folder then it says here info accepting connections on localhost port 3000 so what is going on well we have started an http server which is serving these files inside this gitlab job and when does a server end well it never ends that’s the purpose of the server it will serve these files indefinitely and of course this approach that we started here is not good because we’re gonna wait here forever well actually not forever jobs do have a specific timeout you will see here the timeout that is one hour so if we don’t stop this job this job will run for one hour so this is an important concept when you’re starting a server inside a job that job will never end or will run into this timeout so be very careful when you’re doing things like that now i’m going to go ahead and manually stop this job you will see here this cancel button here we cannot wait forever so i’m going to cancel it and then this will stop now there is a way to start a server and there is a way to check that text but we still need to make some changes so i’m gonna go back again to the pipeline let’s go inside the code open the pipeline and see what we have here now what do we want to do so we have managed to start this server it will run forever but how do we test something so in order to test something we have to execute the upcoming command and in order to actually get this information we need essentially an http client we need another tool that will go to this address which is you have seen there it’s starting on localhost which is the host name on port 3000 and the protocol is http so we don’t have a browser that we can open here so we need something that is as close as possible to a browser so that tool is curl so curl is a tool that will be able to go to this address download the website and then we can do something i’m gonna use here a pipe so this will send the output of this website to the next tool and as you remember from working with files we have the possibility of using grep so grep will search for a specific string so what is the string that we’re looking for i think the string is learn gitlab ci i’m gonna check again against the website to make sure that i have this exact text here because this is what we are trying to find inside a website right so we’re starting a server then we have this curl command and in grab we’re getting the website and then we can search for this string we still haven’t solved the problem with the server running forever we don’t want it to run forever so we’re going to use a small trick and i use here this and sign and what will this do is to start this process in the background so it will essentially still start the server but it will be in the background and it will not prevent this job from stopping so when the curl command has been executed this job will also stop because this command will be executed right after this one curl will not wait for the server to actually start the server needs a few seconds to start and in order to wait for that we don’t know exactly when this will start so we’re going to use another command which is called sleep and sleep will take a parameter here so this will be in seconds so we can decide how many seconds we want to wait just to be sure i’m gonna use here 10 seconds additionally curl is also another command which we don’t have and this is actually a dependency of this alpine image so this has nothing to do with yarn or npm as serve does this is an exception so for that reason we’re have to use here the package manager from alpine so a b k this is the alpine package manager and we’re gonna add here curl so this is how we are adding curl as a dependency so let’s give it another try and see if this works now if we’re looking at the logs we’ll see that this is still failing maybe this is not our day but let’s go through the process again and try to understand what is going on and generally i have to tell you we have to get used with errors and the more we understand about this the more we are able to solve this kind of problem so we have added surf we have added curl and we started the server we can see here if we’re still getting this information accepting connections at we waited here for 10 seconds curl has downloaded this and then has sent this to grab but we are getting here an exit code one because we’re not seeing any errors from curl which means that curl has downloaded this information we have to wonder like what’s going on with grep why isn’t this information available there in the response now we could go and debug this a bit more but essentially when carl is downloading a website it’s not really downloading what you see right now here it’s actually if you click on this go here to view page source on any website what curl is actually doing is downloading this now this is the index.html file and this index.html file will download other things in the background we’ll download some scripts so that information there is not really coming from the page from this page that we are getting with curl and curl doesn’t have the possibility of actually rendering javascript and images and so on so it’s very basic tool what we have here for example is this react app in the title so how about if we change this and we are asserting that we have this title so let’s go ahead in the application and figure out where this react app appears now i change it to something with git lab so instead of using learn gitlab we’re gonna simply try and use react app because we know this is available here so from the project i’m going to open the web ide if i’m not in the right branch i can simply switch the branch open the file that i want to edit so we’re going to use instead of learn gitlab ci i’m going to use here react app and we are also gonna enable the rest of the jobs which are the unit tests which have been disabled the linter has been disabled and then we’re gonna put all these changes together commit them to the branch we’re not going to start here a new merch request we already have a merge request so we’re going to disable that if it’s enabled i’m going to commit again and finally the tests are working so let’s go again and inspect the job logs so what we find here well we have everything that we are interested in and particularly the last part was the one that was failing and now it’s able to locate this inside here so this is why you’re getting back the entire text you’ll see here react app it’s in the response so curl and grab now work together and this job succeeds has been a bit of work but i’m happy that we have this test and it ensures that our pipeline really works a bit better and that we’re more confident in what we’re building i’m gonna go here to the merge request you will see here we have four commits we have here essentially the changes that we made so we reverted all the other jobs that we have disabled and we just have adapted this test website so from that point of view everything is good we’re gonna squash here the commits so we can also modify the commit message commit messages add integration test so that looks good i’m gonna click here on merge and this changes will be merged into the main branch so currently our continuous integration pipeline looks like this it is divided in three separate stages and the way i’ve structured this is just an example there is no hard rule different programming languages and technologies may require a different order you are smart people and i’m sure you’ll be able to apply these ideas to whatever you’re doing however i just wanted to mention two principles or guidelines that you should consider one of the most important aspects is failing fast for example we want to ensure that the most common reasons why pipeline would fail are detected early for example here linting and unit test quite often developers forget to check their linting make a mistake or forget to run the unit test so if we notice that this is happening a lot it really makes sense to put this as the first stage of the pipeline they typically don’t need a lot of time so the faster they fail the better it is because we’ll get fast feedback we’ll use less resources and of course we know if we’re running here in parallel jobs that are similar in size that’s also a relatively good way of grouping jobs together now you also have to be very careful when you’re grouping jobs in peril for example if you have a job that finishes in 15 seconds and you have a job that finishes in five minutes for example let’s say here linter needs 15 seconds unit test needs five minutes if the lender fails after just five seconds the unit test will still run for five minutes there’s no no stopping there so it does make sense to put in parallel jobs that are similar in size another aspect that you need to consider are the dependencies between the jobs so what i mean by dependencies well for example here we cannot test the website until we have actually built the website but the linter and the unit tests they don’t depend on the build output so for that reason we can run them before the build we can run them after a build we don’t have a dependency there but in this case for the website we are dependent on the job artifacts because we’re using them for something so from that perspective we always need to have the build job before here we can test the website so if jobs have dependencies between them they need to be in different stages now i have to say that there is no replacement for experimentation and trying things on your own if you are unsure if something works or not just give it a try and see how far you can go and why that pipeline fails as you have noticed so far our pipeline does require a bit of time and actually optimizing these pipelines is a lot of work so what i wanted to show you is just a very simple way on how we’re gonna save a bit of time throughout this course so that we don’t wait so much for each of these stages so again i’m gonna open here the web ide and what i want to do is to essentially restructure these jobs now as you can notice here the build website the linter and the unit tests they are all pretty similar they all use the same image they all need to install yarn dependencies and they just run a command after this so one idea would be to for example take the linter so yarn lint and to put it right here after we have installed the dependencies and in that case we don’t need this job anymore same goes for the unit tests right we’re gonna take here the unit tests and put them after yarn lint and again we’re not gonna need this anymore also not gonna need a stage we can reduce this to just two jobs so this job indeed has this image which is the same as this one but doesn’t have any dependencies so it’s just installing surf here it’s installing curl so i don’t want to really combine this in a single job we could theoretically put everything in a single job but i’m just doing it now for performance purposes and in order to save a bit of time we’re just gonna stick to this two different stages the build stage and the test stage and even if you’re doing here a bit of testing it’s acceptable now to be able to save a bit of time and as i said it’s totally up to you how you structure your pipeline but this is why we are removing now this i just wanted to show you how they look like but for the rest of the course we don’t want to wait so much time waiting for these stages to complete so for that reason this will be a bit easier i’m going to create a merge request and merge these changes into the main branch if you’re binge watching this course make sure to take a break after a few lessons there is a lot to take in but you need to take care of your body as well so get up from time to time drink some water eat or go outside and relax your mind and trust me taking a break is so much more productive than staying all day in front of your computer if your body does not feel well this impacts your productivity and energy levels so i’m going to take a break as well and i’ll see you in a bit [Music] in this unit we’ll learn about deployments and we’ll take our website project and deploy it in the aws cloud along the way we’ll learn about other devops practices such as continuous delivery and continuous deployment by the end of this section we’ll have a complete ci cd pipeline that will take our website build it test it and let it float in the cloud just a quick reminder in case you get stuck or something does not work check the video description for the course notes which include troubleshooting tips this sounds exciting let’s begin amazon web services or simply aws is a cloud platform provider offering over 200 products and services available in data centers all over the world aws offers a pay-as-you-go model for renting cloud infrastructure mostly for computation or data storage so instead of buying physical hardware and managing it in a data center you can use a cloud provider like aws such services include virtual servers managed databases file storage content delivery and many others aws started in the early 2000s and its adoption continued to increase over time maybe you have heard the story when the new york times wanted to make over 1 million old articles available to the public a software architect at new york times has converted the original article scans into pdfs in less than 24 hours at a fraction of the cost a more traditional approach would have required and this was back in 2007 today many organizations can’t even imagine their idea infrastructure without using some cloud components while this course focuses on aws the principles presented here apply to any other providers if you don’t already have an aws account don’t worry it’s quite easy to create one and your personal details and click on continue since we’re using aws for learning and experimenting with it i recommend choosing a personal account aws is a paid service and even though in the beginning there is a free tier that has some generous limits and is ideal for learning and experimenting you are still required to provide a credit card or debit card for the eventuality you will go over the free limit i’ll go with a free basic support plan which is fine for individuals now that we have an aws account that is verified and has a payment what we need to do next is sign in into the console because from the aws console we can access all services that aws offers if you’re seeing the aws management console it means that you have set up everything correctly and you can continue with the rest of the course and essentially start using aws right away let’s do a bit of orientation this is the main page from where you navigate to all aws services aws services are distributed in multiple data centers and you have the possibility of selecting the data center you would like to use right here on the right side on the top of the menu i will go with u.s east 1 north virginia you can use whichever region you like just remember the one you have selected as this will be relevant later on typically the data centers in the u.s have a lower cost than others that are spread around the globe and right here you have a list of all services available you can also search for services in this search bar finally i highly recommend that you go to your account profile and enable multi-factor authentication this will significantly raise the security of your account that’s about it now you can start using aws the first service that we want to interact with is aws s3 which stands for simple storage service you can find a service by simply searching for it you will see here s3 i’m gonna click on it and there you go this is aws s3 s3 is like dropbox but much better suited for devops actually for a long while dropbox was using aws s3 behind the scenes for storing files but let’s go back to the course since our website is static and requires no computing power or database we will use aws s3 to store the public files and search them to the word from there over http on aws s3 files which aws calls objects are stored in buckets which are like some super container folder now you may notice that your aws interface looks a bit different than mine aws is constantly improving the ui and things may change in time however the principles that i’m showing here will stay the same so let’s go ahead and create our first bucket first of all we have to give our bucket a name and the name of the bucket needs to be unique so i’m going to give this bucket a unique name so that i don’t run into conflicts with anyone else who may have created the bucket with the same name so i’m gonna just give here my name and a dash and after that i will give here a date additionally you’ll have here the aws region and in my case i’m gonna keep it exactly as it is and there are also a bunch of settings that we’ll not look into right now so right here at the end i’m going to click here on create bucket all right so the bucket has been successfully created and we can go inside the bucket and to see if there’s anything in there but at this point there are absolutely no files of course we could go ahead and manually upload files or download files or things like that so through the web interface it’s possible to add files and folders but this is not what we are trying to accomplish with devops we want to automate this process so for that reason i’m going to leave it as it is and in the upcoming lectures we’re going to find a way on how to interact with aws s3 from gitlab so how can we interact with the aws cloud and particularly with aws s3 in order to upload our website if you remember in the beginning we talked about how we typically interact with computers and that is through a cli command line interface so for the aws cloud we need a command line interface to be able to upload files for example and fortunately aws has already thought about that and there is an official aws command line interface that we can use there’s also here a very in-depth documentation about the different services that are available and throughout the course we’re gonna also navigate through this documentation because i want you to understand the process of interacting with such services and the importance of actually using a documentation and not just replicating what i’m doing on the screen now to be able to use the aws cli inside our gitlab pipeline we need to find the docker image and the best place to search for docker images is in docker hub so here inside docker hub i’m going to go ahead and write aws cli and i’m going to find here we’ll see it it’s under verified content if possible we always try to use verified official docker images i’m gonna take this one so all i have to do is simply copy this and then we’re gonna go inside our pipeline open the web id again and let’s go ahead and create a completely new job here so i’m going to call this job deploy to s3 and we’re gonna add an additional stage here because we need to do this deployment after the ci pipeline is done so we have tested everything and after that if everything passes then we’re gonna move to the next stage which is the deploy states and right here stage deploy and the image that you want to use is the one i’ve just copied which is amazon aws cli now by default this image will not really work the way we have used for example the node image or the alpine image this image has a thing which is called an entry point essentially when we’re starting the image there’s already a program that’s running with that image and this is something that conflicts a bit with the way we’re using images in gitlab so we need to override that entry point so for that reason i’m going to move this to a new line i’m going to write here another property which is called name so this is under image and this is not a list and below it i’m gonna write entry point and here i’m gonna overwrite the entry point with this square brackets and this quotes here so then comes the script part and in the script part we are essentially writing well let’s test if the tool is working so typically almost every tool will have the possibility of printing out the version so the name of the tool is aws and then the version will be dash dash version now what we’re interested in is using aws cli in version two this is the current version another version is version one but we’re definitely interested in using version two so for example here from docker hub you can go to the tags and you can also specify a tag if we don’t specify a tag we’ll always get the latest version but generally it’s recommended that you specify a tag in it you go with a tag so for example if i want to specify this tag i’m going to copy the name of the tag i’m going to add here column and then the value that i want to use it’s a best practice to always specify a tag but of course by the time you watch this there will be newer version typically anything that starts with two should be good enough so let’s commit these changes in a branch and see how the pipeline looks like now right now i’m getting an error and if i’m looking inside the pipeline to see what’s going on there are some errors because the stage i have chosen in this case the deploy stage doesn’t exist so the pipeline hasn’t been executed so we still need to make some changes to it so here where we have the stages i’m gonna add here deploy so now we have the stage build test and deploy again i’m going to commit and see if the pipeline runs so now the entire pipeline has been successful let’s take a look at the deploy job see exactly what has happened there and we take a look at the logs here we have used this aws cli image and of course we have printed here the version so we’ll see exactly which version we’re using i’ve used the tag so with that tag i’m gonna always get this version but sometimes if you don’t wanna specify a tag it’s still a good practice to lock the version in the logs just in case you know from one day to the next one or like one month later or something like that your pipeline doesn’t work anymore at least you can compare previous logs with existing ones and see if there’s any differences in the version that you have used for the various tools i’ll tell you right from the start that getting this upload to work will require a bit of learning and a bit of steps so we’re not gonna be able to do this right in this lecture and i get some errors just as a heads up but we’ll be making progress toward that goal so how do we upload the file so let’s continue editing this pipeline now as i said because you’re going to need a few tries and go ahead and disable the build website and the test website jobs and this will ensure that we are only running the deployed 2s3 job for the moment until we’re ready and we have tested that upload works i always like to make things as simple as possible and whenever i’m working with a new tool i want to make sure that i don’t make any mistakes or that i can easily understand what’s going on so for that reason i’m gonna leave aside this complexity with building and testing the website we’re gonna only focus on deploy 2s3 so we have here the aws version and then what you’re going to use here is aws this is the name of the cli tool then i’m going to specify the service name which is s3 and then on the service name we are gonna use copy right so we are copying something to s3 now what are we copying well for example let’s create a new file from scratch just to make sure that everything is working properly so how do we create a file i’m gonna use echo i’m gonna write here hello s3 i’m gonna put it inside let’s call this test.txt right so we are putting hello s3 inside this file so we now we have this file so we know exactly what we are uploading and the question is where are we uploading this where we’re uploading this to the bucket that we have created now for that reason we need to have the bucket name and if you still have your bucket open you’ll be able to see here the destination now this is my destination you will have a different bucket name of course i’m going to go ahead and simply paste this so it’s s3 column forward says forward slash the name of the bucket then we have to specify the name of the file so in this case i’m going to keep the same name it’s going to be test.txt so we are taking this file that we have created inside gitlab we are uploading it to this bucket and the name of the file will be the same in this case let’s give it a try and see how it works because we have disabled the build and the test stages essentially we now only have the deploy to s3 so this makes the entire pipeline execution much faster but let’s take a look why this failed so what we did we’re still printing the aws version and then the last command that we have executed is this one and i cannot stress how important it is to go through the locks and try to understand what has happened so it says here upload failed trying to upload this file to this location and it says the error essentially is unable to locate credentials the thing is how is aws cli supposed to know who we are i mean if this would work as it is right now we should be able to upload files to any bucket that belong to other people or to delete objects from buckets that belong to other people so we need to tell aws cli who we are and this is what we’re going to do in the upcoming lectures and in order to have the entire context in terms of this we have to go through a few stages of preparation existence right now there’s something about this pipeline that i don’t like and that is because we have something inside here that may change later on and i would really like to make this configurable and not to have this information inside here at the beginning of the course we looked at the defining variables and i’ve shown you how you can define some variables within the pipeline there’s also another place where you can define variables and for that i’m going to copy this value and i’m going to go inside the settings so from your project you can go to settings here on the right hand side and what

    you’re gonna do here is select ci cd and right here in the middle you will see variables i’m going to expand this so that we are able to add variables now typically here we tend to store passwords or secret keys but i’m going to use this bucket name as an example for some important features you need to know about so let’s go ahead here and click on add variable and i’m going to name my variable aws underscore s3 underscore bucket and the value will be exactly what i’ve copied from the pipeline now there are some additional settings here i want you to pay attention to there are two flags one of them is typically enabled by default and that is protect variable this flag alone is the single cause for a lot of confusion and a lot of wasted time for people who are just getting started with gitlab i just wanted to point this out if this flag is enabled this variable that we have defined here will only be available to protected branches so for example the main branch that is a protected branch that information will be available in our current branch i created here a feature branch for working with aws cli if i leave this flag on and try to use this variable there it will not work typically the idea here is let’s say you have two environments you have a test environment and you have a production environment you may have different credentials for each systems for securities reason now you typically want to keep the protected variables for the main master branch which deploys to production in this way you ensure that nobody has the credentials to accidentally deploy to production from a different branch so this is a security measure now we are using branches and we are using these services directly so at least at this stage we’re going to go ahead and disable this flag because we don’t want to protect this variable because it will not be available in our pipeline execution as we are running this on a branch the second flag is disabled by default this is something that will be masked in order to mask a variable this is particularly useful for password so for example if you accidentally try to print one of these variables in your code it will not appear there it will just appear like a must masked out with like simply stars it’s okay to have for example usernames or other things like this packet name we don’t need to mask this because it’s not really a secret but if we had here a password for a password it would make sense to mask this so for this variable i’m gonna disable the protect variable flag and i’m gonna disable the mask variable flag many people think that if you don’t have the protect variable flag the variable is somehow public or unprotected that’s not the case it’s simply available for all the branches inside a project and at this stage that’s totally fine i’m gonna change this a bit later on but at this point that is fine i’m gonna go ahead here and add the variable you will be able to see it here being added and of course if you need to make changes to it you can go ahead and make changes from here going back to the pipeline instead of having this value i’m going to start here with the dollar sign aws s3 bucket so the name has to be exactly as you have defined it and don’t forget to put the dollar sign in advance because this is what makes this a variable we can run this pipeline again and see how it looks like see if we notice any changes now if we’re looking at the logs we should be able to notice something interesting so what is interesting about this is the following we have the same command but now inside the command you notice this variable so when we’re writing the command the command that’s being locked here this doesn’t change it will still show you with the variable so it may seem that it’s not resolved but actually if you’re looking here at the error that we’re getting you will see here that the variable has been resolved an indication that the variable has not been resolved is for example not seeing this text at all so i invite you to play around with the protected flag and to run the pipeline again to see what’s happening and you should be able to see here that after s3 you’ll got you will get three forward slashes you will not be able to see your bucket name here so let’s go back to what we wanted to achieve to actually upload this file and we’re still getting this error unable to locate credentials so what should we do should we put our aws email and password somewhere in these variables so that aws can locate them well you’re getting pretty warm with that yes essentially we have to provide some credentials but those credentials won’t be our regular email and password because that will be highly insecure whenever we’re using a service we try to give limited access to that so in order to give this limited access to services in this case we only need s3 there is also a service that manages that so if we go back here to aws and search for services the service that we are interested in is iam or yum and this is essentially an identity manager service that aws offers let’s go inside it and see what we can do so first of all if you didn’t activate multi-factor authentication you’re going to get this warning and i definitely recommend that you do that this is just a testing account for me which will be very short-lived so for that reason i didn’t do that at this point now here from this service we can create new users essentially we want to create an user that will be able to connect to s3 so from the left hand side here let’s go to users and i’m gonna add a new user so we have to give here this user a username can be any user typically i’m using something so that i know why i created it so i’m going to call this gitlab i know exactly that this user is intended for gitlab and we have to select an access type now what we are interested in is also called programmatic access so we’re going to click this and you will see here that this enables an access key id and secret for aws api cli and so on so we’re interested in having this for aws cli so this is why we are creating this user and we are enabling this programmatic access we don’t need a password we don’t need this user to have access to the management console like we do so for that reason that’s sufficient let’s go to the next part which is the permissions so essentially the permissions tell what the user is allowed to do and permissions in aws i’m going to say it’s not an easy topic so i’m going to go the most straightforward way i’m going to attach an existing policy so i’m going to go here to attach existing policies in this search bar i’m going to select s3 i’m going to search for s3 you’re going to get some predefined policies so policy is essentially like a set of rules that we can apply to a user and the set of rules that we’re going to use here is amazon s3 full access so essentially we’re gonna give this user access to everything that is aws s3 so we should be able to create new buckets should be able to delete files and so on so a bit more than what we actually need for this use case but just to simplify things i’m gonna give this full access to the user but of course it’s the topic on its own let’s go to the next page we see the tags we don’t need to add any tags here and then we’ll be able to review what we’re trying to do and we can go ahead and create this user so now we have successfully created a new user and aws has created something for us and that is an access key id and a secret access key to put it in plain english this is like a username and a password you will see here that the password is not even displayed so what are we going to do with this information so first of all let’s go ahead and copy the access key id go inside gitlab again going to go to settings ci cd and expand here the variables and let’s go ahead and add a new variable i’m going to start here writing aws and you will see there already some predefined things that pop up so one of them is aws access key id this has to be written exactly as you see it here there’s something that’s different about this away cli will not be able to pick up this variable it will look exactly for this variable name and will automatically pick it up without us doing anything else so it has to be exactly as it is i’m going to paste here the value of course this is as per my account so you’ll have a different value and i’m gonna disable the protect variable flag because we want to be able to use this in a branch as well i’m gonna go ahead add this variable and going back to aws i’m gonna also show here the secret access key of course i’m gonna delete this right after recording but i’m showing you just to know exactly how it looks like it’s also important that you don’t add any spaces or anything like that so i’m going to copy this secret access key and go here add a variable and i’m going to start typing aws secret access key and i’ll paste the value here i’m gonna disable the protect variable flag and click on add variable finally there’s still another thing that we need to configure and that is our region so again i’m gonna add here variable start typing aws and we have here the default region so when we’re setting this variable all services that we use will be in this region and we don’t need to specify the region all the time aws know exactly where this bucket or any other service is located and we cannot simply write here anything we have to write exactly as aws uses it internally so what do i mean by that well let’s go back to the aws console and you will see here the s3 service and recently visited so this will make our life easier in terms of grabbing this information and for example for my bucket this is in us east north virginia what we’re actually interested in is this code so i’m going to copy this information and paste it here so this will be the default region and again i’m not going to protect this variable and i’m going to add it here what i forgot to do in terms of the secret access key is i haven’t masked it so it would be idea to go back to it click on this edit and you will see here this flag because this is essentially a password and i click here this flag to mask it and update it and then you also have here an overview like which one of them is protected which one of them is masked and of course if you need to inspect some of these variables you can go back and click on them and you will be able to see the value but list on this overview here they are hidden there’s also this possibility of copying the value without revealing this can be useful as well or you can click here on reveal values and they will be displayed all right so it seems that we have everything in place now at least we have these credentials and because we named them the way we named them aws cli will automatically pick them up so there’s actually nothing that we need to change in our pipeline so for that reason we can simply go ahead and rerun the same pipeline once again i’m going to go here to ci cd pipelines go here to the job that failed and here i can simply click on retry this will start the exact same job once again all right so this already looks so much better the job has succeeded we don’t see here any errors aws cli is telling us which files have been uploaded so we could jump into s3 and take a look inside our bucket to see if we have any files here you will be able to see here our test.txt file right inside here say when it was modified and so on we can download it if we need to but essentially this has been the first major step in terms of interacting with the aws cloud all right so we have made some progress and we have managed to finally upload this file but if you remember we have an entire website with a lot of files so you know going file by file and uploading that is not really the way to go so i can make sure that whatever we have inside the build folder it’s going to be synced to our packet now if you remember in the beginning i mentioned the documentation the reference for the aws cli essentially for any service there is here documentation there is here an additional command so we have used aws s3 as the name of the service so in this list of services here you will find s3 somewhere so here we go this is s3 so i’m going to click on it i’m going to be honest with you in the beginning this documentation will look very scary but if you take a bit of time if you have a bit of patience and you go through the documentation this is the way to really master the cli commands that you will be using and this doesn’t only apply to aws cli applied to any tools out there so reading the documentation looking at all the parameters everything that you can do with this is really super helpful so for s3 you will see here a lot of documentation but also at the end you will see here a list of available commands so we have used cp for copy so we’ve copied this file and it’s also definitely possible to copy an entire folder but i wanted to show you also different command which is sync now typically syncing something means that whatever we have on one side we have on the other side as well for example to ensure this with copy we first have to remove the folder just to ensure that we really have everything so for example if we added the file or we have removed the file we don’t want to have those files on s3 anymore if we don’t have them on our website anymore so for that reason using something like sync which ensures that all the files are in sync does make a lot of sense so we can go here on sync and we’ll tell right from the description it syncs directories and essentially it ensures that whatever we have there on one side is also available on the other side so how do we use this let me demystify this and take a look at our existing pipeline that we have here so first of all we’re going to give up on this test file that we have uploaded here this was just for testing purposes and to make sure that we have everything set up correctly so we’re gonna use here aws s3 so the command will be sync so what are we thinking we’re syncing the build folder so instead of that file we’re going to have an entire folder and the question is where are we syncing this we’re syncing this to the bucket so we’re going to remove this part here because we are going to put it directly inside the root and additionally we’re going to also add a flag so if you’re looking here through all the options that are available one of the options should be dash dash delete it will essentially ensure that if we delete some files during our build process which existed previously in previous builds that are also deleted during the sync so if i had a file in the build folder i synced it in the last build then i later removed that file i want that one removed from s3 as well so i’m gonna add here delete so this essentially should be enough to upload our build folder now in order to get this to run of course we have to re-enable our previous jobs so now build and test are enabled gonna commit these changes and see if this command worked and the pipeline is now successful and we’re most interested in this last job that we have executed and now if we’re looking at the logs we’ll see exactly which files we are uploading so we’ll see here uploading this uploading that so these are all the files that we have inside the build folder what’s also important to notice is you notice here this delete so this file is then deleted because it no longer exists in the build folder it actually never existed in the build folder but sync detects that this file doesn’t exist there and says okay if it doesn’t exist in the build folder it doesn’t make any sense to stay on s3 and goes ahead and removes it so let’s take a look at the s3 service i’m going to refresh this page and take a look to see how it looks like so now we are able to see all the files that we are actually interested in there all have been uploaded here and we made a very important step towards hosting our website in the aws cloud now currently the files that we have uploaded here they are not publicly available whenever we create a bucket by default it will be private to us so nobody else external has access to it actually that’s kind of like the normal use case you don’t want the files that you’re putting here to be available for everyone but of course there are use cases when you want to make these files accessible to anyone else and actually quite a lot of companies are using s34 storing files that they offer for download because it’s so much cheaper than hosting them on their own website now in order to make this bucket publicly accessible we need to change a few things and we’re going to start here with properties and actually what we are definitely interested in is enabling static web hosting so again i’m here in my bucket inside properties right at the end there’s static website hosting i’m gonna go ahead here click on edit and we’re going to enable static website hosting and the hosting type will be host a static website and there are also some settings here that we are gonna input websites typically have an index page which is a start page and also they have an error page for this application that we have the index page and the error page are the same and this is the index.html file if you look inside the bucket you should see the index.html file so this is exactly what we’re going to have here for the index and the error so i want to save these changes and we’re still under properties and if we go back here at the static hosting part you would see here that now we have an address so now our website is hosted on aws we could also get the domain and point this to this address but for what we’re trying to do right now this is board enough so we can go ahead and click on it and in the beginning we’re gonna get this error and there’s still a few things we need to configure don’t worry about it just wanted to point out the address and where you can view it so let’s see which other settings do we need to make i’m gonna go here to permissions and you will see here the first thing that appears is access bucket and objects not public whatever we have here in the bucket is not public so this is why even if we have enabled static website hosting we still cannot access this information so let’s take a look at how we can enable public access i’m going to click here on edit and i’m going to disable this block all public access and save the changes and again because this is like a major thing abs really wants to make sure that we know what we’re doing so i’m going to enter here confirm i’ve been going to the website we can try a refresh and it will still display the same error page here so there’s something that’s still not working properly what we need to do in addition to what we did here with in regards to the public access is a bucket policy now essentially we need a policy for the objects that are inside the bucket i want to get too much into the details but essentially we need to write this policy so we can go ahead here and click on edit this is like policy generator now what you see here is json and this is the format in which this policy will be written here there are a few things that we need to change about this policy so essentially we can go ahead here and add an action so let’s search for example for s3 i’m going to select hit here and the permission that we are looking for is essentially get object i’m going to click on this get object but additionally there are also a few other things that we need to change here just to make sure that everything is working properly and this changes will be made in text but you also find the template in the course notes just in case something doesn’t go well you will have the possibility of using that so essentially i’m gonna give here a name and i’m gonna call this public read this is just a name to identify this policy and the principle here we need to be put between double quotes and i’m going to put here this star and then the action will be get s3 object that’s allowed the effect is allow and resource we also need to specify the resource and the resource is our bucket i’m going to copy this name it’s essentially the address of the bucket and i’m gonna put this here also in quotes and i’m gonna add here very important a forward slash and this star which essentially means that everything that is in this bucket can be retrieved get object it is allowed so this is essentially our policy for public reading all right i agree it’s not so easy for beginners but let’s hope we haven’t made any errors here and that it will work as expected i’m gonna click here on save changes to apply this policy you will see here warnings all over the place you will see under the bucket in red publicly accessible access public so aws is really trying to tell you hey watch out uh if this is not what you intended or this is not what you want this bucket is publicly accessible so really really make sure that you know what you’re doing but for us it’s fine this is what we wanted to have and now by refreshing this page we’re getting the website that we have created and now congratulations really this is absolutely amazing we created pipeline that now takes every commit that we make and deploys it in the aws cloud we take it through all the stages but we only have to make the change and the entire process is automated so if you manage to follow along up to this point wow i’m sure that you have learned so much and trust me we’re just getting started there’s still so much more to learn and i’m super excited about the upcoming steps now let’s go back to the pipeline that we have designed now and i’m still here in an open merge request and if i’m looking at the pipeline i have here all the three stages so the build the test and the deploy now if you think about it this really doesn’t make a lot of sense and what doesn’t make sense is to deploy to s3 from a merge request or from a branch now if we think as s3 being our let’s say our production server or production environment then it means that anyone who opens a merge request and tries out some small changes if the build and the test pass this will automatically get deployed to production and actually this is not what we want we want inside a merge request or as long as we are in a branch we just want to run the build and test essentially to simulate the execution of the main branch and then only when we merge this we want to run the deploy so we want to deploy to production so in order to achieve this we still need to make a few changes to our pipeline now this is how the configuration looks like at this point and the changes that we need to make are here in the deploy to s3 job now how do we exclude this job from this pipeline which is running on the branch and to ensure that it only runs on the main branch gitlab has this feature which is called rules now rules allow you to create really complex conditions and i won’t get into those but we’re gonna use a relatively simple condition which will check if we are on the main branch or not now in order to set up rules we’re going to go to the deploy to s3 job and what i’m going to write here is rules this is a completely new keyword and here we can define a list of rules now we’re going to add only one rule and this will be a list so you notice that i’m starting a list and then we have here an if column and now after the if we can specify a condition so in a condition we’re typically checking if something equals or does not equal something else so in this case you want to check if the branch we’re currently at so we have here something i don’t know where we’re at equals so we’re gonna make two equal sign the main branch right so if we are on the main branch only then run this right now we don’t want to put here something hard-coded so we cannot know in advance like which is this branch name where we are currently evaluating this condition so in my case i mean feature deployed to s3 or something like that so it doesn’t make sense to add that there to to check this it needs to be dynamic so in order to have something dynamic we need to use some variables now luckily gitlab comes with some predefined variables and one of these variables is ci commit ref name so i’m going to search here for ref name you will see here so see i commit ref name this will give us dynamically the branch or tag name for which the project is built so we can use this as a variable and i’m going to write here dollar sign this one so this will be evaluated to our current branch now with any of these variables if you’re not sure what they do how they look like simply use here echo and just keep something like this for debugging purposes in your pipeline until you get familiar with the values that you’re having i’m going to remove it because i don’t need it but for you definitely recommend use echo to inspect the different values that you’re using if you were on a different branch this would be something else so if this equals main then we’re gonna essentially run this job otherwise it will be excluded from the pipeline still having something hard coded here is also not something that we like doing yes we could keep here main but there are also variables that can handle this so another variable that we can use is default branch it should be ci default branch and this variable will give us dynamically give us the name of the default branch so if later on for whatever reason we decide to switch from master to main or from main to something else then we don’t need to worry about these pipelines because the default branch will automatically get updated in this variable and then we can use it directly here so again i’ve added here another variable which is the ci default branch so now everything is dynamic so this rule makes sure that when the current branch equals the default branch this code gets executed in our case right now for maine will have this job in other pipelines this job will get excluded not be part of the pipeline so i’m going to commit this and i’m going to take a look at the pipelines after this so what i invite you to do is to go to cicd pipelines and now our pipeline only contains two stages so we have the build and the test stage the deploy job was completely removed i can also inspect the merge request and take a look at what is going on here and also i see that this pipeline has been updated it contains only build and test so at this point i would say okay i’m pretty confident that this functionality is working properly gonna click here on merge and also let the main pipeline run so again if we’re looking here cicd pipelines we will now see that the main pipeline has started so this is on the main branch and now this pipeline contains the three jobs required so we have build test and deploy so now the main pipeline is also working we have deployed again to s3 but how do we know if our website is still working again we could go to the address again hit the refresh button check again if it’s working but again that’s not really the point of automation we want to make sure that the entire process is automated so if this is a worry that we have like is the website still working that we have deployed it’s probably time to add another stage and to test after this deployment if everything works correctly on the website or at least as much as possible so let’s open up the ide and take a look here at adding another stage so we already have here build test deploy so probably the next stage should be let’s call it post deployment so this will be after the deployment and then it’s probably time to also add another job i’m going to call this production tests and i want to make sure that the stage is the right one let’s post deploy and what i’m proposing is to simply run a curl command so that’s pretty similar to what we did here so simply going to go ahead and copy this of course this has to be under the script block and there are a few things that we need first of all we need a docker image that has curl and one option would be to search again docker hub for such an image but essentially any docker image that has curl would be sufficient so i can go ahead here on docker hub and search for curl and what i’ve used in the past is curl images curl but probably also one of these verified content images is probably just as good so the address to this image is this one so this is what we need to do without docker pull so we have here image and paste remove this docker pull that’s the name of the image and because curl is such a generic tool don’t need to specify a specific version what we’re doing is pretty basic and i’m pretty sure it’s not going to change very soon the other thing is the address right so the address where we have deployed this and this is available in s3 so we’ve been going back in s3 to our bucket looking here at properties and right at the end this is the address right so can go ahead and copy my address go back to the editor i could paste it here right but again we had a discussion about like not having you know things that could change later on inside our pipeline or have it all over the place so again let’s go ahead and define a variable now this time i’m gonna define a variable within the pipeline itself that’s also totally fine and also way on how to do things i’m gonna define here variables block and let’s call this variable app base url of course you’re free to name it as you wish column and then i’m gonna paste here the address to it so this is now the full address so it’s all i need is this this is the variable name and here instead of writing something like this and simply go ahead use curl app base url i’m going to search for react tab because this is what we have actually in the body of the index html that are grabbing this should be enough at least to test that what we have on s3 is still reachable that at least this text is still available there additionally we need to make another configuration because otherwise as it is right now this will also run inside the branch so i’m going to copy this rule that we have here on deploy to s3 same rule is valid here we want to run these jobs only in the main pipeline so i’m going to go ahead commit these changes and merge them into the main branch and i’m a pretty confident that this pipeline will work without any issues so there’s no additional review that i need at this point i’m going to simply merge when the pipeline succeeds and i’m going to grab a coffee until this is merged so after a few minutes here in the merge request we’ll see a few things so first of all we have here the pipeline for our branch with two stages we have to build and the test that’s it after we have merged this then the pipeline for the main branch has started and this pipeline then has four stages build test deploy and post deploy so essentially the stage that we have added right now and this contains the production tests let’s take a look at them to see what has happened here so we have executed this command carl was able to download the website has passed this information to greb and grab a search for react app in the text and somewhere here was react app so for that reason everything worked out successfully so we know that website is still there it’s still working so that’s perfect so let’s take a minute and take a look at what we did so far so this is our main pipeline right this is the pipeline that now deploys to aws s3 and we have the build and the test this is what we essentially call continuous integration right this happens also in the merge request but also here we are rechecking that our build is still working and let those tests are executed here the second part this is the cd part in ci cd now cd can mean continuous deployment or continuous delivery i’m going to explain a second what that means right now we’re kind of doing continuous deployment in the sense that every commit that goes into the main branch will actually be deployed to production we have automated the deployment to s3 and we said that you know our s3 bucket it’s hosting our website and is essentially our production environment that the whole world can see now this is a very simplistic view on cicd now quite often pipelines also have a staging environment or a pre-production environment essentially if we make changes to our deployment to s3 and something doesn’t work anymore we’re not really testing this before and the main branch may still produce some errors and again we come back to the same problems we had when we did ci when nobody else can work on a project anymore so for that reason it kind of makes sense also to add another environment at least if the environment if there are some issues with the environment before production and the main pipeline breaks at least we haven’t affected the production environment so it’s still good right now we’re just deploying anything and we’re testing afterwards what is a staging environment so a staging environment is essentially a non-production usually non-public environment that is actually very close to the actual production environment right so we want to keep things as similar to the production environment as possible quite often we use automation to create these environments and to ensure that they’re really identical we haven’t done that we have used manual work to actually create the s3 bucket and we did some automation afterwards but ideally we would create this entire infrastructure automatically so the idea is to add a staging environment as a pre-production environment essentially we want to try out our deployment on pre-production before we go to production so in case it fails the production environment is unaffected the main two concepts i want you to be aware of is continuous deployment and continuous delivery now with continuous deployment as i said every commit that goes through the pipeline would also land on the production server in the production environment with continuous delivery we’re still using automation and every successful merge request again triggers the main pipeline which leads on automatic deployment to the staging environment however we don’t go directly to production there is like a button that you click in order to promote a build from the pre-production environment to the production environment so these are like the differences between continuous delivery and continuous deployment in upcoming lectures we’re gonna get a bit more into them and you’re gonna better understand like what they really mean now it’s time for you to practice a bit more and at this point i have an assignment for you and the assignment is essentially you building a staging environment and i want you to follow essentially the same process as we did when we created the production environment i also want you to make sure that you write some tests that ensure the environment is working as expected please pause the video and take this as an opportunity to practice along more both with aws and with building the pipeline i hope you had a good assignment and that everything is working properly in this video i wanted to show you how i would do something similar so first of all i’m going to start with creating the bucket and i’m just going to copy this name that i already have click here on create bucket and essentially i’m going to call this staging essentially the same name but i’m just adding staging to it and in the beginning i’m going to leave all settings as they are and in the upcoming steps i will essentially ensure that this bucket is public so they are the same steps as before and i’m not going to go again over them so after a few clicks i now also have this staging bucket also as public and i’ve enabled website hosting which means you can go inside the bucket you can go here to the properties and then right here at the bottom i will see this address which we will need later on first of all let’s begin with the name itself so i’m going to copy it and i’ll have to go inside gitlab and save it in a variable so here in gitlab i’m going to go to settings ci cd go here to variables what you’ll notice here is that we already have an s3 bucket of course that’s kind of an inconvenient at this point so we’ll need to figure out exactly how we can manage this what i’m going to go ahead and also call it aws s3 bucket i’m going to call it staging i’m going to add this thing that will make it different essentially now we can protect this variable because we don’t want to deploy from a branch anymore so it definitely makes sense to have this protected masking it doesn’t make any sense at this point all right so at least now i have this i’m gonna copy the name so that they don’t forget it and let’s go inside the project open the web ide and start making some changes to the pipeline now first of all because this is a pre-production environment we need to define another stage before we deploy to production let’s call this deploy staging and of course what we need to do here is to define a new job now most of this job is pretty similar to what we already have here in terms of deploy to s3 and also in terms of the production test that we have here so it kind of makes sense to copy everything that we have and paste it here again and let’s call this deploy to staging and we can call this deploy to production just to have like more clarity in terms of where we’re deploying and what we’re doing also we need to have the right stage so the stage name is deploy staging apart from this we are using the same image we still want to run this on the main branch and the only thing that we need to adapt here is the bucket so it’s going to be a little s3 bucket staging and again the test that we have here they can be called staging tests we’ll see here that you know the editor is complaining about the duplicate key so that’s a good thing because you know exactly what we need to fix so then we have the staging tests and also here where we need another base url so that’s also something that we need to consider i’m gonna add staging to this one as well and from aws i’m gonna copy the url paste it here you can notice that we have two different urls so let’s double check everything we have added a new stage deploy staging which is before deploy or we can even call it deploy production right so we have even more clarity just need to make sure that we are adopting this everywhere so we have here deploy staging and then we have deploy production but then we have post deploy now we also want to have this testing after the staging so we need something like test staging for example and we can call this test production right so we’re deploying to staging we’re testing the staging if both of them are successful then we go ahead and deploy to production and after that we test again the production so let’s make sure that we have the right stages otherwise we’re going to get some issues so deploy production yes test production test staging deploy staging we have the right bucket name here we don’t have the right url we need to grab that as well for staging all right and all of a sudden our pipeline got a bit bigger but no worries one last check deploy staging test staging deploy production test production deploy staging is the stage we’re using the staging bucket paging tests using the staging url test staging deploy production test production all right i’m going to go ahead commit these changes and we’ll see how they work in the main branch and a few minutes later after the main pipeline has also completed we’ll see now that we have here a bunch of stages so after the tests then we’re deploying to staging we’re testing staging deploying to production we’re also testing production of course we could go ahead and combine the staging so for example because our tests are very simple there’s nothing that prohibits us from just putting this simple test inside the deployed job itself so that will save us some stages here but i just want to demonstrate like how how longer pipeline essentially looks like and what’s the meaning of the stages so most importantly now if something happens with the deploy stage the pipeline breaks here production environment is unaffected we don’t have to worry about it so we have time to fix any problems in our deployment if you’re looking again at the pipeline well you know all the staging environment has really created a lot of duplication and all these variables with the bucket now we have ideal ss3 packet with staging we also have the space url and the staging url obviously we have now two environments but we haven’t really figured out a way on how to properly manage this environment luckily there is a functionality that gitlab offers for managing these environments going inside the project you will find here on the left hand side deployments and inside deployments there’s this optional environment what is an environment staging is an environment production is an environment wherever we’re deploying something that is an environment and it really makes sense to have these environments defined somewhere and to work with the concept of environment instead of fiddling around with so many variables that’s really not the best way on how to do that so what i’m going to do here i’m going to create a new environment and i’m going to call this environment production i’m also going to get the environment url from the pipeline so let’s remember this is the production url so let me get that and i’ll save it here and going back to environments i’m going to create a new environment and this will be staging again going back to the pipeline copying the name of the environment and putting it here what gitlab will also do is to keep track of deployments on different environments now currently we don’t have any deployments but we can directly open the environments from here so in case we forget where the our environments are we can easily click on this open environment link especially for non-technical people that are also working with gitlab it’s easier for them to see exactly where is the staging environment what’s the url i don’t have to ask someone it can just directly go to their respective environment and see that respective version so very very useful feature in terms of environments but what does it do for our pipeline well i’ll tell you what this will do we’re going to remove this from here right i’m going to go ahead first of all this is out i’m not using this anymore second of all i’m gonna go back to settings ci cd and expand here the variables and i’m gonna go here to this aws s3 bucket i’m gonna click here on edit and this is essentially our production environment this is for production and now we can also give a scope so we can tell gitlab hey this variable is associated with production and not with something else so we can essentially scope it and of course in this case because we’re using it in main only we’re gonna also protect this variable i’m gonna go ahead and update here and the same goes for this other variable right now we don’t need this staging added at the end we can just call it aws s3 bucket and we’re going to select here the staging environment scope and update the variable so now we have two variables that share the same name but now they belong to different environments now the idea is to do the following we need somehow to adapt our pipeline and let’s begin here by deploying to staging first of all we have this aws s3 bucket so i’m going to remove here staging from the end and additionally we need to tell gitlab hey this deployed to staging this is associated with the staging environment i’m going to say here environment staging there are still a few things i would like to change first of all the entire pipeline right now is too long we still have this staging test and production tests and because this is just one curl command we can just move it away from here i’m gonna remove this stage all together and all i want to do is to add it here on deploy to staging so essentially right after you have deployed we’re also using this curl command it’s pretty similar to what we’re also going to do on production but as you probably noticed already this app base url doesn’t exist anymore we have removed those variables and we need to find a way to get our environment url and luckily again gitlab to the rescue there is a variable i’m going to go ahead and search for environment and i’m going to have here the ci environment name environment slug environment url so this is what we’re interested in the environment url i’m gonna copy this and i’m gonna put it here in the curl command so i’m gonna send the curl command directly to the ci environment url same goes to the production deploy to production i’m gonna add it here so in this situation the production tests they also don’t make any sense so i’m gonna remove them and all these extra stages that we have here test production it’s not going to be needed test staging it’s not going to be needed so now we have a much more simpler pipeline but we’re still achieving the same thing most importantly we are using these environment we still have an error inside here but i just gonna commit these changes let the branch pipeline run merge these changes into the master we’re gonna take a look at the main pipeline to see which errors we still have there now if we’re looking at the main pipeline you will notice something interesting deploy staging has passed it’s working perfectly you will see here curl ci environment url it’s fetching the page it’s passing however if you’re looking here at deploy to production it’s all of the sudden complaining it’s saying here that aws is three bucket parameter validation failed invalid bucket name so what’s going on well the following thing has happened we somehow did not associate this with an environment or the environment is not correct so we need to go back and see why this job does not have access to this environment variable i’m going to go ahead here and take a look again at the configuration to make sure that the configuration itself of the job is correct what do we have here or we have deployed to production but as you can notice i haven’t defined an environment right so i have defined an environment for deploy to staging but i haven’t defined an environment for deploy to production by looking here at the variables you will see that this aws s3 bucket is now scoped only for production and because this job doesn’t say anything about production this environment is not exposed in the production job so to be able to solve this we also have to add here environment production i’m going to go ahead and copy this and the environment will be production and of course unfortunately this time we have to go again through all the stages the merge request and committing this in the main branch and just a few minutes later the entire pipeline will then succeed so we have deployed the staging we have deployed to production everything seems to be working fine we can take a look at the jobs to see what they’re doing and we’ll see here that everything worked out without any issues and of course we can also go here to deployments environments and here we are able to see the staging environment and the production environment and we can easily open them and we can see like what was deployed when was it deployed so it really keeps track here of the different environments and the deployments that took place so we see here on production there’s only one deployment in staging we have two deployments that we have committed so we’re essentially keeping track of what is going on on this environment you know what i’m still not super happy with this pipeline i mean generally when i see that a lot of things are repeating but it kind of makes me wonder if there’s not a better way so if looking here at the deployed staging and we’re looking at deeply production well essentially at this point because we have used all these variables these jobs are almost identical the only thing that is different is the different stage different job name and we’re specifying the environment but the rest of the configuration is identical and yes the answer is yes we can simplify this even more so essentially we can reuse some job configurations so i can go ahead here and i’m going to copy this and i’m going to go here and i’m going to define essentially a new job i’m just going to call it deploy this will be a special kind of job it will be a job that has a dot in front of it and as you remember we have used the dot notation to disable jobs by having this we can essentially have a configuration here we don’t care about the stage right we don’t care about the environment so this is something that is not in common with the rest it doesn’t even have to be a valid job configuration we have just put here the parts that are really important for us and then in these other jobs we’re going to keep what we need so what we need we need a stage and we need the environment and of course we need the job name and this other part here we can simply write something like extends so this will be the extents keyword and what are we extending we are extending dot deploy that dot in front is very important so don’t miss it and the same goes for deploy to production let me remove everything i’m just going to keep here the extents and make sure it’s properly indented so deploy to staging deploy to production we now have two simple jobs here essentially the deployment part is the same this also gives us peace of mind because if we’re making changes to the deployment part we’re only making changes here so if we make a mistake there the chances are we’re going to be able to catch it before it goes to production let’s commit this give it a try see how it works and it should essentially work the same as before and after a few minutes if we take a look at the main pipeline we’ll see that it works as it should work it looks as before and this is exactly what we expected we didn’t want to see anything else but the pipeline working but now we have a much simpler pipeline configuration and now feel it is time for another assignment now let me tell you my idea now we have this pipeline and we’re testing with the curl command that that specific text is on the website and that’s fine it ensures that the website is still working we currently we haven’t really made any changes to the website itself we haven’t added any text or removed anything how can we make sure that you know with what we actually built here actually lands on the staging and in the production environment and it’s not somehow a cache or something old there maybe you know maybe the deployment is not even working and you’re getting the older version and we think that everything is fine so here’s my idea what if we add another file in our build let’s call it version.html for example and inside there we put a build number something that is all the time different with each build so for example it will increment from one two three four and so on so that with every build we can identify to build number and we can check which version has been deployed to staging and production how about this idea and in order to get you started i’m going to show you how to get this information inside there how to get this build information this dynamic part maybe this is something that right now you don’t know exactly how to do it so no worries i’m going to get you started but the rest of the assignment will have to figure it out on your own trust me you already know all the concept needed in order to implement something very simple so i’m going to go ahead here and define a variable and i’m going to call this variable app underscore version so essentially let’s say that this is our application version so want to have something like 12 13 14 and so on now again when we’re thinking about something dynamic we have to think back to the list of predefined variables that gitlab offers right so on this list there are various variables that we can use including something that is related to the pipeline id so if we’re looking for pipeline underscore id find here some pipeline ids that we can use so these are variables that of course change all the time they are injected by gitlab so we can use them in our jobs so we can get here like an instance level id this typically includes like very large numbers because there are a lot of pipelines on a gitlab instance but you can also get like a project level id so this will be something we can easily relate to it’s and we’re going to see it increment all the time so i’m going to get this variable and i’m going to use it here so i’m redefining this because i want to give it a bit of meaning i could have used this directly somewhere this is really your solution but if i’m using here app version i’m very clear that this is the application version that we’re using here not just some random id so that’s it i’m gonna let you do the rest of the assignment so just to recap here somewhere in the build add a new file which is called version.html add that new file put this app version inside that file and then when we’re testing our deployments including staging and production so here create a new curl command that will check that that application version is actually available on that environment okay so i hope that you have managed to solve this on your own i already feel i gave you like quite a lot of hints but just to make sure this is how i would solve it so let’s go here to the build website apart from all these things that we’re doing here what i want to do additionally is to create this file so again in order to create this file we have to first think about the name so it’s going to be inside the build folder right this is this is what we’re deploying and the name will be version.html and what we’re doing is we’re taking this application version so in order to get the application version inside the file gonna use echo i’m gonna print the application version and then eventually again redirect it to the file so this is enough to create this file to put it inside the build folder which already exists build yarn build has created that and because this is dynamic it will be available there the next step is part of the deploy template so i’m working directly in the template here so we can essentially duplicate this command we’re going to the environment url and we hope that we don’t have a forward slash already gonna check that quickly i’m gonna go here to deployments environments i’m gonna go to staging click on edit i’m noticing here i don’t have a forward slash so that’s already good and i presume that the production environment is also similar but just to check i did i don’t have a forward slash okay so inside our configuration i’m gonna add here forward slash i’m gonna write here version and what are we looking for well we’re looking for the application version and because the application version is simple number we don’t need these quotes here so we can just write grep app version and that should work so already as part of the merge request as soon as the build has completed i want to go inside this build website and i’m going to take a look here at the artifacts to see if this artifact contains this version.html file so i’m able to see it here version.html it has a size that is not zero that’s a good thing and we can also download all the artifacts or just look at a single file so after clicking on this somewhere here on the screen it will open up this web page essentially so this is the build number 35. it’s pretty small but you should be able to see it on screen as well so this is part of the file so it’s already looking good when this much request is completed i will also take a look in the main branch now the main pipeline is also working makes me very happy because i now have more confidence in what is going on in this pipeline i have confidence that if i’m making a change that change actually gets deployed to staging and production and we have this additional check then in place to ensure that all right so let’s recap a bit what we did the first part is the ci part continuous integration the second part is cd continuous deployment now we have a more realistic continuous deployment pipeline we’re testing something and then we’re first deploying to staging making sure that on staging everything works and after that we deploy to production but what is a continuous delivery pipeline this is exactly what i wanted to show you essentially a continuous delivery pipeline is just a pipeline where we don’t automatically deploy to production essentially what we want to do is add here a button and only when we are sure that we really want to make that change to production we can click on that button and make that change so let me show you how to do this i assure you it’s super super easy so inside the pipeline configuration the job that is affected by this change is deploy to production so here on deploy to production i’m gonna add a condition and the condition is when and we’re gonna write here manually it’s actually when manual not manually so this will tell gitlab that we only want to run this job manually so we need some manual intervention gonna commit these changes and we’re gonna take a look at the final pipeline now this is the final pipeline and i want you to notice something for deploy production this job now looks a bit different right if you look at deploy staging click here on deploy production we’ll say here this is a manual action and we have here an additional button right if we also go to our deployments and we take a look at environments we’ll be able to see here like what we have on each environment so you’ll see here if we’re going here on staging this is the staging environment and of course here inside the staging environment we can go ahead and write here version.html so we’re getting here on the staging environment for version 40 right so this is the version on the staging environment and if we’re opening up to production environment it looks absolutely the same but if we look at a version.html you’ll see that this is a different version right on staging and on production we now have different versions because our pipeline has not deployed to production yet so in order to deploy to production we have to click this button and only then will the deploy to production job start so this is essentially the difference between a continuous deployment and a continuous delivery pipeline what we have here is a continuous delivery pipeline we’re continuously building packages of software we’re deploying them to staging but we’re not automatically deploying to production without that manual intervention for some organizations this is mandatory and this is why i’m also showing you in some legacy systems you cannot always deploy everything without checking a few things in advance now if we’re looking here deploy to production has also completed so we can take a look here if i’m gonna refresh this website i’m gonna get here version 40. and here on the staging also version 40. so now both staging and production have the same version now i hope that the difference between continuous delivery what we did right now and continuous deployment where every commit that lands in the master branch gets deployed to production makes more sense now hey how are things going are you like the course so far you’re following along let me know by leaving a comment in the section below or by sending me a message on twitter or linkedin or on any social platform you can find me i’d love to hear from you and to know how are you using this course we are at the end of this unit so i’m gonna grab a coffee and i will see you in a bit [Music] so far we have worked with a static website and deployed it to aws it’s probably one of the easiest scenarios involving gitlab ci and aws however modern applications tend to be more complex and most of them use docker nowadays so in this section we’ll dockerize our website and instead of copying some files to aws we’ll be deploying an application that runs in a docker container to do that we’ll build a docker image as part of the build process store it in the gitlab container registry and deploy to a service on aws called elastic beanstalk so if you’re eager to learn more let’s jump right into it when we use a cloud provider like aws we can rent virtual machines that have a dedicated cpu memory and disk storage and we can use any operating system we desire but this also means that we are in charge of managing that machine we need to ensure that it’s secure and that all software running is updated this is often too much overhead especially for some types of applications but there is a way to take away this complexity and focus only on the application we want to deploy aws elastic beanstalk is a service that allows us to deploy an application in the aws cloud without us having to worry about the actual virtual server that runs it this is a great way to reduce complexity and it’s probably one of the easiest way to deploy an application in the aws cloud by default elastic bin stock can run python java node.js php and many other types of applications but it can also run docker containers which really gives us a lot of flexibility we’ll be running a web server application that serves our simple website files so this time instead of just uploading some files to aws we are providing the entire application which is self-contained in a docker container i’m sure you’ll be amazed by how easy it is to run an application here in the background we will be using a virtual machine but we don’t need to worry about managing it however at this point i need to warn you about potential costs while running these servers for a few hours or days will most likely be free or cost you only cents if you let the service run for a month you may get some unexpected charges on your card even if you are not actively using a service once you have created it it uses resources in the cloud so stop any services if you are no longer using them find a way to set a reminder so that you don’t forget about them with that being said let’s start using elastic bean stock so let’s go ahead and create an elastic beanstalk application so i’m here in the aws console and the first step would be to search for elastic bean stock so i’m going to write here eb and you will see here one of the results is elastic bean stock so since i have no applications here i’m getting this getting started guide so i’m going to click here on create application so let’s call this application my website you don’t need to include any application tags and here on the platform there are different platforms that are supported but what you’re actually interested in is in the docker platform so that we can essentially deploy anything we want i’m going to select here docker i’m going to leave the defaults as they are and the first step would be to start with a sample application so we’re not going to upload any code we’re going to let elastic beanstalk create this instance this application and after that we’re

    gonna add our own application on top of that so i’m gonna click here on create application and it will typically take a few minutes to get this to run and in the end you should see something that looks like this so what has happened here well we have created an application and we have initialized a sample application that elastic bean stock provides in order to actually run that application this wizard that we have used is set up has also created an environment so we have applications which is like an umbrella for environment so if i’m looking here at environments you’ll be able to see here that we have an environment that is called my website dash nf it belongs to the application my website and then you get some information in regards to when this was created under which url is this available which platform is this using and so on in order to see like what this environment is doing we’re gonna click here on it you’ll be able to see here a link so if you click on this link this is the sample application that was deployed so it’s just an idea tells you that everything is working properly that we have nothing to worry about this entire setup has worked without any issues now the question is what has actually happened in the background in order to understand that we’re going to go here to the services and we’re going to take a look at ec and right here ec and that is ec2 the service that we’re actually interested in this stands for elastic compute these are essentially virtual servers that we can create here but we haven’t actually created one but if you’re looking here at instances you’ll see that we have one running instance and this instance is called my website dash and you’ll see here which kind of an instance this is this is a virtual server that’s running here and this is the server that’s actually running our application additionally if you’re going here to s3 we’ll be able to see that we now have an additional bucket so we still have our buckets that we have used for hosting the website but now elastic bin stock has also created a bucket so actually what elastic beanstalk has done has created this required infrastructure in order to run the application we didn’t have to worry about creating that but this is why it took a few minutes to create this entire thing now let’s go ahead and try to understand how we can deploy something on your own like how can we get our own application to work and because we’re using docker we need to provide a manifest file essentially a file that describes the application that we’re trying to deploy so i’m here inside the project again and if you go into the templates you’ll find here a file called docker1.aws.public.json and this is the manifest file that i’m talking about it essentially tells aws which container we want to run because we have selected a docker platform we can only run docker containers there and this is a public container the name of the image is nginx which is a web server but what we want to try here is to actually use this configuration to use this file and to deploy this application to aws to make sure that this deployment process is working and this is again something that we’ll do manually at this point just to make sure that everything works properly so go ahead and download this file and after that let’s go back to aws and open up elastic bean stock here inside the environment will have the opportunity to upload a new version of the application you will see here right in the middle running version this is the sample application then we have this option upload and deploy and we want to upload that json file so i’m going to go ahead and select the file and i can also write here a version label this will be sample application version one that’s totally fine and i’m going to go ahead and click on deploy and what will happen is elastic beam stock will take this file and then we’ll start a deployment we’ll start here updating the environment of course this will take a few minutes but in the end what we want to see here is health status okay wanna see that everything is working properly and want to see that this application has been deployed and is available at this address and now we’re seeing here status is okay so health is okay everything seems to be working properly you can also go ahead and refresh this page just to see here which version is running you will see here that the running version is sample application one so this is exactly what we have deployed we can open up this address and we’ll see here welcome to nginx so this is the welcome page from the nginx server which we have deployed by having this json file which describes which container we want to use with elastic bean stock so in order to actually deploy our website we need to create a docker image we need to provide this json file and of course we also want to automate everything so this is what we are gonna do in the upcoming lectures so how do we create a docker image with our website a docker image is created by following a set of instructions something like a recipe we store these instructions in a file called docker file so let’s go ahead and create one so here from the web ide i’m gonna go ahead and create a new file and you will see here in the suggestions one of the suggestions is docker file so which are these instructions that will write inside the docker file first of all we have to start with a base image essentially an image that we want to add something on top of it in our case because we want to deploy web server with our files we’re going to start with the engine x image it is exactly the same image we have used in order to test our deployment to elastic bean stock so i’m gonna write here from nginx and additionally what i highly recommend is writing a version so writing a specific tag so in order to know which tag to choose i’m gonna go to docker hub i’m gonna search here for nginx i’m gonna take here the verified content so this is the official image for nginx i’m gonna take a look here at the tags and let’s search for alpine because alpine generally provides us with a very small docker image so what i’m searching here for is a specific tag so this here would be a very good tag to use just as an example i’m going to go ahead and copy that and here in the editor column and the version so you have to be very careful how you’re writing this has to be something like this so we’re starting from this base image so we have everything that is in the base image we have there so we already have the application essentially the application is the web server now the next step is to actually add our files which are in the build folder and to put them on this web server and we do that by using the copy command and right here copy so what are we copying we’re copying the build folder then we have to specify where we are copying it now by default there is a folder where nginx will store files that we want to serve and that folder has the following path forward slash user usair share nginx and then html so we’re moving this folder inside html folder so this is everything that we need to do in order to build our docker image these are the only instructions that we need at this point we’re getting this base image nginx in a specific version because we’re using this tag and then the next instruction is copy everything that is in the build folder and move them to this html folder just because we have created this docker file doesn’t mean that something will automatically happen we still need to make some changes to our pipeline and because we’re already making changes and because we want to deploy to elastic bean stock we don’t really need this s3 deployment anymore so i’m going to remove essentially all the jobs that are related to s3 this includes deploy to production deploy to staging this deploy job which is just a template and also test website we’re going to introduce a better way of testing so i’m going to remove all of them and what remains is the build website and of course also the stages here they can be removed so what we’re gonna do is we’re gonna introduce a new stage let’s call it package and we’re gonna associate this stage with a new job gonna call it build docker image and now the stage will be packaged so how do we build the docker image well it’s relatively simple the command is docker build i’m going to also add a dot here because that’s going to make a reference to the current folder and the current folder contains the docker file that we have created in order to be able to run this docker command we also have to define the image that we’ll use and the image will be docker just using this docker image will not work we’re gonna get an error the reason for that is the docker architecture is composed of a client and a server essentially what we have here docker this is the client and the client sends some instructions to a server actually to the docker demon which is the one who builds the job and in order to get access to a daemon inside gitlab ci we need to use a concept and that concept is of services we want to define here a tag services and this contains a list of services that we can start and what we’re starting here is actually service called docker in docker you’re going to see me using here this docker in docker tag so this service is another docker image that can build docker images cannot be accessible for us over a network and docker here which is the docker client will be able to talk with the docker daemon which is here inside this service i know that now at the beginning this may seem all bit confusing but this is like the minimum what we need in order to be able to build docker images from gitlab what i also like to do is to set some tags so i’m going to go ahead and write a fixed stack for docker and for docker in docker so i’m here at docker hub and this is the docker image you will find the link in the course notes because this is something that’s not so easy to find actually not so many people are actually looking for docker and i’m gonna use this version here i’m gonna go ahead and copy it and i’m gonna add it here to my job image and additionally there’s another tag with docker in docker this is the tag that i’m gonna use for the docker daemon i’m gonna remove here dent and this will be the docker in docker image you’ll see both of them have the same version additionally when we’re building images we also like to specify tags like label this will help us identify the images that we create because we can create multiple images of course in order to tag images we first have to specify an image name and also the tag so we can use here dash d you’re gonna keep here this dot at the end that’s very important don’t forget it and what we’ll use here is this is the list of environment variables and one of these environment variables is this ci registry image so we’re going to use here ci registry image don’t forget to put a dollar in front of it this will build the latest tag so this is a tag that always points to the latest image that we have created and additionally i’m going to create another tag which still contains cr register image i’m going to add here a dollar in front to make it a variable i’m going to add here column and we’re going to use the app version that we are still having here in our job so we are creating two tags so don’t forget the dot at the end this is super important this is one tag that we are creating and this is the second tag that we are creating and this variables will ensure that we have the right name for our docker image additionally in order to make sure that we have indeed built this docker images we’re going to use here docker image and ls actually we are building only one image but we are tagging that image with two different tags the latest and the app version so this will show us all the images that are available with all the tags that are available in this instance i’m not gonna run this job only on the main branch i’m just gonna run it inside the branch i’m still here in the branch playing around so we’re gonna see how this looks like after we execute it and once the execution is done we’re gonna jump directly into the build docker image and try to understand what has happened here so we’ll see where there are a bunch of locks that have been generated but most importantly what we want to see here is which docker image are we using so we’ll see here this is the docker image which is darker and then we’re also this is new we’re starting this service with docker in docker so the service will be available over the network inside this image that we have right now this will give us the docker client and there are a lot of locks here and they’re not really so relevant the interesting part comes when we’re actually building the image and you’ll be able to see here this is our command there are some steps how these docker images are being built docker works with concept of layers but we won’t go into that but this is exactly what’s happening here is every essentially every command that we’re executing will create an additional layer on that image we have successfully built this so this is what you want to see it has been successfully built and then we have also the two tags that we have created you will see here the latest tag and this is also the version tag now they both point to the same image but they are different text and you will better see it here with this command that is listing images so this is here the essentially the name of the image we’ll see here the tag and you will see that internally the image id is the same so we have the same image but with two different tags so now we have successfully managed to build and tag our image as you might have guessed the docker image that we have just built has been lost as soon as the job finished the docker image that we have created is not a regular file or an archive that we can just declare as an artifact and upload it to s3 when we want to preserve a docker image in this case this docker image that we have created here we need to save it in a registry for example docker hub which we’ve been using to find out tags and images that we can use is a public registry with docker images however typically our projects are not public so it doesn’t really make sense to use docker hub so for that reason we need a private registry both aws and gitlab offer private docker registries and for this example we’ll be using the docker registry offered by gitlab and you’ll see here on the left hand side packages and registry and we’re going to use here the container registry because docker is all about working with containers and of course at this point there are no container images stored for this project so alone just building that ochre image does not automatically add it to the container registry actually this is called pushing so when we want to save a docker image in a registry we need to push it to the registry so let’s go back and make some changes to our pipeline so let’s take a look how do we push so the command in order to push something is docker push and we actually want to push all tags so we’re going to use here parameter dash dash all dash tags and then we’re going to specify here the ci registry image so this is in term of pushing but where are we pushing and especially if it’s a private registry don’t we need to log in somehow yes that’s correct so alone pushing this will not work in our case we need to do something before we push and we’re going to do it right here in the beginning because in case there are some issues which the login we want to know as soon as possible and not only at the end so the command to login is docker login relatively easy and we’re going to specify username and password for this service we’re not actually using our username and password that we used to log into gitlab we’ll use some variables again that will give us some temporary user and passwords don’t really care so much about that but essentially this is what we’re to do so if you’re looking here at the variables that are available we’ll find here ci registry see a registry user say a registry password first of all where do we want to log in this is the cia registry so we need to specify where do we want to log in and additionally we need to specify our username and password so we typically specify the username and password like dash u and then specify the username and we’re gonna use another variable ci registry user with the dollar sign in front of it that’s very important and additionally we can specify password p and we’ll see here ci registry password so these are all the credentials that we need in order to log in in more recent versions of docker just specifying your password like this is not really the best way to log in you may get a warning and it’s possible that in future releases this argument this dashb will not be available anymore so what i like to do is the following i’m gonna remove it from here just gonna copy this variable and actually what we can do here is we can say to docker login get the password from the standard input and i’ll explain a second what the standard input is you wanna write here dash dash password dash std in this is the standard input so the standard input is essentially something that we are piping from another command and that other command in our case will be echo so we’re going to echo this ci registry password but we’re not going to display it in the logs we’re going to use this pipe so this will be available in the standard input for the docker login and docker login will look at that standard input and we’ll see oh okay the password is coming from there so we’re going to grab it from there using it in this way will ensure that this password doesn’t get exposed but really for ci in our case it will not get exposed anyway but it’s any good to know and this is why we have this construct here so once again we are echoing this password and we’re sending it to docker and docker login will know that this password is coming from the standard input and apart from that we have the parameter with the user for docker login where are we logging in to the registry make sure that all the variables that you are using here have a dollar sign before them otherwise they will not be resolved as variables so let’s give this a try as well and see if our image lands up in the registry the build docker image job has been successful we can take a look at the logs to see exactly which tags we have pushed and you will see here this are the tags that are available so we had tag 46 and latest and this is pushing the tags to the registry so no errors here and what we can do next is to go here inside the registry inside the container registry and we’ll see here this root image and if we take a look at it we’ll see currently we have two tags we have tag 46 and the latest tag will also tell us the size of our image because we are using alpine as a base image also our images are relatively small so that’s definitely a good thing so now we have successfully built this container but how do we know that application is actually working how do we know if nginx is serving our files if we have the right files and if everything is working as we think is working before we actually move on to the next step which is deploying to aws so for that reason it does make sense to do some accepting testing on the docker container itself just to make sure that we have everything as we expect so with that being said let’s go ahead and add another stage i’m going to call this stage test and of course we’ll also have to add another job let’s call this job test docker image i’m going to assign the stage test and let’s think about like how we can test this essentially the way we’re testing this docker image is not much different than the way we have tested for example a deployment or any other things in the past we can still use curl to do that so for example i’m going to write here curl we need here an address http column forward slash forward slash we don’t know the address but then again we can use grep to search for example for the app version right and of course we can also search for anything in the page that a website has but say for example here we’re going to check the version that html that we have so just want to make sure that we have the right app version and remove one of the dollar signs here so what do we need okay we need curl so we need a simple image that has curl so we’re going to use curl images slash forward slash curl so that should be enough to get this but the question is how do we start this container right this is where the part that we have learned before can be very useful and that part is services so again we’re going to take advantage of the services to start the docker container that we have just so we’re gonna write here services and this time that we’ll do is in this list we’re gonna define the name this will be the name of the image and the name of the image is of course dollar sign ci registry image and the tag will be the app version we don’t want to use the latest i want to go exactly like what is a current tag that we want to see so this will help us start the image and additionally what we can do is to specify an alias an alias allows us to give a friendly name so that we know where this service is available over the network so i’m just going to give the alias of website and here in http the address that gonna use is simply website so http column forward slash forward slash website gitlab will take care of starting this docker container registering it in the network as website and then we can simply call it in our curl script with website gonna go to version.html and inside we’re gonna search for the app version so let’s give it a try and see how it works and the confirmation that indeed our docker image is working properly can be obtained from this test docker image job so in this case indeed we have checked that the docker image is starting an http server and that the files that we have uploaded in our case this version.html it is available there and it contains the application version that we expected so with that being said in this case we now know that we have a docker image that works and we can deploy it to aws if you remember the first time that we have deployed an application to elastic bean stock we have used this json file which described which docker image we want to deploy in order to automate this process we kind of have to do the same thing in other words to give elastic bin stock this file now whenever we’re interacting with aws services we need to provide some files most of the time we need to do that through s3 so we first need to upload those files to s3 and all other services can read from s3 and have that information so in order to automate this we need to generate essentially this json file upload it to s3 and from there we’ll tell elastic bin stock to start a new deployment so going back to the pipeline what we need to do is to re-enable the deploy stage and the deploy to production job this time focusing on deploying to elastic pinstock so let’s go ahead and add a new stage deploy and of course also a new job here deployed to production since we’ll be using aws cli i’m just gonna add the basic structure that we need to this job in order to be able to use aws cli so using aws cli as a docker image we’re overriding the entry point this job is part of the deploy stage we have set the environment to production and we are starting our script now if looking at the files here we’ll see here in templates that we have this docker run that aws the name of the file is not that important the format of the file is very important because this file tells aws elastic binstock what we are trying to deploy and it will say here that this is our image and this is our tag so we have them here as variables but additionally because this is a private registry we also need to provide some authentication information and that authentication information is another file so that file is this oauth file and in this auth file we will need to add a token that gives access to the registry and essentially what we need to upload to s3 is this file docker run and this auth file which is actually linked from here it’s mentioned here of that json so let’s go to the pipeline and quickly add these files i’m going to simply paste here the configuration required so now i’ve added this copy configuration to the script so we’re still using aws s3 copy it’s pretty similar to what we did before in terms of copying files to aws s3 so i’m going to skip a bit this part now as you may have noticed these files contain some variables and those variables won’t get automatically replaced so if we upload the files as they are they will not get replaced second of all we don’t even have the right paths here they are in templates and not in the current folder where we’re executing the script just as a second thing but i wanted to show you something very important and that is how to do environment variable substitution in files and for that we’re going to use a very cool command it is env so from environment subs so relatively easy to tell what this does it replaces environment variables then we need to specify like what is the input file and we do it with this smaller than sign essentially and then we’re gonna go here and say something like templates and give here the name of the file and then we will have to specify the output file that will be generated and the output file will be this one so the name of the file will stay the same the location will change it will be put in the current folder and this is perfect for the next command that we’ll be using we’re doing this environment substitution replacing all the variables here for the auth file just as well so i’m just gonna replace that there and there so any environment variables that are in these files will get replaced in order to use this command we need to install an utility which is called get text now this doesn’t come directly in this amazon image so this is something that we need to install additionally i’m going to use this package manager to install this dependency which is called get text and get text has this tool for environment substitution gonna also add this flag here this will essentially answer with yes any questions that this installer may ask because we are in a way that we cannot interact with an installer we’re gonna specify this and say okay just install it if there are any questions answer with yes just to ensure that the installation process works without any issues now we have this so we can do environment substitution of course it’s going to be very nice to actually take a look at these files so we’re going to use here cat just to make sure that these environments were substituted as we expect them and as a final check we should also go in these files and make sure that we have all variables here so see a registry image app version this is something that we already defined so we have this information here aws s3 bucket this is relevant for where we are uploading these files now because we are using elastic bean stock an elastic beanstalk has already created an s3 bucket well maybe we should use that one so i’m gonna switch here to the s3 service and what i’m going to do is i’m going to copy this name could have used this other package that we have created here but i don’t want to put anything any credentials in a public folder so with that being said i prefer to use this bucket that is not public and here in the environment variables of the job we still have this aws s3 bucket for production so i’m gonna click here to edit it i’m to change here the value i’m not going to protect this variable because i’m still in a branch and i’m going to update this so at least at this point we have everything let’s see this other file the off file you’ll see here in the auth file there is this deploy token now what is the thing well we have pushed our docker image in the gitlab repository but aws has no credentials to connect to it and again we’re not providing username and passwords not our account username and password we will generate a token and gitlab allows us to generate a deploy token that can be used by aws to log into our private docker container repository and pull that image so now to do that from settings we’re going to go here to repository and we’ll see here deploy tokens as one of the options and here we can create a deployed token so we’re gonna name it aws so that we know why we have created it and i give the username aws and the permissions that we need is read repository and read registry i’m going to go ahead create this deploy token this will be created here this is essentially like a password but it will only be displayed once so i’m going to go ahead and copy this and i’m going to create a new variable to store it i’m going to call this variable gitlab deploy token and format how we’ll store this information is i’m going to write here the username aws column and then the password that i’ve just copied i’m not going to protect this variable but i can just as well mask it just to be sure now here inside the pipeline we still need to do a small change to the pipeline itself to the script itself and the thing is we need to convert this username and password to base64 because this is what we need inside this configuration json this is what aws expects and in order to convert something to base64 it’s relatively easy so for example say you have here a string right hello you can convert it to base 64 by simply piping this and writing here base 64. this will output the string encoded as base 64. now of course we don’t want to have anything hard coded here this is why we have defined this variable so we are going to use here gitlab deploy token right and additionally we want to make sure that we don’t have any new lines or anything like that in our token so we’re going to pipe them again to another command and this command will remove any new lines that exist here so so this n here with the backslash this will be a space essentially so if there are any spaces they will be removed additionally we need to set this into a new variable that we can replace so i’m gonna put here a dollar sign at the beginning i’m going to put this between parentheses and what i’m going to do here i’m going to export so this is a way to create an environment variable but from a script and the name will be deploy token right and equals this expression so what we have here this part is an expression this will be evaluated and whatever output comes from this it will be stored in this deploy token and this deploy token is exactly what we have here in our pipeline so before we commit these changes we only are interested in making sure that this job works well so what i’m gonna do is i’m gonna simply disable all the previous jobs i’m gonna put a dot before them so that they don’t run and after that i’m gonna commit this pipeline and let’s see it in action and it seems that i’m in luck no errors while running this job let’s take a look at the logs to see if we have everything and indeed it seems here that something is missing right some information has been replaced the image is replaced here i have the version i have here the bucket that’s definitely working fine here in the odds the registry is correct but if i’m looking at all that’s information it is missing so let’s try and debug and to understand why is this information missing there so here’s the pipeline let’s double check if we have everything correct if we have used the right variables so gitlab deploy token that should be the name of the variable that we have already find in gitlab as a variable so that seems to be fine deploy token is exactly that what we have used in the file we can double check again the file you see here it’s exactly deploy token so that seems to be working well so what is going on let’s take a look again at the pipeline to see if there are any clues why this may have failed you know again here we don’t see it but let’s take a look at the commands that we have executed to see if there’s anything suspicious in there so what did we do well first of all we have just started the script here we have aws cli great we are installing here get text so that seems to be working don’t see any errors up to this point and then we’re exporting this variable right we’re running this command this expression and then if we’re looking here at line 77 we’re seeing here td command not found so apparently this expression that we have placed here gets evaluated into this variable but when it fails it doesn’t feel the job i’m going to open up here the pipeline and let’s take a look at the deploy to production so this is the td command that we have used it should actually be tr which stands for translate now this was just a silly mistake but it just goes to show how important it is to actually read the logs to understand what’s going on now we have both files all the variables have been replaced including this time in the auth file and we can also jump into s3 and take a look at this bucket here we’ll be able to see here the docker run file and the auth file they are now inside s3 docker run tells essentially contains information about what are we trying to deploy links and mentions this auth file which contains authentication information about how to connect to our private registry now let’s continue with the actual deployment so we have copied here the docker1.aws.json and the auth.json file and they are in this s3 bucket and now we can initialize the deployment and the deployment happens with the aws cli but this time we’ll use a different service so the service to which we’re trying to deploy is elastic beanstalk so i’m going to use aws elastic bean stock and this is something that is done in two steps first of all we have to create an application version so the command that i’m going to use here is create application version with dashes the next command that we need to run is update environment so i’m going to copy this and i’m going to write here update environment so why are these two steps necessary in the first step we are taking this docker run file and we are creating a new application version and then once this application version has been created we actually tell elastic bean stock which environment we want to update on elastic bean stock we have the application but there can be multiple environments in our case we have a single environment but theoretically it’s possible to take one version to create it once and to take it through different environments but in this case we only have one environment so maybe this is why it may look a bit weird in the beginning but these are the steps that are required in order to get this to run now just saying create application version and update environment is not actually sufficient in order to get this to run we need to specify some additional parameters and the first parameter is we need to identify the application right so this is done by writing here dash dash application dash name and if we’re looking here inside elastic bean stock you will see here this is the application name i’m going to copy this as it is here and of course i have the possibility of putting it here directly like application name like this but i don’t want to do that i want to take advantage of variables there are multiple places where we can store this but i’m just gonna put them here inside the job itself so we can add here variables block and for example i’m gonna call this app underscore name column and then this will be the value my website so whenever i need to use this i’m going to put it here so application name dollar sign and i’m going to reference the variable now there’s something you need to pay attention here because my website is composed of two strings so there’s this space here in between if we put this like this this variable gets replaced it will look like this so this command will think that my application name is my and then that website is some other command that we’re executing or some other parameter that we’re giving here and this is not something that is recognized so in order to get around this we need to put this between codes so we’ll have this string between codes because this is why it will know okay it is my and website it contains also the space and the word after this so again i’m gonna also put the variable here between quotes and this application name is also needed for the update environment command so i’m going to copy that there as well additionally when we’re creating the application version we need to specify like a label or which version we are deploying we already have an application version here so it does make sense to use that so i’m going to go ahead and right here dash dash version dash label don’t worry if this goes on a new line it’s just the way it’s edited but actually the command is on a single line and i’m gonna use here app version and this here for update environment yes it does also make sense to specify the application version and i’m gonna add the same command here the same parameter version label to this command now also when we creating this we need to specify somehow this file right so elastic bean stock will not know which bucket is this file how can i read it and everything so for that reason we also have to specify that and we’re going to use this additional parameter source dash bundle and this will allow us to specify an s3 bucket and the s3 bucket will equal this time the bucket that we have used so it’s this one here and we also have to specify the name of the object that we’re referencing and this is s3 key you need to pay attention how you write this it needs to be exactly as i have written it here but i also noticed people in the beginning they don’t understand when they are specifying these additional parameters here is not for example it’s not equal application name equals app name it’s just a space and then comes the value here this is a bit different because this entire thing this entire configuration here is a value that will be read later on so for that reason here it’s okay to have this equals but otherwise there are no equals in these commands all right so to create the application version we have specified application name we have specified the version label and additionally we have specified this source bundle so essentially where is the file that tells us what we should deploy this is almost the same as when we have uploaded that file manually but with that we have also triggered the deployment automatically so we have done two steps in one step here we are doing it in two separate steps so the next part is after creating this version is to update the environment so we have here the application name we have here the version for which application are we deploying this which version are we deploying the next step would be to also specify which environment are we updating i’m gonna write here environment dash name and we also need another variable for the environment i’m gonna call it here app and name you’re free to name them as you wish and again i’m going to go here to elastic bean stock and i’m going to copy this i just want to make sure that i have everything exactly as it is in elastic bean stock if i specify something else then it’s not the same so the environment name will be here and as you can notice here this doesn’t have any spaces so we don’t need to put this value between codes and also all the other values that we had here there are no spaces so we don’t need to put any quotes there but if any of these parameters would have a space that value would need to be between quotes finally let’s also go ahead and re-enable these jobs because we’ll still need a docker image now so we will run the entire pipeline and check if our deployment is working properly however when we take a look at the pipeline we’ll see that the deployed production job has failed so let’s jump into the logs try to understand what has happened and why this job failed you can see here the commands that we have executed so copying these files to s3 still works so no problems there the last command that was executed is this one so elastic beanstalk create application version so there’s a good chance that this command is responsible for whatever error we’re getting here and then we need to look into the logs and see what is the error and we can see here it says something access denied essentially it’s telling that our user which is the gitlab user that we have created if you remember we have created this user with programmatic access is not authorized to perform some action so create application version if you remember we have selected that the user is allowed to work with s3 resources right so uploading files deleting files things like that with s3 that works but we haven’t authorized our user to work with elastic bean stock so we need to change that so from the aws console let’s go ahead and open the im service for identity management we’ll open up our user you see here this is the username gitlab and what we can do here is essentially to attach additional policies so we have here this amazon s3 full access so that works but now we want to add an additional policy so we’re gonna click here on add permissions and gonna attach existing policies i’m going to search here for elastic bean stock and i’m going to give here administrator access for aws elastic beanstalk now i’m not going to go into this policies in very detail we’re just interested in getting this to run but of course if you would use something like this in production you would need to be very careful about what each user is allowed to do so just keep that in mind just using this very generous policies in production is typically not a good idea so i’m gonna add these permissions then and now we’ll see that our user now has this additional permission here so we can now work with elastic beanstalk so going back here to the logs instead of re-running the entire pipeline we can just go to this job and hit this retry button and it will retry the same job we haven’t changed any files and dynamically this policy should now be applied to the user and hopefully this job will work so let’s take a look to see what the job is doing and now this time it looks much better so we have no errors and let’s take a look at the first command create application version now we have executed this and we’re getting back a response right so it’s going to tell us again like the application name which version we have which bucket we’re using which is the name of the file and so on it also starting to process this and the next thing what we’re getting is the update environment so that work without any issues it’s going to tell us again what is the environment name so we can take a look at that application named version and also some technical details about this we can take a look back into the aws console and then look here into the elastic bin stock service to see what’s going on and we’ll be able to see here running versions is 60. i can click here on the environment just to make sure that we indeed have everything the health is okay so we can also go ahead and click on this url and this will open up our website so it does seem to work very well so now we have manually tested that the deployment has been successful but how about that we check in our pipeline that the deployment has been successful and we can use the exact same approach that we have used so far i’m gonna jump back into the pipeline and here inside the deployed production job essentially what we want to do is to use this curl command so should be pretty similar to what we have here when we’re testing the docker image i’m gonna add it here to a new line of course we also need to get the address itself of the application of the environment and if you remember we had something for that already we just need to update the url for the application so i’m going to simply copy this url here and from gitlab i’m going to go to deployments environments and for the production environment i’m going to go ahead and change some settings and we’re no longer using the s3 url we’re using this one and remove here the forward slash so this will be my external url for this environment and what we want to use here is of course the variable that will get us this environment and from the predefined variables probably remember we have used this in the past ci environment name slug url we actually want the url so i’m going to copy this get here into the pipeline configuration and instead of website can also replace http because i don’t need that anymore so i can use ci environment url forward slash version and then we’re getting that version from there now i’m going to tell you if we leave this command as it is right now this will not work and the reason for that is when we are updating this environment aws needs just a few seconds to actually do this deployment to put the new version on the environment this is not instant but the connects command will run immediately after we have essentially triggered this update and that environment may not be ready or may still have the older version so for that reason this curl here will fail so we’ll not get this response the deployment cannot be verified at this point that it has been successful or not so what we need to do here is to wait a bit so what we can do is of course to use something like sleep and wait for like 10 seconds or something like that but in aws there’s a better way to do that when we’re using the aws cli we have a tool which is called weight so weight is an option it is for various services that are at aws including for elastic bean stock so we can right here elastic bean stock weight and then what are we waiting for we are waiting for this environment to be updated so i’m going to write here environment dash updated and then we need to specify the application name the environment name and the version label right so essentially everything that we had here on the previous command i’m gonna simply copy and i’m gonna add it here to the new line and this command will do the following it will essentially in the background it will check with aws hey are you done updating that environment no not yet i need some time okay wait a bit and then we’ll try again hey are you done updating that environment okay i’m done good and then we can stop waiting and then the next command the curl command can run and then we can check if indeed the correct version has been deployed and if our environment is working properly so i’m going to go ahead and commit these changes and we’ll let the entire pipeline run and see how this goes and the pipeline is still successful so we can take a look into the deploy to production job and see what exactly happened here and you’ll be able to see here that this command is executed and after this the next command with curl is also executed and it passes without any issues you will see here version 61 has been deployed this is exactly also the version label that we have here defined so this again confirms that the version that we wanted to deploy has actually landed on the environment where we wanted to have it so that’s about it in terms of deploying to elastic beanstalk so just to recap we have gone through all the stages and we have started by initially building our code whatever we have here compiling it building it running some tests and then publishing this as artifacts and then we have created a docker image essentially we have created an application we have tested that application and then of course we have really a simple pipeline here we didn’t went through any other stages we deployed directly to production but the principles that i’ve shown you here can be used for similar projects and of course based on all the other information that i’ve shown you throughout the course you can build power plants that are more complex than this one but the most important thing is to understand how you can build such pipelines how you can deploy them and how you can end up with something that works and generally to make this process as enjoyable as possible since now we are coming towards the end of the course i thought it would be a good idea for a final assignment and what i have here is a project which will document who has completed this course so what you have to do is to check the course notes and in the course notes you will find the link to this repository and go ahead and click here on request access and in a few hours probably you receive access to this repository and you will be able to make changes to it so you can open the web ide and open a merge request and you will have to add if you wish of course your name to a list of people who have completed this course so let me show you how to do this so once you have access to this you will no longer see this part with requesting access and you can open the web id and you will be not asked to fork this project that’s the main difference and then you can go ahead and change the files the files that we want to change are located here in source and the file that contains the code is this app.js and here there will be a table and i invite you to add your name and other information to this table so for example i’ve added here my name i had it here my username for gitlab but also my country of origin and also message to the entire world and i’m gonna submit this as a merge request and i invite you to do the same so i’m going to go ahead here commit this and i cannot commit directly into the main branch so i have to go through the path of creating a merge request so i creating a feature branch with my name let’s give it a meaningful title and then i can just go ahead and create the merge request once you have access to this project you will be able to see any other merge requests and i invite you to take a look at them to see what other people have changed to make sure that everything is working properly and if someone breaks the pipeline in their own branch maybe you can give people some tips in regards to what they did wrong and what didn’t work so well essentially be part of this review process try to understand how to collaborate on this project and of course once your merge request gets reviewed it will be merged into the main branch and then you will be able to see your name appearing on a web page so i think that’s kind of a nice and an interactive way of essentially concluding this course almost and so yeah i hope you will do this along in terms of editing let me give you an advice once there are a few people that have been added to this list here what i highly recommend is that you don’t just add your name at the end because that’s the highest chance that you will run into complex so when you’re trying to make changes try to put your name somewhere in the middle or something like that between others try to keep the indentation and everything so that it looks nice but yeah that’s my advice to you so see you even after this course i’m gonna collaborate more inside the merge request try to play more with gitlab with pipelines see how it works and yeah looking forward to your contributions all right you did it this is the end of the course but don’t go away yet i still have some valuable tips for you first of all i want to give you a final reminder to terminate any aws services you have created so that you don’t encounter any unexpected costs we have accomplished so many things in a very short amount of time i know this was a lot to take in but i hope it was useful and that this has opened your appetite for learning more about devops gitlab and aws if you enjoy this content you could support me in creating more courses like this one by going to my youtube channel and subscribing link in the video description thank you very very much but there’s also so much more to learn if you found it hard to work with cli commands i do recommend learning about unix utility commands and bash there are also other gitlab features worth exploring if you like working when deploying docker containers you may also want to learn about kubernetes for all the topics mentioned above and anything else i forgot to mention you will find links in the course notes if you enjoy my teaching style and you want to take a more advanced gitlab course go to vdespa.com and check out the courses that i’m offering if you are unsure which course is right for you just send me a message on social media i’m more than happy to help i hope you enjoy spending time with me and i will see you next time

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog